#include "highway.h"
#include<bits/stdc++.h>
#define vi vector<int>
#define vb vector<bool>
#define vpii vector<pair<int,int>>
#define pb push_back
#define vvi vector<vector<int>>
#define ll long long int
#define f0r(i,n) for(int i = 0; i<n; i++)
#define vout(v) for(auto u : v)cout<<u<<' '; cout<<'\n';
using namespace std;
void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
int m = U.size();
ll ret;
vi w(m,0);
ret = ask(w);
ll base = ret;
ll len = ret/A;
vi dep(N);
dep[0] = 0;
queue<int>q;
q.push(0);
vb vis(N);
vis[0] = 1;
vpii adj[N];
f0r(i, m){
adj[U[i]].pb({V[i], i});
adj[V[i]].pb({U[i], i});
}
vi par(N, -1);
while(!q.empty()){
int cur = q.front();
q.pop();
for(auto u : adj[cur]){
if(vis[u.first])continue;
par[u.first] = u.second;
vis[u.first] = 1;
dep[u.first] = dep[cur] + 1;
q.push(u.first);
}
}
//vout(par);
vi poss;
f0r(i, N){
if(dep[i] == len)poss.pb(i);
}
//vout(poss);
int l = 0;
int r = poss.size() - 1;
while(l < r){
vi w(m, 0);
int mid = (l + r)/2;
//set l to mid
for(int i = l; i<=mid; i++){
w[par[poss[i]]] = 1;
}
ret = ask(w);
if(ret > base){
r = mid;
}
else{
l = mid + 1;
}
}
answer(0, poss[l]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
11 ms |
1280 KB |
Output is correct |
3 |
Correct |
92 ms |
8884 KB |
Output is correct |
4 |
Correct |
83 ms |
8868 KB |
Output is correct |
5 |
Correct |
96 ms |
8820 KB |
Output is correct |
6 |
Correct |
77 ms |
8800 KB |
Output is correct |
7 |
Correct |
97 ms |
8800 KB |
Output is correct |
8 |
Correct |
72 ms |
8808 KB |
Output is correct |
9 |
Correct |
81 ms |
8704 KB |
Output is correct |
10 |
Correct |
96 ms |
8776 KB |
Output is correct |
11 |
Correct |
77 ms |
8032 KB |
Output is correct |
12 |
Correct |
77 ms |
8168 KB |
Output is correct |
13 |
Correct |
81 ms |
8080 KB |
Output is correct |
14 |
Correct |
78 ms |
8044 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
1104 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
336 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
1360 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
1420 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |