# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
671444 | 2022-12-13T05:11:53 Z | dooompy | Easter Eggs (info1cup17_eastereggs) | C++17 | 20 ms | 2704 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; vector<int> adj[100005]; vector<int> straight; bool able(int idx) { vector<int> temp = straight; temp.resize(idx); return query(temp); } void dfs(int node, int par = -1) { straight.push_back(node); for (auto nxt : adj[node]) { if (nxt == par) continue; dfs(nxt, node); } } int findEgg (int N, vector < pair < int, int > > bridges) { straight.clear(); for (int i = 0; i <= N; i++) adj[i].clear(); for (int i = 0; i < bridges.size(); i++) { adj[bridges[i].first].push_back(bridges[i].second); adj[bridges[i].second].push_back(bridges[i].first); } dfs(1); int n = straight.size(); int lo = 1, hi = n; int ans = -1; while (lo <= hi) { int mid = (lo + hi) / 2; if (able(mid)) { hi = mid - 1; ans = straight[mid-1]; } else lo = mid + 1; } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 2 ms | 2640 KB | Number of queries: 5 |
2 | Partially correct | 2 ms | 2640 KB | Number of queries: 5 |
3 | Partially correct | 2 ms | 2640 KB | Number of queries: 5 |
4 | Partially correct | 2 ms | 2640 KB | Number of queries: 5 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2668 KB | Number of queries: 9 |
2 | Correct | 11 ms | 2692 KB | Number of queries: 9 |
3 | Correct | 16 ms | 2684 KB | Number of queries: 9 |
4 | Correct | 20 ms | 2692 KB | Number of queries: 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 14 ms | 2704 KB | Number of queries: 10 |
2 | Correct | 19 ms | 2692 KB | Number of queries: 9 |
3 | Partially correct | 16 ms | 2640 KB | Number of queries: 10 |
4 | Partially correct | 16 ms | 2684 KB | Number of queries: 10 |