# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
773766 | khshg | Easter Eggs (info1cup17_eastereggs) | C++14 | 1 ms | 464 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "grader.h"
#include<bits/stdc++.h>
using namespace std;
int findEgg(int N, vector<pair<int, int>> bridges) {
vector<vector<int>> adj(N);
for(auto& u : bridges) {
--u.first; --u.second;
adj[u.first].push_back(u.second);
adj[u.second].push_back(u.first);
}
vector<bool> good(N, 1);
int sum = N;
while(sum > 1) {
vector<int> ask;
vector<pair<int, int>> q;
int goal = sum / 2;
q.push_back({0, -1});
while(true) {
pair<int, int> s = q.back(); q.pop_back();
ask.push_back(s.first);
goal -= good[s.first];
if(goal == 0) break;
for(int& u : adj[s.first]) {
if(u != s.second) {
q.push_back({u, s.first});
}
}
}
bool f = query(ask);
vector<bool> ch(N);
for(auto& u : ask) ch[u] = 1;
sum = 0;
for(int i = 0; i < N; ++i) {
if(good[i]) good[i] = (f ? ch[i] : !ch[i]);
sum += good[i];
}
}
for(int i = 0; i < N; ++i) if(good[i]) return i + 1;
}
컴파일 시 표준 에러 (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... |