# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
692453 | 2023-02-01T12:57:32 Z | MateiKing80 | Easter Eggs (info1cup17_eastereggs) | C++14 | 21 ms | 476 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; vector<int>v[513]; vector<int>ord; void dfs (int nod, int tata) { ord.push_back(nod); for (int i=0;i<v[nod].size();i++) { if (v[nod][i] == tata) continue; dfs(v[nod][i], nod); } } int findEgg(int n, vector < pair < int, int > > bridges) { for (int i=0;i<n-1;i++) { v[bridges[i].first].push_back(bridges[i].second); v[bridges[i].second].push_back(bridges[i].first); } dfs(1, 0); int l=1, r=n; while (l < r) { int mid = (l + r) / 2; vector<int>acm; for (int i=0; i<mid; i++) acm.push_back(ord[i]); if (query(acm)) r = mid; else l = mid + 1; } int ans = ord[r-1]; for (int i=1; i<=n; i++) v[i].clear(); ord.clear(); return ans; }
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 | 2 ms | 208 KB | Number of queries: 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 476 KB | Number of queries: 8 |
2 | Correct | 11 ms | 356 KB | Number of queries: 9 |
3 | Correct | 15 ms | 356 KB | Number of queries: 9 |
4 | Correct | 13 ms | 336 KB | Number of queries: 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 336 KB | Number of queries: 9 |
2 | Correct | 14 ms | 336 KB | Number of queries: 9 |
3 | Correct | 19 ms | 360 KB | Number of queries: 9 |
4 | Correct | 21 ms | 468 KB | Number of queries: 9 |