# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
345995 | 2021-01-08T20:43:54 Z | ahmet | Easter Eggs (info1cup17_eastereggs) | C++14 | 15 ms | 364 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; #define ref(a,b,c) for(int (a)=(b);(a)<=(c);++(a)) #define rep(a,b) for(int (a)=0;(a)<(b);++(a)) #define ll long long #define pb push_back #define mp make_pair vector <int> v[550]; vector <int> euler; void dfs(int node,int par){ euler.pb(node); for(int i=0;i<v[node].size();++i){ int nxt=v[node][i]; if(nxt==par)continue; dfs(nxt,node); euler.pb(node); } return; } int findEgg (int N, vector < pair < int, int > > bridges) { ref(i,1,N)v[i].clear(); euler.clear(); for(int i=0;i<N-1;++i){ int x=bridges[i].first; int y=bridges[i].second; v[x].pb(y); v[y].pb(x); } dfs(1,0); int l=0,r=euler.size()-1; int vis[550]; vector <int> tmp; while(l<r){ tmp.clear(); memset(vis,0,sizeof(vis)); int mid=(l+r)/2; for(int i=l;i<=mid;++i){ if(vis[euler[i]]==0){tmp.pb(euler[i]);vis[euler[i]]=1;} } if(query(tmp))r=mid; else l=mid+1; } return euler[l]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 2 ms | 364 KB | Number of queries: 5 |
2 | Partially correct | 1 ms | 364 KB | Number of queries: 5 |
3 | Partially correct | 1 ms | 364 KB | Number of queries: 5 |
4 | Partially correct | 1 ms | 364 KB | Number of queries: 5 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 364 KB | Number of queries: 9 |
2 | Partially correct | 9 ms | 364 KB | Number of queries: 10 |
3 | Partially correct | 10 ms | 364 KB | Number of queries: 10 |
4 | Partially correct | 9 ms | 364 KB | Number of queries: 10 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 15 ms | 364 KB | Number of queries: 10 |
2 | Partially correct | 10 ms | 364 KB | Number of queries: 10 |
3 | Partially correct | 9 ms | 364 KB | Number of queries: 10 |
4 | Partially correct | 12 ms | 364 KB | Number of queries: 10 |