# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
486348 | 2021-11-11T10:55:19 Z | NintsiChkhaidze | Easter Eggs (info1cup17_eastereggs) | C++14 | 18 ms | 492 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=n; r=mid - 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 | Runtime error | 1 ms | 456 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 456 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 18 ms | 492 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |