#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, {0, 0}}))).second;
pii ultimY = (*prev(events[y].upper_bound({v, {0, 0}}))).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 |
9728 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
13 ms |
19536 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
61 ms |
24244 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
369 ms |
56808 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
16 ms |
19792 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
9728 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |