# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
756312 | anaduguleanu | Easter Eggs (info1cup17_eastereggs) | C++14 | 214 ms | 131072 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "grader.h"
#define MAX 512
using namespace std;
vector <int> graph[MAX + 10];
vector <int> nodes;
void dfs(int node, int parent)
{
nodes.push_back(node);
for (auto next : graph[node])
if (next != parent)
dfs(next, node);
}
int check(int pos)
{
vector <int> nodesQuery;
for (int i = 1; i <= pos; i++)
nodesQuery.push_back(nodes[i]);
return query(nodesQuery);
}
int findEgg (int N, vector <pair <int, int>> bridges)
{
for (auto it : bridges)
{
graph[it.first].push_back(it.second);
graph[it.second].push_back(it.first);
}
nodes.push_back(0);
dfs(1, -1);
int left = 1;
int right = nodes.size() - 1;
int ans;
while (left <= right)
{
int mid = (left + right) / 2;
if (check(mid) == 1)
{
right = mid - 1;
ans = mid;
}
else
left = mid + 1;
}
return nodes[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... |