# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
521987 | iskhakkutbilim | Easter Eggs (info1cup17_eastereggs) | C++14 | 2 ms | 456 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
int findEgg (int N, vector < pair < int, int > > bridges)
{
vector<int> g[N+1];
vector<int> used(N +1, 0);
vector<int> island;
queue<int> q;
queue<int> jp;
for(int i = 0;i < N-1; i++){
int a = bridges[i].first;
int b = bridges[i].second;
g[a].push_back(b);
g[b].push_back(a);
}
int ans = 1;
q.push(1);
used[1] = 1;
island.push_back(1);
jp.push(1);
while(!q.empty()){
int v = q.front();
q.pop();
for(auto to : g[v]){
if(used[to] == 0){
used[to] = 1;
q.push(to);
island.push_back(to);
jp.push(to);
}
if(jp.size() >= N / 2){
if(query(island) == 1){
while(!jp.empty()){
if(query({jp.front()}) == 1){
return jp.front();
}
jp.pop();
}
}
while(!jp.empty()){
jp.pop();
}
// cout << "\n" << "------" << "\n";
}
}
}
while(!jp.empty()){
if(query({jp.front()}) == 1){
return jp.front();
}
jp.pop();
}
for(auto x : island){
if(query({x})){
return x;
}
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |