# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
243008 | 2020-06-30T07:21:55 Z | Exile_2k4 | Easter Eggs (info1cup17_eastereggs) | C++17 | 400 ms | 384 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; const int sz = 600; #define pii pair<int,int> vector<int> g[sz], call; bool exist[sz], nxt[sz]; void dfs(int p,int u, int need){ if(exist[u] && call.size()<need) call.push_back(u); for(auto v:g[u]) if(v!=p && exist[v]) dfs(u,v,need); } int findEgg(int N, vector<pii> bridges){ for(int i=0;i<N-1;++i){ g[bridges[i].first].push_back(bridges[i].second); g[bridges[i].second].push_back(bridges[i].first); } memset(exist,1,sizeof(exist)); int cnt = N; while(cnt!=1){ int mid = cnt/2; call.clear(); for(int i=1;i<=N;++i) if(exist[i]){ dfs(i,i,mid); break; } memset(nxt,0,sizeof(nxt)); if(query(call)){ for(auto v:call) nxt[v] = 1; for(int i=1;i<=N;++i) exist[i] = nxt[i]; cnt = call.size(); }else{ for(auto v:call) exist[v] = 0; cnt -= call.size(); } } for(int i=1;i<=N;++i) if(exist[i]) return i; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3073 ms | 384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3063 ms | 384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3075 ms | 384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |