MODULUS2 - BF_MODULUS

no tags 

 

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


hide comments
(Tjandra Satria Gunawan)(曾毅昆): 2013-05-27 03:59:39

@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..

Mitch Schwartz: 2013-05-27 03:59:39

@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
(Tjandra Satria Gunawan)(曾毅昆): 2013-05-27 03:59:39

@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..

Mitch Schwartz: 2013-05-27 03:59:39

@Tjandra: Exact judge isn't used.

(Tjandra Satria Gunawan)(曾毅昆): 2013-05-27 03:59:39

this problem seems using exact judge..

Mostafa 36a2: 2013-05-27 03:59:39

@ Aditya Pande tes you're right no '\n' after last line ... it's happend to me too :)

Aditya Pande: 2013-05-27 03:59:39

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
Mitch Schwartz: 2013-05-27 03:59:39

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
Mitch Schwartz: 2013-05-27 03:59:39

@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
Jitesh: 2013-05-27 03:59:39

@Mitch Schwartz:
I tried it already but it didn't worked on Ideone... :-(


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