Task: | Even Grid |
Sender: | bielaltes |
Submission time: | 2024-11-27 17:49:54 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | details |
#2 | WRONG ANSWER | 0.00 s | details |
#3 | WRONG ANSWER | 0.00 s | details |
#4 | WRONG ANSWER | 0.00 s | details |
#5 | WRONG ANSWER | 0.00 s | details |
#6 | WRONG ANSWER | 0.00 s | details |
#7 | WRONG ANSWER | 0.00 s | details |
#8 | WRONG ANSWER | 0.00 s | details |
#9 | WRONG ANSWER | 0.00 s | details |
#10 | WRONG ANSWER | 0.01 s | details |
#11 | WRONG ANSWER | 0.01 s | details |
Code
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<vector<char>> matrix(n, vector<char>(n)); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> matrix[i][j]; } } for (int i = 1; i < n; i++) { for (int j = 1; j < n; j++) { if (matrix[i][j] == '?') { int row_ones = 0; for (int k = 0; k < j; k++) { row_ones += (matrix[i][k] == '1'); } for (int k = j + 1; k < n; k++) { if (matrix[i][k] != '?') { row_ones += (matrix[i][k] == '1'); } } int col_ones = 0; for (int k = 0; k < i; k++) { col_ones += (matrix[k][j] == '1'); } if ((row_ones % 2) == (col_ones % 2)) { matrix[i][j] = '0'; } else { matrix[i][j] = '1'; } } } } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cout << matrix[i][j]; } cout << endl; } return 0; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
2 11 1? |
correct output |
---|
11 11 |
user output |
---|
11 10 |
Test 2
Verdict: WRONG ANSWER
input |
---|
3 101 1?? 0?? |
correct output |
---|
101 101 000 |
user output |
---|
101 111 011 |
Test 3
Verdict: WRONG ANSWER
input |
---|
4 1010 0??? 1??? 0??? |
correct output |
---|
1010 0000 1010 0000 |
user output |
---|
1010 0011 1101 0110 |
Test 4
Verdict: WRONG ANSWER
input |
---|
5 11101 1???? 1???? 1???? ... |
correct output |
---|
11101 11101 11101 11101 00000 |
user output |
---|
11101 10011 10001 10000 01000 |
Test 5
Verdict: WRONG ANSWER
input |
---|
5 10111 1???? 1???? 0???? ... |
correct output |
---|
10111 10111 10111 00000 10111 |
user output |
---|
10111 11100 10110 01011 11101 |
Test 6
Verdict: WRONG ANSWER
input |
---|
5 11000 0???? 0???? 0???? ... |
correct output |
---|
11000 00000 00000 00000 11000 |
user output |
---|
11000 01100 00110 00011 11001 |
Test 7
Verdict: WRONG ANSWER
input |
---|
5 10100 1???? 0???? 1???? ... |
correct output |
---|
10100 10100 00000 10100 10100 |
user output |
---|
10100 11110 01111 11111 10111 |
Test 8
Verdict: WRONG ANSWER
input |
---|
5 10100 1???? 1???? 0???? ... |
correct output |
---|
10100 10100 10100 00000 10100 |
user output |
---|
10100 11110 10111 01011 11101 |
Test 9
Verdict: WRONG ANSWER
input |
---|
10 1010000000 1????????? 0????????? 0????????? ... |
correct output |
---|
1010000000 1010000000 0000000000 0000000000 0000000000 ... |
user output |
---|
1010000000 1111000000 0111100000 0011110000 0001111000 ... |
Test 10
Verdict: WRONG ANSWER
input |
---|
100 100010110100011000001111001110... |
correct output |
---|
100010110100011000001111001110... |
user output |
---|
100010110100011000001111001110... |
Test 11
Verdict: WRONG ANSWER
input |
---|
100 100100110000010110111101111101... |
correct output |
---|
100100110000010110111101111101... |
user output |
---|
100100110000010110111101111101... |