#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';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
7 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
8 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
9 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
10 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
11 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
12 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
13 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
14 |
Runtime error |
1 ms |
452 KB |
Execution killed with signal 11 |
15 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
16 |
Runtime error |
1 ms |
452 KB |
Execution killed with signal 11 |
17 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
18 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
19 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
20 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |