#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]];
if(xori[i]!=xorj[j]) sol+=1;
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]];
if(xori[i]!=xorj[j]) sol-=1;
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
4 |
Execution timed out |
4062 ms |
48844 KB |
Time limit exceeded |
5 |
Execution timed out |
4070 ms |
54784 KB |
Time limit exceeded |
6 |
Execution timed out |
4013 ms |
51992 KB |
Time limit exceeded |
7 |
Execution timed out |
4082 ms |
49468 KB |
Time limit exceeded |
8 |
Runtime error |
1696 ms |
33472 KB |
Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
9 |
Execution timed out |
4091 ms |
56032 KB |
Time limit exceeded |
10 |
Execution timed out |
4090 ms |
55280 KB |
Time limit exceeded |