# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
269758 | 2020-08-17T09:45:55 Z | Atill83 | Easter Eggs (info1cup17_eastereggs) | C++14 | 27 ms | 384 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; vector<int> adj[550]; int tin[550]; int tim = 0; void dfs(int v, int par){ tin[v] = tim++; for(int j: adj[v]){ if(j != par){ dfs(j, v); } } } int findEgg (int N, vector < pair < int, int > > bridges) { for(int i = 1; i <= N; i++){ adj[i].clear(); tin[i] = -1; } for(int i = 0; i < N - 1; i++){ int u = bridges[i].first, v = bridges[i].second; adj[u].push_back(v); adj[v].push_back(u); } tim = 0; dfs(1, -1); int l = 0, r = N - 1; while(l < r){ int m = (l + r) / 2; vector<int> srg; for(int i = 1; i <= N; i++){ if(tin[i] <= m){ srg.push_back(i); } } if(query(srg)){ r = m; }else{ l = m + 1; } } for(int j = 1; j <= N; j++){ if(tin[j] == l){ return j; } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Number of queries: 4 |
2 | Correct | 1 ms | 384 KB | Number of queries: 4 |
3 | Correct | 1 ms | 384 KB | Number of queries: 4 |
4 | Correct | 1 ms | 384 KB | Number of queries: 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 384 KB | Number of queries: 8 |
2 | Correct | 18 ms | 384 KB | Number of queries: 9 |
3 | Correct | 20 ms | 384 KB | Number of queries: 9 |
4 | Correct | 20 ms | 384 KB | Number of queries: 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 384 KB | Number of queries: 9 |
2 | Correct | 21 ms | 384 KB | Number of queries: 9 |
3 | Correct | 21 ms | 308 KB | Number of queries: 9 |
4 | Correct | 27 ms | 384 KB | Number of queries: 9 |