# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
486350 | 2021-11-11T10:56:20 Z | NintsiChkhaidze | Easter Eggs (info1cup17_eastereggs) | C++14 | 18 ms | 448 KB |
#include <bits/stdc++.h> #include "grader.h" #define pb push_back using namespace std; vector <int> v[525]; int in[525],cnt; void dfs(int x,int par){ in[++cnt] = x; for (int j=0;j<v[x].size();j++){ int to = v[x][j]; if (to == par) continue; dfs(to,x); } } int findEgg (int n, vector < pair < int, int > > vec){ for (int i=0;i<vec.size();i++){ int a = vec[i].first,b = vec[i].second; v[a].pb(b),v[b].pb(a); } cnt=0; dfs(1,1); int l = 1,r = n,ANS=0; while(l <= r){ int mid = (l+r)>>1; if (mid == n){ ANS = in[n]; r = n - 1; continue; } vector <int> q; q.clear(); for (int i = 1; i <= mid; i++) q.pb(in[i]); bool check = query(q); if (check) { ANS = in[mid]; r = mid - 1; } else l = mid + 1; } for (int i=1;i<=n;i++) v[i].clear(),in[i]=0; return ANS; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 200 KB | Number of queries: 4 |
2 | Correct | 2 ms | 200 KB | Number of queries: 4 |
3 | Correct | 2 ms | 200 KB | Number of queries: 4 |
4 | Correct | 2 ms | 200 KB | Number of queries: 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 340 KB | Number of queries: 8 |
2 | Correct | 16 ms | 328 KB | Number of queries: 9 |
3 | Correct | 16 ms | 344 KB | Number of queries: 9 |
4 | Correct | 16 ms | 328 KB | Number of queries: 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 356 KB | Number of queries: 9 |
2 | Correct | 18 ms | 448 KB | Number of queries: 9 |
3 | Correct | 17 ms | 344 KB | Number of queries: 9 |
4 | Correct | 17 ms | 340 KB | Number of queries: 9 |