# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
389824 | 2021-04-14T15:03:44 Z | rk42745417 | Easter Eggs (info1cup17_eastereggs) | C++17 | 29 ms | 460 KB |
#include <bits/stdc++.h> #include "grader.h" //#include "grader.cpp" using namespace std; #define EMT ios::sync_with_stdio(0); cin.tie(0); using ll = int64_t; using ull = uint64_t; using uint = uint32_t; using ld = long double; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; const ll LINF = 1e18; const double EPS = 1e-9; vector<vector<int>> edge; vector<bool> can; vector<bool> is; int w; vector<int> que; void init(int n) { edge.clear(); edge.resize(n + 1); can.clear(); can.resize(n + 1, 1); is.clear(); is.resize(n + 1); que.clear(); } void dfs(int u, int p) { if(!w) return; que.push_back(u); is[u] = 1; if(can[u]) w--; for(int v : edge[u]) if(v != p) dfs(v, u); } int findEgg(int n, vector<pair<int, int>> edges) { init(n); for(const auto &[a, b] : edges) edge[a].push_back(b), edge[b].push_back(a); int has = n; while(has > 1) { int c = has / 2; w = has / 2; int x = 0; dfs(1, 1); if(!query(que)) { for(int a : que) can[a] = 0; has -= c; } else { has = c; for(int i = 1; i <= n; i++) if(!is[i]) can[i] = 0; } for(int a : que) is[a] = 0; que.clear(); } for(int i = 1; i <= n; i++) if(can[i]) return i; assert(0); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 200 KB | Number of queries: 4 |
2 | Correct | 1 ms | 200 KB | Number of queries: 4 |
3 | Correct | 1 ms | 200 KB | Number of queries: 4 |
4 | Correct | 1 ms | 200 KB | Number of queries: 4 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 332 KB | Number of queries: 8 |
2 | Correct | 17 ms | 336 KB | Number of queries: 9 |
3 | Correct | 29 ms | 236 KB | Number of queries: 9 |
4 | Correct | 23 ms | 340 KB | Number of queries: 9 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 352 KB | Number of queries: 9 |
2 | Correct | 22 ms | 460 KB | Number of queries: 9 |
3 | Correct | 29 ms | 340 KB | Number of queries: 9 |
4 | Correct | 25 ms | 328 KB | Number of queries: 9 |