Task: | Even Grid |
Sender: | Rasse |
Submission time: | 2024-11-27 16:56:20 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | ACCEPTED |
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 | ACCEPTED | 0.00 s | details |
#6 | ACCEPTED | 0.00 s | details |
#7 | ACCEPTED | 0.00 s | details |
#8 | ACCEPTED | 0.00 s | details |
#9 | ACCEPTED | 0.00 s | details |
#10 | ACCEPTED | 0.00 s | details |
#11 | ACCEPTED | 0.00 s | details |
Compiler report
input/code.cpp: In function 'void solve()': input/code.cpp:99:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare] 99 | for (int i = 0; i < res.size(); i++) | ~~^~~~~~~~~~~~ input/code.cpp:101:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 101 | for (int j = 0; j < res[i].size(); j++) | ~~^~~~~~~~~~~~~~~
Code
#include <iostream> #include <vector> #include <array> #include <string> #include <algorithm> #include <numeric> #include <unordered_map> #include <unordered_set> #include <set> #include <queue> #include <climits> #include <cmath> #include <functional> #include <type_traits> #include <fstream> #include <bitset> #include <complex> #include <iomanip> #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // gcc only template<typename T> using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type, std::less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>; #define int long long using namespace std; int p(int base, int power, int mod) { if (power == 0) return 1; if (power % 2 == 0) { int r = p(base, power/2, mod); return (r*r) % mod; } else return (p(base, power-1, mod)*base) % mod; } int LCM(int a, int b) { return (a / __gcd(a, b)) * b; } int mod = 1e9+7; void solve() { int n; cin >> n; vector<vector<int>> res(n, vector<int>(n, 0)); vector<int> probs; vector<int> rows; string s; cin >> s; for (int i = 0; i < n; i++) { res[0][i] = s[i]-'0'; if (i != 0 && s[i] != '0') { probs.push_back(i); } } for (int i = 1; i < n; i++) { string row; cin >> row; res[i][0] = row[0]-'0'; if (row[0] != '0') { rows.push_back(i); } } while(!rows.empty() && !probs.empty()) { res[rows.back()][probs.back()] = 1; rows.pop_back(); probs.pop_back(); } while (!rows.empty()) { res[rows.back()][1] = res[rows.back()][1] ? 0 : 1; rows.pop_back(); } while (!probs.empty()) { res[1][probs.back()] = res[1][probs.back()] ? 0 : 1; probs.pop_back(); } for (int i = 0; i < res.size(); i++) { for (int j = 0; j < res[i].size(); j++) { cout << res[i][j]; } cout << '\n'; } } signed main() { ios::sync_with_stdio(0); cin.tie(0); int t = 1; //cin >> t; for (int i = 0; i < t; i++) { solve(); //cout.flush(); } }
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: ACCEPTED
input |
---|
5 10111 1???? 1???? 0???? ... |
correct output |
---|
10111 10111 10111 00000 10111 |
user output |
---|
10111 10100 10010 00000 10001 |
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: ACCEPTED
input |
---|
5 10100 1???? 0???? 1???? ... |
correct output |
---|
10100 10100 00000 10100 10100 |
user output |
---|
10100 11000 00000 11000 10100 |
Test 8
Verdict: ACCEPTED
input |
---|
5 10100 1???? 1???? 0???? ... |
correct output |
---|
10100 10100 10100 00000 10100 |
user output |
---|
10100 11000 11000 00000 10100 |
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: ACCEPTED
input |
---|
100 100010110100011000001111001110... |
correct output |
---|
100010110100011000001111001110... |
user output |
---|
100010110100011000001111001110... |
Test 11
Verdict: ACCEPTED
input |
---|
100 100100110000010110111101111101... |
correct output |
---|
100100110000010110111101111101... |
user output |
---|
100100110000010110111101111101... |