# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
67646 | 2018-08-15T07:35:45 Z | tatatan | Easter Eggs (info1cup17_eastereggs) | C++11 | 48 ms | 624 KB |
#include <bits/stdc++.h> #include "grader.h" #define mp make_pair #define pb push_back #define pii pair<int,int> #define LL long long #define st first #define nd second #define endl '\n' using namespace std; vector<int> v[513]; int cnt,used[513],in[513]; void dfs(int x,int y,int en,vector<int> &add) { if(cnt==en) return; add.pb(x); in[x]=1; if(!used[x]) ++cnt; for(int i=0;i<v[x].size();++i) if(v[x][i]!=y) dfs(v[x][i],x,en,add); } int findEgg (int n, vector < pair < int, int > > br) { memset(used,0,sizeof used); for(int i=1;i<=n;++i) v[i].clear(); for(int i=0;i<n-1;++i) { v[br[i].st].pb(br[i].nd); v[br[i].nd].pb(br[i].st); } int left=n; while(left!=1) { vector<int> add; cnt=0; memset(in,0,sizeof in); dfs(1,0,left/2,add); /*cout<<left<<endl; for(int i=0;i<add.size();++i) cout<<add[i]<<" "; cout<<endl;*/ if(query(add)) { left=left/2; for(int i=1;i<=n;++i) if(!in[i]) used[i]=1; } else { for(int i=0;i<add.size();++i) used[add[i]]=1; left-=left/2; } } for(int i=1;i<=n;++i) if(!used[i]) return i; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Number of queries: 4 |
2 | Correct | 4 ms | 436 KB | Number of queries: 4 |
3 | Correct | 4 ms | 488 KB | Number of queries: 4 |
4 | Correct | 4 ms | 556 KB | Number of queries: 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 556 KB | Number of queries: 8 |
2 | Correct | 24 ms | 556 KB | Number of queries: 9 |
3 | Correct | 30 ms | 556 KB | Number of queries: 9 |
4 | Correct | 35 ms | 596 KB | Number of queries: 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 596 KB | Number of queries: 9 |
2 | Correct | 32 ms | 596 KB | Number of queries: 9 |
3 | Correct | 38 ms | 624 KB | Number of queries: 9 |
4 | Correct | 30 ms | 624 KB | Number of queries: 9 |