#include "highway.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define f first
#define s second
#define all(a) (a).begin(),(a).end()
#define For(i,a,b) for(auto i=(a);i<(b);i++)
#define FOR(i,b) For(i,0,b)
#define Rev(i,a,b) for(auto i=(a);i>(b);i--)
#define REV(i,a) Rev(i,a,-1)
#define FORE(i,a) for(auto&&i:a)
#define sz(a) (int((a).size()))
#define MIN(a,b) ((a)=min((a),(b)))
#define MAX(a,b) ((a)=max((a),(b)))
using ll=long long;using ld=long double;using uint=unsigned int;using ull=unsigned long long;
using pii=pair<int,int>;using pll=pair<ll,ll>;using pill=pair<int,ll>;using plli=pair<ll,int>;using pdd=pair<double,double>;using pld=pair<ld,ld>;
constexpr const char nl='\n',sp=' ';constexpr const int INT_INF=0x3f3f3f3f;constexpr const ll LL_INF=0x3f3f3f3f3f3f3f3f;
constexpr const double D_INF=numeric_limits<double>::infinity();constexpr const ld LD_INF=numeric_limits<ld>::infinity();constexpr const double EPS=1e-9;
const int MAXN = 90005;
int q[MAXN], to[MAXN];
vector<int> adj[MAXN];
void find_pair(int N, vector<int> U, vector<int> V, int A, int B) {
int M = sz(U), front, back, s = 0, lo = 0, hi = M - 1, mid, v;
FOR(i, M) {
adj[U[i]].pb(i);
adj[V[i]].pb(i);
}
vector<int> Q(M, 0);
ll DA = ask(Q);
while (lo <= hi) {
mid = lo + (hi - lo) / 2;
FOR(i, M) Q[i] = i > mid;
if (ask(Q) == DA) lo = mid + 1;
else hi = mid - 1;
}
s = U[hi];
vector<int> ans;
FOR(_, 2) {
front = 0, back = 0, lo = 1, hi = N - 1;
fill(to, to + N, -1);
to[q[back++] = s] = -INT_INF;
while (front < back) FORE(e, adj[v = q[front++]]) if (to[v ^ U[e] ^ V[e]] == -1) to[q[back++] = v ^ U[e] ^ V[e]] = e;
while (lo <= hi) {
mid = lo + (hi - lo) / 2;
fill(all(Q), 0);
For(i, mid, N) Q[to[q[i]]] = 1;
if (ask(Q) == DA) hi = mid - 1;
else lo = mid + 1;
}
ans.pb(s = q[hi]);
}
answer(ans[0], ans[1]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
2440 KB |
Output is correct |
2 |
Correct |
4 ms |
2444 KB |
Output is correct |
3 |
Correct |
4 ms |
2424 KB |
Output is correct |
4 |
Correct |
4 ms |
2424 KB |
Output is correct |
5 |
Correct |
4 ms |
2440 KB |
Output is correct |
6 |
Correct |
4 ms |
2532 KB |
Output is correct |
7 |
Correct |
4 ms |
2344 KB |
Output is correct |
8 |
Correct |
4 ms |
2424 KB |
Output is correct |
9 |
Correct |
4 ms |
2344 KB |
Output is correct |
10 |
Correct |
4 ms |
2424 KB |
Output is correct |
11 |
Correct |
4 ms |
2424 KB |
Output is correct |
12 |
Correct |
4 ms |
2428 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
2424 KB |
Output is correct |
2 |
Correct |
22 ms |
3020 KB |
Output is correct |
3 |
Correct |
266 ms |
7844 KB |
Output is correct |
4 |
Correct |
239 ms |
7848 KB |
Output is correct |
5 |
Correct |
268 ms |
7840 KB |
Output is correct |
6 |
Correct |
202 ms |
7876 KB |
Output is correct |
7 |
Correct |
263 ms |
7848 KB |
Output is correct |
8 |
Correct |
280 ms |
7856 KB |
Output is correct |
9 |
Correct |
278 ms |
7852 KB |
Output is correct |
10 |
Correct |
225 ms |
7912 KB |
Output is correct |
11 |
Correct |
281 ms |
7740 KB |
Output is correct |
12 |
Correct |
283 ms |
7800 KB |
Output is correct |
13 |
Correct |
287 ms |
7840 KB |
Output is correct |
14 |
Correct |
260 ms |
7740 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
2988 KB |
Output is correct |
2 |
Correct |
40 ms |
3616 KB |
Output is correct |
3 |
Correct |
55 ms |
4204 KB |
Output is correct |
4 |
Correct |
162 ms |
7740 KB |
Output is correct |
5 |
Correct |
178 ms |
7752 KB |
Output is correct |
6 |
Correct |
167 ms |
7776 KB |
Output is correct |
7 |
Correct |
176 ms |
7728 KB |
Output is correct |
8 |
Correct |
165 ms |
7856 KB |
Output is correct |
9 |
Correct |
187 ms |
7748 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
2424 KB |
Output is correct |
2 |
Correct |
22 ms |
2968 KB |
Output is correct |
3 |
Correct |
257 ms |
6672 KB |
Output is correct |
4 |
Correct |
266 ms |
7856 KB |
Output is correct |
5 |
Correct |
253 ms |
7832 KB |
Output is correct |
6 |
Correct |
261 ms |
7840 KB |
Output is correct |
7 |
Correct |
228 ms |
7836 KB |
Output is correct |
8 |
Correct |
247 ms |
7836 KB |
Output is correct |
9 |
Correct |
230 ms |
7852 KB |
Output is correct |
10 |
Correct |
272 ms |
7884 KB |
Output is correct |
11 |
Correct |
272 ms |
7800 KB |
Output is correct |
12 |
Correct |
269 ms |
7828 KB |
Output is correct |
13 |
Correct |
256 ms |
7740 KB |
Output is correct |
14 |
Correct |
300 ms |
7740 KB |
Output is correct |
15 |
Correct |
264 ms |
7836 KB |
Output is correct |
16 |
Correct |
226 ms |
7888 KB |
Output is correct |
17 |
Correct |
245 ms |
7736 KB |
Output is correct |
18 |
Correct |
260 ms |
7744 KB |
Output is correct |
19 |
Correct |
239 ms |
7840 KB |
Output is correct |
20 |
Correct |
258 ms |
7744 KB |
Output is correct |
21 |
Correct |
208 ms |
8204 KB |
Output is correct |
22 |
Correct |
197 ms |
8096 KB |
Output is correct |
23 |
Correct |
184 ms |
8180 KB |
Output is correct |
24 |
Correct |
207 ms |
8068 KB |
Output is correct |
25 |
Correct |
226 ms |
7796 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
3012 KB |
Output is correct |
2 |
Correct |
31 ms |
3032 KB |
Output is correct |
3 |
Correct |
276 ms |
8096 KB |
Output is correct |
4 |
Correct |
314 ms |
8300 KB |
Output is correct |
5 |
Incorrect |
355 ms |
8892 KB |
Output is incorrect: {s, t} is wrong. |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
2984 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |