#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, MAXM = 130005;
int q[MAXN], to[MAXN];
bool good[MAXM];
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;
}
s = U[lo];
vector<int> ans;
fill(good, good + M, 1);
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 (good[e] && to[v ^ U[e] ^ V[e]] == -1) good[to[q[back++] = v ^ U[e] ^ V[e]] = e] = 0;
while (lo <= hi) {
mid = lo + (hi - lo) / 2;
fill(all(Q), 1);
For(i, 1, mid) Q[to[q[i]]] = 0;
if (ask(Q) == DA) hi = mid - 1;
else lo = mid + 1;
}
FOR(i, M) good[i] ^= 1;
ans.pb(s = q[hi]);
}
answer(ans[0], ans[1]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
2440 KB |
Output is correct |
2 |
Correct |
4 ms |
2440 KB |
Output is correct |
3 |
Correct |
4 ms |
2440 KB |
Output is correct |
4 |
Correct |
4 ms |
2428 KB |
Output is correct |
5 |
Correct |
4 ms |
2524 KB |
Output is correct |
6 |
Correct |
4 ms |
2424 KB |
Output is correct |
7 |
Correct |
4 ms |
2424 KB |
Output is correct |
8 |
Correct |
4 ms |
2424 KB |
Output is correct |
9 |
Correct |
4 ms |
2444 KB |
Output is correct |
10 |
Correct |
4 ms |
2424 KB |
Output is correct |
11 |
Correct |
4 ms |
2444 KB |
Output is correct |
12 |
Correct |
4 ms |
2424 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
2424 KB |
Output is correct |
2 |
Correct |
25 ms |
2964 KB |
Output is correct |
3 |
Correct |
257 ms |
8036 KB |
Output is correct |
4 |
Correct |
270 ms |
7940 KB |
Output is correct |
5 |
Correct |
262 ms |
7936 KB |
Output is correct |
6 |
Correct |
276 ms |
7928 KB |
Output is correct |
7 |
Correct |
251 ms |
7984 KB |
Output is correct |
8 |
Correct |
212 ms |
7952 KB |
Output is correct |
9 |
Correct |
257 ms |
7924 KB |
Output is correct |
10 |
Correct |
274 ms |
7976 KB |
Output is correct |
11 |
Correct |
232 ms |
7892 KB |
Output is correct |
12 |
Correct |
288 ms |
7924 KB |
Output is correct |
13 |
Correct |
240 ms |
7932 KB |
Output is correct |
14 |
Correct |
278 ms |
7916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
3020 KB |
Output is correct |
2 |
Correct |
41 ms |
3648 KB |
Output is correct |
3 |
Correct |
61 ms |
4248 KB |
Output is correct |
4 |
Correct |
165 ms |
7940 KB |
Output is correct |
5 |
Correct |
179 ms |
7844 KB |
Output is correct |
6 |
Correct |
180 ms |
7840 KB |
Output is correct |
7 |
Correct |
181 ms |
7840 KB |
Output is correct |
8 |
Correct |
219 ms |
7900 KB |
Output is correct |
9 |
Correct |
162 ms |
7824 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
2424 KB |
Output is correct |
2 |
Correct |
26 ms |
2936 KB |
Output is correct |
3 |
Correct |
171 ms |
6728 KB |
Output is correct |
4 |
Correct |
227 ms |
7944 KB |
Output is correct |
5 |
Correct |
213 ms |
8036 KB |
Output is correct |
6 |
Correct |
182 ms |
7932 KB |
Output is correct |
7 |
Correct |
217 ms |
7944 KB |
Output is correct |
8 |
Correct |
214 ms |
8040 KB |
Output is correct |
9 |
Correct |
261 ms |
7936 KB |
Output is correct |
10 |
Correct |
251 ms |
8040 KB |
Output is correct |
11 |
Correct |
261 ms |
7992 KB |
Output is correct |
12 |
Correct |
287 ms |
7832 KB |
Output is correct |
13 |
Correct |
273 ms |
7848 KB |
Output is correct |
14 |
Correct |
283 ms |
7828 KB |
Output is correct |
15 |
Correct |
204 ms |
7932 KB |
Output is correct |
16 |
Correct |
192 ms |
7936 KB |
Output is correct |
17 |
Correct |
283 ms |
7828 KB |
Output is correct |
18 |
Correct |
284 ms |
7860 KB |
Output is correct |
19 |
Correct |
196 ms |
8044 KB |
Output is correct |
20 |
Correct |
216 ms |
7856 KB |
Output is correct |
21 |
Correct |
230 ms |
8184 KB |
Output is correct |
22 |
Correct |
217 ms |
8272 KB |
Output is correct |
23 |
Correct |
240 ms |
8188 KB |
Output is correct |
24 |
Correct |
237 ms |
8152 KB |
Output is correct |
25 |
Correct |
297 ms |
7876 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
2980 KB |
Output is correct |
2 |
Correct |
36 ms |
3004 KB |
Output is correct |
3 |
Correct |
263 ms |
8160 KB |
Output is correct |
4 |
Correct |
278 ms |
8404 KB |
Output is correct |
5 |
Correct |
300 ms |
8924 KB |
Output is correct |
6 |
Correct |
301 ms |
8944 KB |
Output is correct |
7 |
Correct |
328 ms |
8944 KB |
Output is correct |
8 |
Correct |
342 ms |
8948 KB |
Output is correct |
9 |
Correct |
250 ms |
7128 KB |
Output is correct |
10 |
Correct |
236 ms |
7400 KB |
Output is correct |
11 |
Correct |
260 ms |
7376 KB |
Output is correct |
12 |
Correct |
301 ms |
8476 KB |
Output is correct |
13 |
Correct |
304 ms |
8808 KB |
Output is correct |
14 |
Correct |
304 ms |
8804 KB |
Output is correct |
15 |
Correct |
311 ms |
8808 KB |
Output is correct |
16 |
Correct |
279 ms |
7752 KB |
Output is correct |
17 |
Correct |
247 ms |
8316 KB |
Output is correct |
18 |
Correct |
231 ms |
8436 KB |
Output is correct |
19 |
Correct |
245 ms |
8388 KB |
Output is correct |
20 |
Correct |
228 ms |
8384 KB |
Output is correct |
21 |
Correct |
320 ms |
9004 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
2984 KB |
Output is correct |
2 |
Correct |
32 ms |
3036 KB |
Output is correct |
3 |
Partially correct |
274 ms |
8184 KB |
Output is partially correct |
4 |
Correct |
245 ms |
8300 KB |
Output is correct |
5 |
Partially correct |
276 ms |
8404 KB |
Output is partially correct |
6 |
Correct |
303 ms |
8936 KB |
Output is correct |
7 |
Partially correct |
244 ms |
8200 KB |
Output is partially correct |
8 |
Partially correct |
246 ms |
8292 KB |
Output is partially correct |
9 |
Partially correct |
306 ms |
8432 KB |
Output is partially correct |
10 |
Partially correct |
295 ms |
8928 KB |
Output is partially correct |
11 |
Partially correct |
300 ms |
9048 KB |
Output is partially correct |
12 |
Partially correct |
291 ms |
9032 KB |
Output is partially correct |
13 |
Correct |
251 ms |
7376 KB |
Output is correct |
14 |
Correct |
250 ms |
7348 KB |
Output is correct |
15 |
Correct |
253 ms |
7388 KB |
Output is correct |
16 |
Correct |
248 ms |
7392 KB |
Output is correct |
17 |
Correct |
276 ms |
7368 KB |
Output is correct |
18 |
Correct |
261 ms |
7444 KB |
Output is correct |
19 |
Correct |
283 ms |
8440 KB |
Output is correct |
20 |
Partially correct |
301 ms |
8608 KB |
Output is partially correct |
21 |
Partially correct |
343 ms |
8812 KB |
Output is partially correct |
22 |
Partially correct |
283 ms |
8808 KB |
Output is partially correct |
23 |
Partially correct |
312 ms |
8784 KB |
Output is partially correct |
24 |
Partially correct |
327 ms |
8876 KB |
Output is partially correct |
25 |
Partially correct |
268 ms |
9000 KB |
Output is partially correct |
26 |
Partially correct |
309 ms |
8788 KB |
Output is partially correct |
27 |
Partially correct |
243 ms |
8348 KB |
Output is partially correct |
28 |
Partially correct |
226 ms |
8368 KB |
Output is partially correct |
29 |
Partially correct |
222 ms |
8528 KB |
Output is partially correct |
30 |
Correct |
268 ms |
8328 KB |
Output is correct |
31 |
Correct |
254 ms |
8356 KB |
Output is correct |
32 |
Partially correct |
248 ms |
8408 KB |
Output is partially correct |
33 |
Partially correct |
242 ms |
8428 KB |
Output is partially correct |
34 |
Correct |
243 ms |
8412 KB |
Output is correct |
35 |
Partially correct |
221 ms |
8356 KB |
Output is partially correct |
36 |
Partially correct |
225 ms |
8216 KB |
Output is partially correct |
37 |
Partially correct |
235 ms |
8496 KB |
Output is partially correct |
38 |
Partially correct |
270 ms |
8436 KB |
Output is partially correct |
39 |
Partially correct |
324 ms |
8880 KB |
Output is partially correct |
40 |
Partially correct |
329 ms |
8952 KB |
Output is partially correct |
41 |
Correct |
352 ms |
8904 KB |
Output is correct |
42 |
Partially correct |
322 ms |
8972 KB |
Output is partially correct |