#include<bits/stdc++.h>
using namespace std;
const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
// #define int long long
#define ll long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
const int maxn = 2e5+10;
int n, a[maxn], idord[maxn];
vector<pair<int,int>> ord;
vector<pair<int,int>> g[maxn];
void init(int N, int D, int H[]) {
n = N;
for(int i = 0; i < n; i++) {
ord.pb(mp(H[i],i));
}
sort(all(ord));
for(int i = 0; i < n; i++) {
idord[i] = i;
a[i] = H[i];
}
}
set<int> st[maxn];
void curseChanges(int U, int A[], int B[]) {
for(int i = 0; i < U; i++) {
int u = idord[A[i]];
int v = idord[B[i]];
g[u].pb(mp(i+1,v));
g[v].pb(mp(i+1,u));
}
for(int i = 0; i < n; i++) {
for(auto X : g[i]) {
int j = X.sc;
if(st[i].count(j)) st[i].erase(j);
else st[i].insert(j);
}
}
}
int question(int x, int y, int v) {
x = idord[x];
y = idord[y];
if(st[x].size() == 0) return 1000000000;
if(st[y].size() == 0) return 1000000000;
int ans = inf1;
for(auto i : st[x]) {
for(auto j : st[x]) {
ans = min(ans, abs(a[i]-a[j]));
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
14416 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
14480 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
171 ms |
42684 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
155 ms |
42724 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
15916 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
14416 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |