| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 98625 | minhtung0404 | Topovi (COCI15_topovi) | C++17 | 1372 ms | 33776 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>
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& cur = val[i][num];
    ans += 1LL * mp[0][cur] * mp[1][cur];
    mp[i][cur]--;
    ans -= 1LL * mp[0][cur] * mp[1][cur];
    cur ^= x;
    ans += 1LL * mp[0][cur] * mp[1][cur];
    mp[i][cur]++;
    ans -= 1LL * mp[0][cur] * mp[1][cur];
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n >> k >> p;
    mp[0][0] = mp[1][0] = n;
    while (k--){
        int r, c, x;
        cin >> r >> c >> x;
        add(0, r, x); add(1, c, x);
        ro[ii(r,c)] = x;
    }
    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); add(1, c1, x);
        add(0, r2, x); add(1, c2, x);
        cout << ans << "\n";
    }
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
