# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
342587 | 2021-01-02T12:00:00 Z | ogibogi2004 | Easter Eggs (info1cup17_eastereggs) | C++14 | 25 ms | 492 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; const int MAXN=600; vector<int>g[MAXN]; vector<int>order; void dfs(int u,int p) { order.push_back(u); for(auto v:g[u]) { if(v==p)continue; dfs(v,u); } } int findEgg (int N, vector < pair < int, int > > bridges) { for(int i=1;i<=N;i++)g[i].clear(); order.clear(); for(int i=0;i<bridges.size();++i) { g[bridges[i].first].push_back(bridges[i].second); g[bridges[i].second].push_back(bridges[i].first); } dfs(1,0); int low=0,high=N-2,mid,ans=N-1; while(low<=high) { mid=(low+high)/2; vector<int>q; for(int i=0;i<=mid;++i)q.push_back(order[i]); if(query(q)) { ans=mid; high=mid-1; } else low=mid+1; } return order[ans]; if (query ({1})) return 1; return N; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Number of queries: 4 |
2 | Correct | 1 ms | 364 KB | Number of queries: 4 |
3 | Correct | 1 ms | 364 KB | Number of queries: 4 |
4 | Correct | 1 ms | 364 KB | Number of queries: 4 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 364 KB | Number of queries: 8 |
2 | Correct | 15 ms | 364 KB | Number of queries: 9 |
3 | Correct | 22 ms | 364 KB | Number of queries: 9 |
4 | Correct | 18 ms | 364 KB | Number of queries: 9 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 492 KB | Number of queries: 9 |
2 | Correct | 18 ms | 492 KB | Number of queries: 9 |
3 | Correct | 19 ms | 364 KB | Number of queries: 9 |
4 | Correct | 25 ms | 364 KB | Number of queries: 9 |