# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
759725 | jay_jayjay | Easter Eggs (info1cup17_eastereggs) | C++14 | 2 ms | 476 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// {{{1
extern "C" int __lsan_is_turned_off() { return 1; }
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <iostream>
#include <deque>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
#define infl 0x3f3f3f3f3f3f3f3f
#ifdef DEBUG
#define dprintf(args...) fprintf(stderr,args)
#include <assert.h>
#endif
#ifndef DEBUG
#define dprintf(args...) 69
#define assert(args...) 42
#endif
// 1}}}
// pain im still so stupid
int query(vector<int> islands);
int findEgg(int n, vector<pair<int,int>> edges) {
for(auto&[a,b]:edges)a--,b--;
vector<vector<int>> adj(n);
for(auto [a,b]:edges) adj[a].push_back(b),adj[b].push_back(a);
vector<int> po;
auto dfs = [&](auto& self, int u, int p=-1) -> void {
po.push_back(u);
for(auto v:adj[u])if(v!=p)self(self,v,u);
};
dfs(dfs,0,0);
vector<int> q;
int l=0,r=n-1;
while(l<r) {
int m=l+(r-l)/2;
//printf("%d %d %d\n",l,m,r);
q.clear();
for(int i=0;i<=m;i++)q.push_back(1+po[i]);
int x=query(q);
if(x) r=m;
else l=m+1;
}
return ++l;
}
#undef DEBUG
#ifdef DEBUG
int main()
{
}
#endif
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |