# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
956318 | Ariadna | Topovi (COCI15_topovi) | C++14 | 43 ms | 65536 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, p;
cin >> n >> k >> p;
vector<int> rows(n, 0), columns(n, 0);
vector<vector<int>> rooks(n, vector<int>(n, 0));
while (k--) {
int r, c, x;
cin >> r >> c >> x;
--r; --c;
rows[r] ^= x;
columns[c] ^= x;
rooks[r][c] = x;
}
while (p--) {
int r1, c1, r2, c2;
cin >> r1 >> c1 >> r2 >> c2;
--r1; --r2; --c1; --c2;
rows[r1] ^= rooks[r1][c1];
columns[c1] ^= rooks[r1][c1];
rooks[r2][c2] = rooks[r1][c1];
rooks[r1][c1] = 0;
rows[r2] ^= rooks[r2][c2];
columns[c2] ^= rooks[r2][c2];
int total = 0;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
if (((rows[i] ^ rooks[i][j]) ^ (columns[j] ^ rooks[i][j])) > 0) ++total;
}
}
cout << total << '\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |