# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
644830 | 2022-09-25T10:34:12 Z | notme | Easter Eggs (info1cup17_eastereggs) | C++14 | 23 ms | 612 KB |
#include<bits/stdc++.h> #include "grader.h" #define endl '\n' using namespace std; const int MAXN = 513; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int n; vector < int > g[MAXN]; int used[MAXN]; vector < int > a; void dfs(int beg) { used[beg] = 1; a.push_back(beg); int nb; for (int i = 0; i < g[beg].size(); ++ i) { nb = g[beg][i]; if(!used[nb]) { dfs(nb); } } } int findEgg(int N, vector < pair < int, int > > bridges) { n = N; for (int i = 0; i < bridges.size(); ++ i) { int x = bridges[i].first; int y = bridges[i].second; ///cout << x << " " << y << endl; g[x].push_back(y); g[y].push_back(x); } dfs(1); /** for (int i = 0; i < a.size(); ++ i) cout << a[i] << " "; cout << endl;*/ int l = 0, r = n-1, mid; while(l < r) { //cout << l << " " << r << endl; mid = (l + r)/2; vector < int > nodes; for (int i = 0; i <= mid; ++ i) { nodes.push_back(a[i]); } if(query(nodes) == 1) { l = l; r = mid; } else { l = mid+1; r = r; } } // cout << l << " " << r << endl; return a[l]; }
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 | 3 ms | 208 KB | Number of queries: 4 |
4 | Correct | 2 ms | 208 KB | Number of queries: 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 456 KB | Number of queries: 8 |
2 | Correct | 11 ms | 492 KB | Number of queries: 9 |
3 | Correct | 17 ms | 608 KB | Number of queries: 9 |
4 | Correct | 23 ms | 580 KB | Number of queries: 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 588 KB | Number of queries: 9 |
2 | Correct | 14 ms | 604 KB | Number of queries: 9 |
3 | Correct | 17 ms | 612 KB | Number of queries: 9 |
4 | Correct | 20 ms | 572 KB | Number of queries: 9 |