# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
448676 | IvnF | Topovi (COCI15_topovi) | C++17 | 1 ms | 460 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;
#define ll long long
#define pb push_back
#define ull unsigned long long
#define fi first
#define se second
#define ld long double
ll n, k, p, arr[105][105];
ll baris[105], kolom[105];
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> k >> p;
for(int i=1;i<=k;++i){
ll r, c; cin >> r >> c >> arr[r][c];
baris[r]^=arr[r][c];
kolom[c]^=arr[r][c];
}
for(int i=1;i<=p;++i){
ll r1, r2, c1, c2;
cin >> r1 >> c1 >> r2 >> c2;
baris[r1]^=arr[r1][c1];
kolom[c1]^=arr[r1][c1];
baris[r2]^=arr[r1][c1];
kolom[c2]^=arr[r1][c1];
swap(arr[r1][c1], arr[r2][c2]);
ll tmp=0;
for(int j=1;j<=n;++j){
for(int k=1;k<=n;++k){
int cur=(baris[j]^arr[j][k]);
cur^=(kolom[k]^arr[j][k]);
if(cur > 0){
tmp++;
}
}
}
cout << tmp << '\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |