# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
132798 | Vardanyan | Topovi (COCI15_topovi) | C++14 | 3 ms | 632 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;
const int N = 1000*100+5;
//map<int,int> row;
int row[N];
//map<int,int> col;
int col[N];
int R[N],C[N],X[N];
map<pair<int,int>,int> pos;
int main(){
ios_base::sync_with_stdio(false);
int n,k,p;
cin>>n>>k>>p;
for(int i = 1;i<=k;i++){
cin>>R[i]>>C[i]>>X[i];
row[R[i]]^=X[i];
col[C[i]]^=X[i];
pos[{R[i],C[i]}] = X[i];
}
while(p--){
int r1,c1,r2,c2;
cin>>r1>>c1>>r2>>c2;
int x = pos[{r1,c1}];
row[r1]^=x;
col[c1]^=x;
row[r2]^=x;
col[c2]^=x;
pos[{r2,c2}] = x;
pos[{r1,c1}] = 0;
int ans = 0;
for(int r = 1;r<=n;r++){
for(int c = 1;c<=n;c++){
// pair<pair<int,int> ,int > now = *it;
// if(now.second == 0) continue;
// if(pos[{r,c}] == 0) continue;
// int r = now.first.first;
// int c = now.first.second;
int u = row[r]^col[c];
// u^=pos[{r,c}];
if(u>0) ans++;
}
}
cout<<ans<<endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |