Submission #132798

#TimeUsernameProblemLanguageResultExecution timeMemory
132798VardanyanTopovi (COCI15_topovi)C++14
30 / 120
3 ms632 KiB
#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 timeMemoryGrader output
Fetching results...