# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
776214 | 2023-07-07T12:59:51 Z | rxlfd314 | Easter Eggs (info1cup17_eastereggs) | C++17 | 16 ms | 376 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; int findEgg(int N, vector<pair<int, int>> B) { vector<int> adj[N]; for (auto &[a, b] : B) { adj[--a].push_back(--b); adj[b].push_back(a); } int rtin[N], timer = 0; function<void(int, int)> dfs = [&](int f, int pf) { rtin[timer++] = f; for (int nf : adj[f]) { if (nf != pf) { dfs(nf, f); } } }; dfs(0, 0); int lo = 0, hi = N-1; while (lo < hi) { int mid = lo + hi >> 1; vector<int> vec; for (int i = 0; i <= mid; i++) { vec.push_back(rtin[i]+1); } query(vec) ? hi = mid : lo = mid + 1; } return rtin[lo] + 1; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Number of queries: 4 |
2 | Correct | 1 ms | 208 KB | Number of queries: 4 |
3 | Correct | 1 ms | 208 KB | Number of queries: 4 |
4 | Correct | 1 ms | 208 KB | Number of queries: 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 332 KB | Number of queries: 8 |
2 | Correct | 11 ms | 336 KB | Number of queries: 9 |
3 | Correct | 15 ms | 352 KB | Number of queries: 9 |
4 | Correct | 14 ms | 360 KB | Number of queries: 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 376 KB | Number of queries: 9 |
2 | Correct | 11 ms | 352 KB | Number of queries: 9 |
3 | Correct | 14 ms | 348 KB | Number of queries: 9 |
4 | Correct | 14 ms | 340 KB | Number of queries: 9 |