#include<bits/stdc++.h>
#include "grader.h"
using namespace std;
#ifndef d
#define d(...)
#endif
#define st first
#define nd second
#define pb push_back
#define siz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
typedef long long LL;
typedef long double LD;
constexpr int INF=1e9+7;
constexpr LL INFL=1e18;
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
return os << "(" << P.st << "," << P.nd << ")";
}
constexpr int maxn = 520;
int n;
vector<int> G[maxn];
bool vis[maxn];
vector<int> get_bfs_order() {
vector<int> ret;
ret.push_back(1);
vis[1] = true;
for(int i=0; i<siz(ret); i++) {
auto w = ret[i];
for(auto v:G[w])
if(not vis[v]) {
vis[v] = true;
ret.push_back(v);
}
}
return ret;
}
int findEgg(int _n, vector<pair<int, int>> edges) {
n = _n;
for(int i=1; i<=n; i++)
G[i].clear(), vis[i] = false;
for(auto& e:edges) {
G[e.st].push_back(e.nd);
G[e.nd].push_back(e.st);
}
auto&& v = get_bfs_order();
int l = 0, r = n-1;
while(l < r) {
auto s = (l+r) / 2;
if(query(vector<int>(v.begin(), v.begin() + s)))
r = s;
else
l = s + 1;
}
return v[l];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
512 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 |
3 ms |
512 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 |
3 ms |
576 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |