# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
723988 | stevancv | Easter Eggs (info1cup17_eastereggs) | C++14 | 23 ms | 368 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "grader.h"
#define ll long long
#define ld long double
#define sp ' '
#define en '\n'
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
using namespace std;
const int N = 600 + 2;
const int inf = 1e9;
vector<int> g[N], order;
void Dfs(int s, int e) {
order.push_back(s);
for (int u : g[s]) {
if (u != e) Dfs(u, s);
}
}
int findEgg(int n, vector<pair<int, int>> e) {
order.clear();
for (int i = 1; i <= n; i++) g[i].clear();
for (auto u : e) {
g[u.first].push_back(u.second);
g[u.second].push_back(u.first);
}
Dfs(1, 0);
int l = 0, r = n - 1;
while (l < r) {
int mid = l + r >> 1;
vector<int> t;
for (int i = 0; i <= mid; i++) t.push_back(order[i]);
if (query(t)) r = mid;
else l = mid + 1;
}
return order[r];
}
Compilation message (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... |