| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 115751 | fadi57 | Topovi (COCI15_topovi) | C++14 | 1627 ms | 40120 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>
using namespace std;
 
 
typedef long long     ll;
 
//-*-*-*-*-*-*-*-*-
ll n,z,k,t,ans,m,l,j;
map<ll,ll>r,c,xr,xc;
map<pair<ll,ll>,ll>h;
ll up(ll x,ll y,ll o){
  
   ans-=(n-(xc[r[x]]));
     ans-=(n-(xr[c[y]]));
     if(r[x]==c[y]){ans++;}
     xr[r[x]]--;
     r[x]^=o; //cout<<r[x]^o;
     xc[c[y]]--; 
     c[y]^=o;
     xr[r[x]]++;
     xc[c[y]]++;
     ans+=(n-(xc[r[x]]));
     ans+=(n-(xr[c[y]]));
 if(r[x]==c[y]){ans--;}
ll kk=9;return kk;
    
}
int main()
{
  
  
ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  cin>>n>>m>>t; 
  xr[0]=xc[0]=n;
  for(ll i=0;i<m;i++){
     ll x,y;
cin>>x>>y>>z; h[{x,y}]=z;
up(x,y,z);
  }
for(ll i=1;i<=t;i++){ 
   ll x,y;
cin>>x>>y>>j>>l;
ll o=h[{x,y}]; h[{x,y}]=0;up(x,y,o);up(j,l,o);
cout<<ans<<endl;h[{j,l}]=o;
  }
  return 0;
  
     
   }
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
