# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
243005 | 2020-06-30T07:18:24 Z | minhcool | Easter Eggs (info1cup17_eastereggs) | C++17 | 26 ms | 2960 KB |
#include<bits/stdc++.h> #include "grader.h" using namespace std; #define fi first #define se second #define pb push_back typedef pair<int, int> ii; typedef pair<ii, int> iii; typedef pair<ii, ii> iiii; vector<int> euler; vector<int> Adjlist[100005]; void dfs(int u, int p){ euler.pb(u); for(int i = 0; i < Adjlist[u].size(); i++){ int v = Adjlist[u][i]; if(v == p) continue; dfs(v, u); } } int findEgg(int N, vector<ii> bridges){ for(int i = 1; i <= N; i++) Adjlist[i].clear(); for(int i = 0; i < bridges.size(); i++){ Adjlist[bridges[i].fi].pb(bridges[i].se); Adjlist[bridges[i].se].pb(bridges[i].fi); } dfs(1, 1); int l = 0, r = N - 1; while(l != r){ int mid = (l + r) >> 1; vector<int> nodes; nodes.clear(); for(int i = 0; i <= mid; i++) nodes.pb(euler[i]); if(query(nodes)) r = mid; else l = mid + 1; } return euler[l]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 2688 KB | Number of queries: 4 |
2 | Correct | 7 ms | 2688 KB | Number of queries: 4 |
3 | Correct | 7 ms | 2688 KB | Number of queries: 4 |
4 | Correct | 6 ms | 2752 KB | Number of queries: 4 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 2816 KB | Number of queries: 8 |
2 | Correct | 20 ms | 2816 KB | Number of queries: 9 |
3 | Correct | 26 ms | 2960 KB | Number of queries: 9 |
4 | Correct | 24 ms | 2936 KB | Number of queries: 9 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 2928 KB | Number of queries: 9 |
2 | Correct | 23 ms | 2936 KB | Number of queries: 9 |
3 | Correct | 25 ms | 2940 KB | Number of queries: 9 |
4 | Correct | 24 ms | 2936 KB | Number of queries: 9 |