# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
230586 |
2020-05-10T13:41:41 Z |
soroush |
Topovi (COCI15_topovi) |
C++14 |
|
2000 ms |
46240 KB |
#include <map>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int ,int > pii;
map < int , int > cntstr , cntstn;
map < pii , int > rook;
map < int , int > str , stn;
ll ans = 0;
int n , k , p;
void add(int x ,int y , int w){
rook[{x , y}]^=w;
ans+=(cntstn[str[x]] + cntstr[stn[y]]);
ans+=ll(str[x]!=stn[y]);
cntstr[str[x]]--;
cntstn[stn[y]]--;
str[x]^=w;
stn[y]^=w;
cntstr[str[x]]++;
cntstn[stn[y]]++;
ans-=ll(str[x]!=stn[y]);
ans-=(cntstn[str[x]] + cntstr[stn[y]]);
}
int main(){
cin >> n >> k >> p;
cntstr[0] = cntstn[0] = n;
for(int i = 0 ; i < n; i ++){
int x , y;
cin >> x >> y;
int w;
cin >> w;
add(x , y , w);
}
while(p--){
int x1 , y1 , x2 , y3;
cin >> x1 >> y1 >> x2 >> y3;
int val = rook[{x1 , y1}];
add(x1 , y1 , val);
add(x2 , y3 , val);
cout << ans << endl;
}
return(0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
4 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
5 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
6 |
Incorrect |
1229 ms |
8136 KB |
Output isn't correct |
7 |
Incorrect |
721 ms |
6520 KB |
Output isn't correct |
8 |
Incorrect |
926 ms |
5496 KB |
Output isn't correct |
9 |
Incorrect |
966 ms |
5680 KB |
Output isn't correct |
10 |
Incorrect |
1008 ms |
6136 KB |
Output isn't correct |
11 |
Execution timed out |
2092 ms |
45620 KB |
Time limit exceeded |
12 |
Execution timed out |
2086 ms |
45480 KB |
Time limit exceeded |
13 |
Execution timed out |
2083 ms |
45404 KB |
Time limit exceeded |
14 |
Execution timed out |
2082 ms |
45632 KB |
Time limit exceeded |
15 |
Execution timed out |
2089 ms |
46188 KB |
Time limit exceeded |
16 |
Execution timed out |
2087 ms |
46172 KB |
Time limit exceeded |
17 |
Execution timed out |
2082 ms |
46140 KB |
Time limit exceeded |
18 |
Execution timed out |
2084 ms |
46164 KB |
Time limit exceeded |
19 |
Execution timed out |
2073 ms |
46240 KB |
Time limit exceeded |
20 |
Execution timed out |
2074 ms |
46152 KB |
Time limit exceeded |