Task: | Even Grid |
Sender: | Nallue |
Submission time: | 2024-11-27 17:05:07 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | ACCEPTED | 0.00 s | details |
#5 | WRONG ANSWER | 0.00 s | details |
#6 | ACCEPTED | 0.00 s | details |
#7 | WRONG ANSWER | 0.00 s | details |
#8 | WRONG ANSWER | 0.00 s | details |
#9 | ACCEPTED | 0.00 s | details |
#10 | WRONG ANSWER | 0.01 s | details |
#11 | WRONG ANSWER | 0.01 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:36:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 36 | for(int i=1; i<cols.size(); i++){ | ~^~~~~~~~~~~~ input/code.cpp:38:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 38 | for(int l=1; l<fils.size(); l++){ | ~^~~~~~~~~~~~
Code
#include <iostream> #include <vector> using namespace std; int main(){ int n; cin >> n; vector<vector<int>> grid(n,vector<int>(n)); vector<bool> cols(n,true); vector<bool> fils(n,true); for(int i=0;i<n;i++){ for(int l=0; l<n; l++){ char temp; cin >> temp; if(temp=='?'){ grid[i][l]=-1; } else if(temp=='1'){ grid[i][l]=1; fils[i] = !fils[i]; cols[l] = !cols[l]; } else{ grid[i][l]=0; } } } for(int i=1; i<cols.size(); i++){ if(!cols[i]){ for(int l=1; l<fils.size(); l++){ if(!fils[l]){ grid[l][i]=1; cols[i]=true; fils[i]=true; break; } } } } for(int i=0;i<n;i++){ for(int l=0; l<n; l++){ if(grid[i][l]==-1){ cout << 0; continue; } cout << grid[i][l]; } cout << endl; } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
2 11 1? |
correct output |
---|
11 11 |
user output |
---|
11 11 |
Test 2
Verdict: ACCEPTED
input |
---|
3 101 1?? 0?? |
correct output |
---|
101 101 000 |
user output |
---|
101 101 000 |
Test 3
Verdict: ACCEPTED
input |
---|
4 1010 0??? 1??? 0??? |
correct output |
---|
1010 0000 1010 0000 |
user output |
---|
1010 0000 1010 0000 |
Test 4
Verdict: ACCEPTED
input |
---|
5 11101 1???? 1???? 1???? ... |
correct output |
---|
11101 11101 11101 11101 00000 |
user output |
---|
11101 11000 10100 10001 00000 |
Test 5
Verdict: WRONG ANSWER
input |
---|
5 10111 1???? 1???? 0???? ... |
correct output |
---|
10111 10111 10111 00000 10111 |
user output |
---|
10111 10111 10000 00000 10000 |
Test 6
Verdict: ACCEPTED
input |
---|
5 11000 0???? 0???? 0???? ... |
correct output |
---|
11000 00000 00000 00000 11000 |
user output |
---|
11000 00000 00000 00000 11000 |
Test 7
Verdict: WRONG ANSWER
input |
---|
5 10100 1???? 0???? 1???? ... |
correct output |
---|
10100 10100 00000 10100 10100 |
user output |
---|
10100 10100 00000 10000 10000 |
Test 8
Verdict: WRONG ANSWER
input |
---|
5 10100 1???? 1???? 0???? ... |
correct output |
---|
10100 10100 10100 00000 10100 |
user output |
---|
10100 10100 10000 00000 10000 |
Test 9
Verdict: ACCEPTED
input |
---|
10 1010000000 1????????? 0????????? 0????????? ... |
correct output |
---|
1010000000 1010000000 0000000000 0000000000 0000000000 ... |
user output |
---|
1010000000 1010000000 0000000000 0000000000 0000000000 ... |
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... |