# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
918354 | 2024-01-29T17:25:29 Z | Ferid20072020 | Easter Eggs (info1cup17_eastereggs) | C++14 | 28 ms | 6188 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; const int up = 2e5 + 5; vector<int> g[up]; vector<int> List; void DFS(int node , int from){ List.push_back(node); for(auto to : g[node]){ if(to != from){ DFS(to , node); } } } int findEgg (int N, vector < pair < int, int > > bridges) { List.clear(); int i; for(i=0 ; i<up ; i++){ g[i].clear(); } for(i=0 ; i<bridges.size() ; i++){ g[bridges[i].first].push_back(bridges[i].second); g[bridges[i].second].push_back(bridges[i].first); } DFS(1 , 0); int l = 0 , r = N - 1 , mid; vector<int> c; while(l < r){ mid = (l + r) / 2; for(i=0 ; i<=mid ; i++){ c.push_back(List[i]); } if(query(c) == 1){ r = mid; } else{ l = mid + 1; } c.clear(); } return List[l]; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4952 KB | Number of queries: 4 |
2 | Correct | 8 ms | 5108 KB | Number of queries: 4 |
3 | Correct | 7 ms | 4952 KB | Number of queries: 4 |
4 | Correct | 6 ms | 4952 KB | Number of queries: 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 5412 KB | Number of queries: 8 |
2 | Correct | 18 ms | 5412 KB | Number of queries: 9 |
3 | Correct | 24 ms | 5412 KB | Number of queries: 9 |
4 | Correct | 21 ms | 5428 KB | Number of queries: 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 5456 KB | Number of queries: 9 |
2 | Correct | 20 ms | 6188 KB | Number of queries: 9 |
3 | Correct | 24 ms | 5672 KB | Number of queries: 9 |
4 | Correct | 22 ms | 5436 KB | Number of queries: 9 |