#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 to[MAXN], ans[2];
vector<int> adj[MAXN], verts[2];
void find_pair(int N, vector<int> U, vector<int> V, int A, int B) {
int M = sz(U), lo = 0, hi = M - 1, mid;
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;
}
fill(to, to + N, -1);
queue<pii> q;
q.emplace(U[lo], 0);
q.emplace(V[lo], 1);
to[U[lo]] = to[V[lo]] = -INT_INF;
while (!q.empty()) {
pii v = q.front();
q.pop();
verts[v.s].pb(v.f);
FORE(e, adj[v.f]) {
int w = v.f ^ U[e] ^ V[e];
if (to[w] != -1) continue;
q.emplace(w, v.s);
to[w] = e;
}
}
FOR(i, 2) {
lo = 1, hi = sz(verts[i]) - 1;
while (lo <= hi) {
mid = lo + (hi - lo) / 2;
fill(all(Q), 1);
For(j, 1, mid) Q[to[verts[i][j]]] = 0;
if (ask(Q) == DA) hi = mid - 1;
else lo = mid + 1;
}
ans[i] = verts[i][hi];
}
answer(ans[0], ans[1]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
2436 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
2572 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
42 ms |
3084 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
2568 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
51 ms |
3036 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
27 ms |
2992 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |