ButtonsProblem code: BUTTONS |
Each cell of an N x N grid is either a 0 or a 1. You are given two such N x N grids, the initial grid and the final grid. There is a button against each row and each column of the initial N x N grid. Pressing a row-button toggles the values of all the cells in that row, and pressing a column-button toggles the values of all the cells in that column. You are required to find the minimum number of button presses required to transform the grid from the initial configuration to the final configuration, and the buttons that must be pressed in order to make this transformation.
Edit: When the initial and the final configurations are the same, print "0".
Input
The first line contains t, the number of test cases (about 10). Then t test cases follow.
Each test case has the following form:
* The first line contains n, the size of the board (1 ≤ n ≤ 1000).
* n lines follow. The ith line contains n space separated integers representing the ith row of the initial grid. Each integer is either a 0 or a 1.
* n lines follow, representing the final grid, in the same format as above.
Output
For each test case, output the number of row-button presses, followed by the row buttons that must be pressed. Print the number of column-button presses next, followed by 0-indexed indices of the column buttons that must be pressed. The total number of button presses must be minimized.
Output "-1" if it is impossible to achieve the final configuration from the initial configuration. If there is more than one solution, print any one of them.
Example
Input: 1 3 0 0 0 1 1 0 1 1 0 1 1 0 1 1 1 1 1 1 Output: 1 0 1 2
| Author: | admin |
| Date Added: | 17-07-2009 |
| Time Limit: | 5 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments
SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:
HELP
Program should read from standard input and write to standard output. After you submit a solution you can see your results by clicking on the [My Submissions] tab on the problem page. Below are the possible results:
- Accepted
Your program ran successfully and gave a correct answer. If there is a score for the problem, this will be displayed in parenthesis next to the checkmark. - Time Limit Exceeded
Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach. - Wrong Answer
Your program compiled and ran succesfully but the output did not match the expected output. - Runtime Error
Your code compiled and ran but encountered an error. The most common reasons are using too much memory or dividing by zero. For the specific error codes see the help section. - Compilation Error
Your code was unable to compile. When you see this icon, click on it for more information.
If you are still having problems, see a sample solution here.

Fetching successful submissions

dfdfdfdfdfdf
Please don't spam the comments section.
I am getting correct answer on my machine. but cant clear the online judge.
The test cases are correct. You need to recheck your algorithm if you are getting a WA on the judge
Test Cases:
4
6
0 0 0 0 0 0
1 1 1 1 1 1
1 1 1 1 1 1
0 0 0 0 0 0
0 0 0 0 0 0
1 1 1 1 1 1
0 0 1 0 1 0
0 0 1 0 1 1
1 1 0 1 0 0
1 1 0 1 0 0
0 0 1 0 1 1
0 0 1 0 1 1
3
0 0 0
1 1 0
1 1 0
1 1 1
1 1 0
1 1 0
3
0 0 0
1 1 0
1 1 0
1 1 0
1 1 1
1 1 1
4
1 0 1 0
1 1 1 1
0 1 1 0
0 0 0 1
0 0 0 0
1 0 1 0
1 1 0 0
0 1 0 0
Output:
-1
1
0
0
1
0
1
2
2
0
2
2
1
3
Its working for my test cases but giving WA on codechef. Can you confirm that output / format is correct ?
How should the output be when there are multiple test cases? I mean the way @nish82 specifies or should there be a blank line between two results?
What about results where only the row button needs to be pressed and there wouldn't be any column button pressed?
One more question, what should the output be when the initial and final grid are the same? Should it be "-1" or 0\n0 ?
The output is one at each line ... the comment doesnt' preserve the formatting.
I too have doubt about result when (1) initial and final grid is same ... should result be 0 \n 0\n (2) initial and final grid is 1's complement of each other ... in this case pressing either all row button or all column button will give answer .... what does codechef expects ? (3) What should be output syntax fo multiple test cases ?
@Nischal Shetty: The answers for two consecutive cases must be separated by a "\n". There is no blank line required to be printed between them. When the initial and the final grids are the same, the answer is 0.
@nlsh82: From the problem statement: "If there is more than one solution, print any one of them." Answers to two consecutive test cases must be separated by a "\n".
@nish82
Complement is fine, you can print any one of the result since they've said when there are multiple solutions you can print any one.
As for the rest, let's hope the admin comes to our rescue ;)
@Admin: The problem statement must be fixed to incorporate your comment.
"When the initial and the final grids are the same, the answer is 0."
This explains why no body (but me), got it accepted.
@Prasanna S: When the initial and the final board configurations are the same, it is possible to reach the final board state from the initial, using 0 moves. It is evident from the problem statement that 0 is the expected answer, and not -1, which must be printed only if it is impossible to reach the final state from the initial.
@Admin: The problem is that people end up printing "0\n0\n" for that test case - while you are expecting "0\n"; Please check your test data.
Why would anyone ever print
bit confused .... can admin
I second @nish82's comment
@ Stephen Merriman The
@Abhilash I completely agree
Oops, sorry, I misread the
hi, how should be the output
hi,
how should be the output if more than two buttons in a row/column are pressed ?
like:-
000
110
110
to
000
001
001
What will be the expected o/p ? the 2nd and 3rd rows have toggled.. so should the output be -
2
1 2
0
0
(or)
2
1
2
0
0
@Prasanna S: You are right.
@Prasanna S: You are right. The problem statement has been fixed.
@Vaidyanathan S: Both will get accepted.
@CodechefDrupal->@Vaidyanatha
@CodechefDrupal->@Vaidyanathan:
Drupal,
Though there are no column toggles, why do we print 0 0 in the above post by Vaidyanathan?
Is it not enough to print just a zero as
2
1
2
0
0 ( Is this zero necessary to successfully submit the problem?)
I am wondering if 0 is a
I am wondering if 0 is a valid input for number of testcases ? Similar case for board size. My dumb prog gives a segv there! ( and ofcourse I am going to correct it)
sorry, did not check that
sorry, did not check that board size lies between 1 and 1000. BTW I am assuming that number of testcases can be 0/-1/...
@Codechef Admin : Please
@Codechef Admin : Please compare my two solutions with ids#99931 & #99925. One has been judged as wrong answer while the other as right. However, according to me both are correct.
The difference between the codes are the line numbers 34 to 36. This part of the code just toggles the first column and first row respectively if the first element of the matrix needs to be toggled.
But, this should hardly make any difference because in both the cases, the solutions would remain the same except when the total number of toggling is exactly N, for which there would be two possible solutions and as the problem statement states that any solution with minimum total toggling would be judged as correct, both solutions should have been judged as correct.
I have tested against several
I have tested against several test cases (boundary ones included) and I think my algorithm is correct. However, I can't seem to get a success response whenever I submit my solution.
Am I missing some important test case?
Well.. is there a way I can find out if I am missing some test case? Or as @Shishir Mittal suggests above, I am not printing the list of buttons in the sequence that the CodeCheck is expecting. How can I be sure?
How can I get a sample list of test cases?
The judge is definitely
The judge is definitely faulty. I only got accepted after sorting the output, ie printing the list of row buttons and the list of column buttons in increasing order. Doesn't say that anywhere in the statement, so you could try that.
If say the row button presses
If say the row button presses is 1 2 and there are no column button presses required, so which of the following ways of presenting output would be accepted ?
Case (I)
2
1
2
0
Case (II)
2
1
2
0
0
Case (III)
2
1 2
0
Case (IV)
2
1 2
0
0
When intial and final
When intial and final configuration are same , out put is 0.
When there is no row button press, output is 0 followed by column button presses.
if i have following output i can make different opinion.
0
0
1
1
0
1st:
0 #initial final same
--
0 #initial final same
--
1 #1 row button pressed
1
0 #0 column button pressed
2nd:
0 #initial final same
--
0 #0 row button pressed
1 #1 column button pressed
1
--
0 #initial final same
How do the judge find out the correct one ....
I am very confused..Please help.
@Ujjwal: The former would be
@Ujjwal: The former would be the judge's interpretation.
@kub31t: Case I and Case III will get accepted.
@Aniruddha: So how to
@Aniruddha: So how to represent the later case ?
I mean how to represent if
I mean how to represent if there is no row button to press and only column buttons ? Please reply .
@Ujjwal: There is no test
@Ujjwal: There is no test case where such a situation happens. If no button needs to pressed, print "0". If no row button needs to pressed and 2 column buttons need to be pressed, print "0 2 column_button_1 column_button_2". If no column button needs to pressed and a row button needs to pressed, print "1 row_button 0".
I am uploading a file called
I am uploading a file called Buttons.java but it returns an error - Class Buttons is public, should be declared in a file named Buttons.java. What could be the problem here? btw, it works fine in my IDE(Eclipse)
The class name should be
The class name should be 'Main' , upload a file Main.java or copy/paste code and change class name to 'Main' before submitting. Refer FAQ
After pasting the test cases,
After pasting the test cases, my program needs a carriage return to proceed. Thats how the sample program works too, so i dont think it should be a problem. Is it?
But i've checked every conceivable test case, still getting WA. You really should give the failed test case......
2 questions : like in
2 questions :
like in nlsh82's last case , if u interchange the rows and colum number u would still end up getting the same answer , so will that be accepted ?
if say theres a solution rows = 3 and cols = 2 but u can also get rows = 2 and cols = 3 , again which is accepted ?
im getting correct results
im getting correct results but judge is giving WA. Can somebody give me more testcases ?
Make some up yourself. Easy
Make some up yourself. Easy to make up a huge number of small ones that can be checked with brute force.
Dear Admin, The judge is
Dear Admin,
The judge is faulty. Even though its mentioned in the problem that all the possible solutions are accepted. Its accepting only one solution out of the two solutions obtained when the number of toggles equals n. It has to be corrected.
Hi "nlsh82 - 14th Aug,2009
Hi "nlsh82 - 14th Aug,2009 23:28:14."
Even in my case it was saying WrongAnswer Initially.
Point is for the below test case there are two outputs
one you mentioned above..(which is WA according to judge,logically both are correct)
2
0
2
2
1
3
So try to print the other answer like below..
1
4
1 0 1 0
1 1 1 1
0 1 1 0
0 0 0 1
0 0 0 0
1 0 1 0
1 1 0 0
0 1 0 0
2
1
3
2
0
2
Thanks
Murthy Kavali
i m still wondering , i m
i m still wondering , i m getting all the answers same as "mlsh82's" test cases except the last one for which i m getting output as "murthy" mentioned in that format. Still getting wrong answer , i m sure my doubts about the algo should be shaken away if these test cases are giving me the answers as mentioned. So still seems to be some judging issues !!
Hi Admins, I am even facing
Hi Admins,
I am even facing the same problem as faced by others. I guess, the problem statement doesn't correctly specify the output format that would be accepted by the Judge. If you can, please can you elaborate on what is the exact output format accepted by the judge.
The issues being:
1. What to print when the initial and final state are same?
2. If there are multiple solutions, can we print any? Coz I guess the judge isnt configured to accept all possible solutions.
Regards,
Vivek
I too think checker is faulty
I too think checker is faulty it's accepting only one possible solution out of other's correct one possible
Admin I am getting the output
Admin
I am getting the output for all the cases givem by nish82. But as Murty mentioned, for this test case
1
4
1 0 1 0
1 1 1 1
0 1 1 0
0 0 0 1
0 0 0 0
1 0 1 0
1 1 0 0
0 1 0 0
i am getting the output
2
0
2
2
1
3
which is also correct. But still i am getting WA by judge. Judge wants this answer
2
1
3
2
0
2
both are right. then y is the previous output a WA? Please help
It only means the judge
It only means the judge accepts solutions done by only one specific logic and rejects other logic even though the answer may be right. Any help is apprecitated. thank you.
Yeah, it's already known as
Yeah, it's already known as per several earlier comments that the judge is incorrect. Hopefully they'll fix it sometime; other than that, you'll just have to try another problem.
Works fine on my pc...dnt knw
Works fine on my pc...dnt knw hw it went wrong out here :(
I have tried all possible
I have tried all possible ways accordiing to the problem statements and above comments, still getting 'WA'. This is soooooo discouraging .............
plz make it more clear..
plz make it more clear..
@admin please mention that
@admin please mention that rows indices and column indices are in increasing order in the o/p which resulted in wrong answer many times.
@admin Help!! I have tried so
@admin Help!! I have tried so many test cases and everytime it seems to work fine. Could you please give me the test case that is failing? If it is because of faulty judge, atleast let us know if you are going to fix it. I couldn't see any response from you since 12th Oct.
After trying all the possible
it's an easy one!
it's an easy one!
@admin:I've done the same as
@admin:I've done the same as Arunabh Trivedi is saying in the above comment. . . . .Bt it's still nt working :( :(
can u please suggest me what to do. . ? ?
@admin plz hv a look at my
@admin plz hv a look at my solution. . .
http://discussed.codechef.com/showthread.php?t=1238
@admin : ???????????????????
@admin : ???????????????????
@stephen: can u please check
@stephen: can u please check my soltion ? ? ??
http://discussed.codechef.com/showthread.php?t=1238
Many of you might be
Many of you might be struggling even with the logic right, you might have missed out some simple case....
make sure that you take care of both '0 change' case....
that was the last case which took me so long to figure out....
@Adim, As rightly pointed out
@Adim,
As rightly pointed out by someone, the judge does not accept both the correct answers when the number of toggles equals 'n'. It only accepts one of the two correct answers.
@Admin, As rightly pointed
@Admin,
As rightly pointed out by someone, the judge does not accept both the correct answers when the number of toggles equals 'n'. It only accepts one of the two correct answers.
@Admin- Please Check ur
@Admin- Please Check ur Judge..!!
can anyone tell that do we
can anyone tell that do we have to first press a series of row buttons and then a series of column buttons
respond as soon as possible
can anyone tell that do we
can anyone tell that do we have to first press a series of row buttons and then a series of column buttons
respond as soon as possible
@garima- key press order
@garima- key press order doesn't matter.
Seems the problem of judge
Seems the problem of judge has not been rectified yet. Apart from above problems, judge has problem with "bool" datatype in C. it gives compilation error for my http://www.codechef.com/viewsolution/436697 solution but when i changed all my bools to int, it ran without error but asusual WA. kindly rectify the matter
There's no such thing as bool
There's no such thing as bool in C.. that's nothing to do with Codechef.
i can't submit my solution.
i can't submit my solution. somethin's wrong with the 'submit' page :(
Thanks stephen, I later had
Thanks stephen, I later had understood that fact. but the problem of WA persists, most probably because of incorrect judge. can someone confirm if judge is still faulty or was it rectified.
There is some problem for
There is some problem for sure.
Any one with the correct answer please run your code for this input and please give back the output.
5
30
0 0 1 0 1 0 1 0 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 1 0 0 1 0 0
0 0 1 0 1 0 1 0 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 1 0 0 1 0 0
0 0 1 0 1 0 1 0 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 1 0 0 1 0 0
1 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 1 0 1 1 0 1 1
1 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 1 0 1 1 0 1 1
0 0 1 0 1 0 1 0 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 1 0 0 1 0 0
1 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 1 0 1 1 0 1 1
0 0 1 0 1 0 1 0 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 1 0 0 1 0 0
1 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 1 0 1 1 0 1 1
1 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 1 0 1 1 0 1 1
1 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 1 0 1 1 0 1 1
1 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 1 0 1 1 0 1 1
0 0 1 0 1 0 1 0 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 1 0 0 1 0 0
1 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 1 0 1 1 0 1 1
1 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 0 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1 0 0 1 0 1 0 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 1 0 1 0 0
0 1 1 0 1 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 1 0 1 0 1 1
0 1 1 0 1 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 1 0 1 0 1 1
3
0 1 0
0 1 0
1 0 1
0 1 0
1 0 1
0 1 0
5
1 0 0 0 0
1 0 0 0 0
1 0 0 0 0
0 1 1 1 1
1 0 0 0 0
1 0 1 1 1
1 0 1 1 1
0 1 0 0 0
0 1 0 0 0
1 0 1 1 1
10
1 1 0 0 0 1 0 1 1 1
1 1 0 0 0 1 0 1 1 1
1 1 0 0 0 1 0 1 1 1
0 0 1 1 1 0 1 0 0 0
0 0 1 1 1 0 1 0 0 0
0 0 1 1 1 0 1 0 0 0
1 1 0 0 0 1 0 1 1 1
1 1 0 0 0 1 0 1 1 1
1 1 0 0 0 1 0 1 1 1
0 0 1 1 1 0 1 0 0 0
1 1 0 1 0 0 0 0 1 0
0 0 1 0 1 1 1 1 0 1
1 1 0 1 0 0 0 0 1 0
0 0 1 0 1 1 1 1 0 1
1 1 0 1 0 0 0 0 1 0
0 0 1 0 1 1 1 1 0 1
0 0 1 0 1 1 1 1 0 1
1 1 0 1 0 0 0 0 1 0
1 1 0 1 0 0 0 0 1 0
1 1 0 1 0 0 0 0 1 0
i will be very thankful..
:)
I
I think the question has some
Can someone else with a
My output is exactly the same
can someone provide hint ,How
My program is printing
Finally got accepted :) here