MODULUS2 - BF_MODULUS

 

See also http://www.spoj.com/problems/PROBLEM1/

 

 

Problem

Given an integer n print all the possibilities of a%n.

Input

The first line consists of an integer t, the number of test cases followed by t lines containing an integer n.

Output

For each test case print all the possibilities of a%n in descending order separated by a single space. After each test case print a new line character. If there are no possibilities print "NOT POSSIBLE".

 

Input specifications:

0<t<=100

0<=N<=100

Time limit: 1 second

Example

 

Sample Input

2

1

2

 

Sample Output

0

1 0


Added by:cegprakash
Date:2011-03-18
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:BF

hide comments
2013-05-27 03:59:39 (Tjandra Satria Gunawan)(曾毅昆)
@Mitch Schwartz: Yes, I changed all whitespace to '\n' and got AC it save 10 Bytes... And it's true that this problem is not using exatct judge, thanks..
2013-05-27 03:59:39 Mitch Schwartz
@Tjandra: I resubmitted my last code to see if the judge had changed. It can't be exact judge according to my submission... If you take your AC code and add a single "." to print extra whitespaces, does it become WA? It should stay AC.

Last edit: 2013-04-13 17:46:13
2013-05-27 03:59:39 (Tjandra Satria Gunawan)(曾毅昆)
@Mitch Schwartz: If this problem not using exact judge, my old submission (ID: 7366784) should AC.. it print too many space (line end with 'space''\n'), and I fix this code (remove the space) and got AC.. If it's true that this problem isn't using exact judge, I still don't know why my old code (ID: 7366784) getting WA.. It run perfectly both on ideone and my computer.. strange..
2013-05-27 03:59:39 Mitch Schwartz
@Tjandra: Exact judge isn't used.
2013-05-27 03:59:39 (Tjandra Satria Gunawan)(曾毅昆)
this problem seems using exact judge..
2013-05-27 03:59:39 Mostafa 36a2
@ Aditya Pande tes you're right no '\n' after last line ... it's happend to me too :)
2013-05-27 03:59:39 Aditya Pande
why does my submission give me TLE....?
My guess is it implies the last line ends in EOF and there is no \n for it. Otherwise I have tried a lot of test cases myself

still TLE?
the time limit is not kind enough for me do modulo every time.....
:(

Last edit: 2012-12-29 10:21:11
2013-05-27 03:59:39 Mitch Schwartz
I might as well disclose that my best solution relies on input weakness: N=100 does not appear in the input, and two N=0 in a row also do not appear. I got 300 bytes for general solution but after that only tried to optimise code that relies on weak test data, so I'm not sure what the 300 would turn into trying to optimise for strong data. I think the problem setter would be pretty responsive if there is demand to make the test data stronger; I have his email address from communication on some other problems, if he doesn't respond to comments. Or, maybe the problem description could be changed instead.

I didn't comment before because I figured such variations in input are in some sense "small", and could be guessed at, and didn't break the problem. It could even be considered part of the sport of golfing, to find exploitable weaknesses. There are some other similar situations in challenge section that I didn't comment on.

Last edit: 2012-12-21 05:52:59
2013-05-27 03:59:39 Mitch Schwartz
@Jitesh: In what way did it fail? If you got NZEC with stderr message like "bff: out of memory (294489024)", it could be the bug described here:

http://www.spoj.com/forum/viewtopic.php?f=5&t=8656

I haven't traced that bug exactly, I just notice that a little tweaking of short testing codes can make the difference between NZEC and success, e.g. ",.,." vs. ",.><,.". It didn't prevent any improvement I wanted to make on an actual problem.

If you determine that the bug is definitely preventing your correct solution from getting accepted, by all means write on the forum, it could help motivate the admins to take action.

Last edit: 2012-12-10 03:02:02
2013-05-27 03:59:39 Jitesh
@Mitch Schwartz:
I tried it already but it didn't worked on Ideone... :-(
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.