# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154155 | SeekingOblivion | Relativnost (COCI15_relativnost) | C++14 | 4091 ms | 61096 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<fstream>
#include<map>
#include<iostream>
#define fin cin
#define fout cout
using namespace std;
//ifstream fin("date.in");
//ofstream fout("date.out");
int i,j,n,k,p,s;
long long sol;
map<int,int> xori,xorj,fi,fj;
map<pair<int,int>,int> r;
void solve(int i,int j,int p)
{
sol-=n-fj[xori[i]];
sol-=n-fi[xorj[j]];
fi[xori[i]]--;xori[i]^=p;fi[xori[i]]++;
fj[xorj[j]]--;xorj[j]^=p;fj[xorj[j]]++;
sol+=n-fj[xori[i]];
sol+=n-fi[xorj[j]];
r[make_pair(i,j)]^=p;
}
int main()
{
fin>>n>>k>>p;
fi[0]=fj[0]=n;
for(;k--;)
{
fin>>i>>j>>s;
solve(i,j,s);
}
for(;p--;)
{
fin>>i>>j;
s=r[make_pair(i,j)];
solve(i,j,s);
fin>>i>>j;
solve(i,j,s);
fout<<sol<<"\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |