# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
484223 | Alexandruabcde | Easter Eggs (info1cup17_eastereggs) | C++14 | 20 ms | 468 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
constexpr int NMAX = 1000;
vector <int> G[NMAX];
vector <int> vec;
void Parcurgere_Euler (int Node, int Dad = -1) {
vec.push_back(Node);
for (auto it : G[Node]) {
if (it == Dad) continue;
Parcurgere_Euler(it, Node);
}
}
bool Check (int Right) {
vector <int> ask;
for (int i = 0; i <= Right; ++ i )
ask.push_back(vec[i]);
return query(ask);
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
vec.clear();
for (int i = 1; i <= N; ++ i )
G[i].clear();
for (int i = 0; i < bridges.size(); ++ i ) {
int x = bridges[i].first;
int y = bridges[i].second;
G[x].push_back(y);
G[y].push_back(x);
}
Parcurgere_Euler(1, -1);
int st = 0, dr = vec.size()-2;
int ans = vec.size()-1;
while (st <= dr) {
int mij = (st + dr) / 2;
if (Check(mij)) {
dr = mij - 1;
ans = mij;
}
else st = mij + 1;
}
return vec[ans];
}
컴파일 시 표준 에러 (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... |