#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"
#define debugs(x) cerr << #x << " " << x << " "
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
const int NMAX = 100001;
const int VMAX = 101;
const int INF = 2e9;
const int MOD = 1000000007;
const int BLOCK = 447;
const int base = 117;
const int nr_of_bits = 24;
const int inv2 = 500000004;
set <pair <int, pair <int, int> > > events[NMAX];
set <int> st[NMAX];
int a[NMAX];
int n;
int cnt[NMAX][2];
void baga(int A, int B){
if(st[A].find(B) == st[A].end()){
st[A].insert(B);
cnt[A][a[B]]++;
}else{
st[A].erase(B);
cnt[A][a[B]]--;
}
}
void init(int N, int D, int H[]) {
n = N;
for(int i = 0; i < N; i++){
a[i] = H[i];
}
}
void curseChanges(int U, int A[], int B[]) {
for(int i = 0; i < U; i++){
baga(A[i], B[i]);
baga(B[i], A[i]);
events[A[i]].insert({i, {cnt[A[i]][0], cnt[A[i]][1]}});
events[B[i]].insert({i, {cnt[B[i]][0], cnt[B[i]][1]}});
}
}
int question(int x, int y, int v) {
pii ultimX = (*prev(events[x].upper_bound({v + 1, {-1, -1}}))).second;
pii ultimY = (*prev(events[y].upper_bound({v + 1, {-1, -1}}))).second;
if(ultimX.first + ultimX.second == 0 || ultimY.first + ultimY.second == 0)
return 1e9;
if(ultimX.first > 0 && ultimY.first > 0)
return 0;
if(ultimX.second > 0 && ultimY.second > 0)
return 0;
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
9680 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
12 ms |
19536 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
63 ms |
24340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
379 ms |
56648 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
20 ms |
19804 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
9680 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |