#include <cmath>
#include <cstdio>
#include <iostream>
#include <utility>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int k,n,p,r,c,x,y;
cin>>n>>k>>p;
vector<vector<int> >t(n);
vector<int>a(n,0);
for(int i=0;i<n;i++)t[i]=a;
vector<int>co(n,0);
vector<int>ro(n,0);
for(int i=0;i<k;i++){
cin>>r>>c>>x;
r--;
c--;
t[r][c]=x;
co[c]^=x;
ro[r]^=x;
}
while(p--){
cin>>r>>c>>x>>y;
r--;
x--;
c--;
y--;
int h=t[r][c];
t[r][c]=0;
t[x][y]=h;
co[c]^=h;
ro[r]^=h;
co[y]^=h;
ro[x]^=h;
int con=0;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if((co[i]^ro[j])>0)con++;
}
}
cout<<con<<"\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Runtime error |
45 ms |
65540 KB |
Execution killed with signal 9 |
7 |
Runtime error |
35 ms |
65536 KB |
Execution killed with signal 9 |
8 |
Runtime error |
37 ms |
65540 KB |
Execution killed with signal 9 |
9 |
Runtime error |
35 ms |
65540 KB |
Execution killed with signal 9 |
10 |
Runtime error |
36 ms |
65540 KB |
Execution killed with signal 9 |
11 |
Runtime error |
3 ms |
588 KB |
Execution killed with signal 6 |
12 |
Runtime error |
3 ms |
588 KB |
Execution killed with signal 6 |
13 |
Runtime error |
3 ms |
588 KB |
Execution killed with signal 6 |
14 |
Runtime error |
4 ms |
588 KB |
Execution killed with signal 6 |
15 |
Runtime error |
3 ms |
580 KB |
Execution killed with signal 6 |
16 |
Runtime error |
3 ms |
588 KB |
Execution killed with signal 6 |
17 |
Runtime error |
3 ms |
588 KB |
Execution killed with signal 6 |
18 |
Runtime error |
3 ms |
588 KB |
Execution killed with signal 6 |
19 |
Runtime error |
4 ms |
588 KB |
Execution killed with signal 6 |
20 |
Runtime error |
3 ms |
588 KB |
Execution killed with signal 6 |