#include<bits/stdc++.h>
const int N = 1e5 + 5;
using namespace std;
typedef pair <int, int> ii;
map <int, int> mp[2], val[2];
map <ii, int> ro;
int n, k, p;
long long ans;
void add(int i, int num, int x, int v){
ans += 1LL * mp[0][val[i][num]] * mp[1][val[i][num]];
mp[i][val[i][num]]--;
val[i][num] ^= x;
mp[i][val[i][num]]++;
ans -= 1LL * mp[0][val[i][num]] * mp[1][val[i][num]];
}
int main(){
freopen("TOPOVI.inp", "r", stdin);
freopen("TOPOVI.out", "w", stdout);
cin >> n >> k >> p;
ans = k * k;
while (k--){
int r, c, x;
cin >> r >> c >> x;
add(0, r, x, 1); add(1, c, x, 1);
ro[ii(r,c)] = 1;
}
while (p--){
int r1, c1, r2, c2;
cin >> r1 >> c1 >> r2 >> c2;
int x = ro[ii(r1,c1)];
ro[ii(r1,c1)] = 0; ro[ii(r2,c2)] = x;
add(0, r1, x, -1); add(1, c1, x, -1);
add(0, r2, x, +1); add(1, c2, x, +1);
cout << ans << "\n";
}
}
Compilation message
topovi.cpp: In function 'int main()':
topovi.cpp:20:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
freopen("TOPOVI.inp", "r", stdin);
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
topovi.cpp:21:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
freopen("TOPOVI.out", "w", stdout);
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
252 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
256 KB |
Output isn't correct |
3 |
Incorrect |
3 ms |
256 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
7 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
10 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
11 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
12 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
13 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
14 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
15 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
16 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
17 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
18 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
19 |
Incorrect |
2 ms |
300 KB |
Output isn't correct |
20 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |