Recently,
However, when
began working on his flipper puzzle the other day, he found that no matter how he flipped the rows and columns he couldn't solve it. After raging on the puzzle for a few hours he came to the conclusion that the puzzle had been tampered with and threw it in the trash.Now, seeing this as a perfect opportunity to have some fun,
took 's puzzle and began solving it. This time though, chose to write a program to help him accomplish his task. But due to his subpar programming skills, he wasn't able to finish the program. Can you help him?Input Specification
The first line of input contains the integer
The next
Output Specification
If the puzzle is unsolvable, print -1
.
Otherwise, first output an integer
Note that
Each operation must be one of the following:
R x_i
: Flip all squares in rowC x_i
: Flip all squares in column
Note that the rows count from top to bottom and columns count from left to right.
Constraints
For all subtasks:
In your output,
For 1 out of 15 available marks,
For an additional 3 out of 15 additional marks,
Sample Input 1
3
1 0 0
1 0 0
0 1 1
Sample Output 1
2
R 3
C 1
Note that the rows count from top to bottom and columns count from left to right.
Sample Input 2
3
0 0 0
1 0 0
0 0 0
Sample Output 2
-1
Comments
can someone take a look at my submission? I failed batch 4.
submission: https://dmoj.ca/src/3459073
The problem statement says that
but your 2d array is 
by 
.
Nice catch! I should probably pay more attention.
This comment is hidden due to too much negative feedback. Show it anyway.
As I said below, please read the problem AND input constraints entirely and carefully. 🤡
This comment is hidden due to too much negative feedback. Show it anyway.
By observing the
Output Specification
, we see that Plasmatic specifically wrote:in your case
, with some trivial substitution or the clever proof by kevinyang below we get that 
. Therefore the solutions by the people you mentioned are valid.
In addition, I think it is very important to read the entire problem and think if the comment your posting is helpful for others, or will it just look like a meme.
boo
Hello ybao2000,
You're right! Both these cases can be solved in one operation. However, as stated in the output specification, your solution does not need to minimize the number of operations used. Solutions outputting 7 operations on these cases should score full points.
For future reference, you can display sample cases in the following format
by starting with a line of three backticks ```, followed by your sample, followed by another line of three backticks.
Now, I will attempt to prove that
is valid.
, I can either choose to show either 
or 
.
To show
In this proof, I will show
My very smart friend AQT showed me that
and I will use this to prove 
.

can be used to show that 
. Now, we have this inequality 
.
for any positive integer 
. Let 
be 
and let 
be 
.
, we obtain 
.
operations fit the bounds of this problem, the solutions you claim that have 
operations are now proven to be valid based on the constraints on the problem.
We can use induction to show that
If we substitute these values back into
Since
I hope this clears up any confusion you have.
orz