# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
640166 | 2022-09-13T18:55:04 Z | tvladm2009 | Easter Eggs (info1cup17_eastereggs) | C++14 | 15 ms | 360 KB |
#include <bits/stdc++.h> #include "grader.h" using ll = long long; const int MAX_N = 512; std::vector<int> g[MAX_N + 1], v; void dfs(int u, int p = -1) { v.push_back(u); for (int v : g[u]) { if (v != p) { dfs(v, u); } } } int bsearch() { int l = 0, r = v.size() - 1, sol = -1; while (r - l > 0) { int mid = (l + r) / 2; std::vector<int> tmp; for (int i = 0; i <= mid; i++) { tmp.push_back(v[i]); } if (query(tmp)) { r = mid; sol = mid; } else { l = mid + 1; } } return v[l]; } int findEgg(int n, std::vector<std::pair<int, int>> bridges) { for (int i = 1; i <= n; i++) { g[i].clear(); } for (auto it : bridges) { g[it.first].push_back(it.second); g[it.second].push_back(it.first); } v.clear(); dfs(1); int answer = bsearch(); return answer; }
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 | 4 ms | 340 KB | Number of queries: 8 |
2 | Correct | 11 ms | 352 KB | Number of queries: 9 |
3 | Correct | 14 ms | 344 KB | Number of queries: 9 |
4 | Correct | 15 ms | 344 KB | Number of queries: 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 356 KB | Number of queries: 9 |
2 | Correct | 15 ms | 348 KB | Number of queries: 9 |
3 | Correct | 14 ms | 348 KB | Number of queries: 9 |
4 | Correct | 15 ms | 360 KB | Number of queries: 9 |