#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;
bool vis[MAXN];
vector<int> adj[MAXN];
void find_pair(int N, vector<int> U, vector<int> V, int A, int B) {
int M = sz(U);
FOR(i, M) {
adj[U[i]].pb(V[i]);
adj[V[i]].pb(U[i]);
}
vector<int> Q(M, 0);
ll DA = ask(Q);
int s;
vector<int> ans;
FOR(_, 2) {
vector<int> verts;
fill(vis, vis + N, false);
queue<int> q;
q.push(s);
vis[s] = 1;
while (!q.empty()) {
int v = q.front();
verts.pb(v);
q.pop();
FORE(w, adj[v]) {
if (vis[w]) continue;
vis[w] = 1;
q.push(w);
}
}
int lo = 0, hi = sz(verts) - 1, mid;
while (lo <= hi) {
mid = lo + (hi - lo) / 2;
FOR(i, mid) vis[verts[i]] = 0;
For(i, mid, N) vis[verts[i]] = 1;
FOR(i, M) Q[i] = vis[U[i]] ^ vis[V[i]];
if (ask(Q) == DA) hi = mid - 1;
else lo = mid + 1;
}
ans.pb(s = verts[hi]);
}
answer(ans[0], ans[1]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
7 ms |
4648 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
7 ms |
4792 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
19 ms |
5828 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
7 ms |
4876 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
24 ms |
5864 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
25 ms |
5840 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |