# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
484223 | 2021-11-02T14:33:25 Z | Alexandruabcde | Easter Eggs (info1cup17_eastereggs) | C++14 | 20 ms | 468 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; constexpr int NMAX = 1000; vector <int> G[NMAX]; vector <int> vec; void Parcurgere_Euler (int Node, int Dad = -1) { vec.push_back(Node); for (auto it : G[Node]) { if (it == Dad) continue; Parcurgere_Euler(it, Node); } } bool Check (int Right) { vector <int> ask; for (int i = 0; i <= Right; ++ i ) ask.push_back(vec[i]); return query(ask); } int findEgg (int N, vector < pair < int, int > > bridges) { vec.clear(); for (int i = 1; i <= N; ++ i ) G[i].clear(); for (int i = 0; i < bridges.size(); ++ i ) { int x = bridges[i].first; int y = bridges[i].second; G[x].push_back(y); G[y].push_back(x); } Parcurgere_Euler(1, -1); int st = 0, dr = vec.size()-2; int ans = vec.size()-1; while (st <= dr) { int mij = (st + dr) / 2; if (Check(mij)) { dr = mij - 1; ans = mij; } else st = mij + 1; } return vec[ans]; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 200 KB | Number of queries: 4 |
2 | Correct | 1 ms | 200 KB | Number of queries: 4 |
3 | Correct | 1 ms | 200 KB | Number of queries: 4 |
4 | Correct | 1 ms | 200 KB | Number of queries: 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 348 KB | Number of queries: 8 |
2 | Correct | 11 ms | 344 KB | Number of queries: 9 |
3 | Correct | 15 ms | 468 KB | Number of queries: 9 |
4 | Correct | 19 ms | 364 KB | Number of queries: 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 372 KB | Number of queries: 9 |
2 | Correct | 14 ms | 352 KB | Number of queries: 9 |
3 | Correct | 15 ms | 328 KB | Number of queries: 9 |
4 | Correct | 20 ms | 328 KB | Number of queries: 9 |