#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) x.begin(),x.end()
#define LINE 0
#define COLOUMN 1
using i64=long long;
map<int,int>value[2],cnt[2];
map<pair<int,int>,int>mpp;
int n;
i64 cost;
void add(int poz,int val,bool tip)
{
cost-=(n-cnt[tip^1][value[tip][poz]]);
cnt[tip][value[tip][poz]]--;
value[tip][poz]^=val;
cnt[tip][value[tip][poz]]++;
cost+=(n-cnt[tip^1][value[tip][poz]]);
}
void change(int l1,int r1,int l2,int r2)
{
int vall=mpp[make_pair(l1,r1)];
add(l1,vall,LINE);
add(r1,vall,COLOUMN);
add(l2,vall,LINE);
add(r2,vall,COLOUMN);
mpp[make_pair(l2,r2)]=vall;
}
int main()
{
int k,q;
cin>>n>>k>>q;
cnt[LINE][0]=n;
cnt[COLOUMN][0]=n;
for(int i=0;i<k;i++)
{
int x,y,k;
cin>>x>>y>>k;
add(x,k,LINE);
add(y,k,COLOUMN);
mpp[make_pair(x,y)]=k;
}
cout<<cost<<'\n';
while(q--)
{
int l1,r1,l2,r2;
cin>>l1>>r1>>l2>>r2;
change(l1,r1,l2,r2);
cout<<cost<<'\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
500 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
6 |
Incorrect |
123 ms |
6056 KB |
Output isn't correct |
7 |
Incorrect |
93 ms |
5272 KB |
Output isn't correct |
8 |
Incorrect |
74 ms |
4432 KB |
Output isn't correct |
9 |
Incorrect |
75 ms |
4544 KB |
Output isn't correct |
10 |
Incorrect |
89 ms |
4812 KB |
Output isn't correct |
11 |
Incorrect |
1043 ms |
39336 KB |
Output isn't correct |
12 |
Incorrect |
1076 ms |
39660 KB |
Output isn't correct |
13 |
Incorrect |
1067 ms |
39584 KB |
Output isn't correct |
14 |
Incorrect |
1101 ms |
39344 KB |
Output isn't correct |
15 |
Incorrect |
1064 ms |
39460 KB |
Output isn't correct |
16 |
Incorrect |
1096 ms |
39340 KB |
Output isn't correct |
17 |
Incorrect |
1049 ms |
39292 KB |
Output isn't correct |
18 |
Incorrect |
1105 ms |
39440 KB |
Output isn't correct |
19 |
Incorrect |
1102 ms |
39324 KB |
Output isn't correct |
20 |
Incorrect |
1110 ms |
39312 KB |
Output isn't correct |