# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
242995 | 2020-06-30T07:13:00 Z | nnnnnnnnnnnnnnnn | Easter Eggs (info1cup17_eastereggs) | C++14 | 6 ms | 640 KB |
#include<bits/stdc++.h> #include "grader.h" using namespace std; typedef long long int ll; typedef vector<int> vi; typedef pair<int,int> ii; int n,cnt,mid; vector<vi> graph; vi node; vi no,yes; void dfs(int start,int pa) { int i,j; if(cnt==mid) return; node.push_back(start); if(no[start]==0) ++cnt; for(i=0;i<graph[start].size();++i) { j = graph[start][i]; if(j!=pa) { dfs(j,start); } } } int findEgg(int n,vector<ii> edge) { int i,j; graph.assign(n+1,vi()); no.assign(n+1,0); yes.assign(n+1,0); for(i=1;i<n;++i) { graph[edge[i].first].push_back(edge[i].second); graph[edge[i].second].push_back(edge[i].first); } int curr = n; while(curr!=1) { node.clear(); mid = curr/2; cnt = 0; dfs(1,-1); if(query(node)==false) { for(i=0;i<node.size();++i) { no[node[i]] = 1; } curr -= node.size(); } else { for(i=0;i<node.size();++i) { if(no[node[i]]==0) { yes[node[i]] = 1; } } curr = mid; } } for(i=1;i<=n;++i) { if(no[i]==0&&yes[i]==1) { return i; } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 640 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 640 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |