#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 |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Runtime error |
3 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Runtime error |
3 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
11 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Runtime error |
2 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
13 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
14 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
15 |
Runtime error |
3 ms |
524 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
16 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Runtime error |
3 ms |
604 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
18 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
19 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
20 |
Runtime error |
3 ms |
508 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |