# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1113903 | 2024-11-17T18:49:23 Z | julia_08 | Easter Eggs (info1cup17_eastereggs) | C++17 | 18 ms | 592 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; const int MAXN = 600; vector<int> adj[MAXN]; int pre[MAXN]; int t = 0; void dfs(int v, int p){ pre[v] = ++ t; for(auto u : adj[v]) if(u != p) dfs(u, v); } bool ask(int k, int n){ vector<int> islands; for(int i=1; i<=n; i++){ if(pre[i] <= k){ islands.push_back(i); } } return query(islands); } int bs(int n){ int l = 1, r = n; while(l < r){ int m = l + (r - l) / 2; if(ask(m, n)) r = m; else l = m + 1; } return r; } int findEgg(int n, vector<pair<int, int>> bridges){ t = 0; for(int i=1; i<=n; i++) adj[i].clear(); for(auto [a, b] : bridges){ adj[a].push_back(b); adj[b].push_back(a); } dfs(1, 1); int x = bs(n); for(int i=1; i<=n; i++){ if(pre[i] == x){ return i; } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 336 KB | Number of queries: 4 |
2 | Correct | 2 ms | 336 KB | Number of queries: 4 |
3 | Correct | 3 ms | 512 KB | Number of queries: 4 |
4 | Correct | 2 ms | 336 KB | Number of queries: 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 484 KB | Number of queries: 8 |
2 | Correct | 13 ms | 336 KB | Number of queries: 9 |
3 | Correct | 18 ms | 336 KB | Number of queries: 9 |
4 | Correct | 16 ms | 592 KB | Number of queries: 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 508 KB | Number of queries: 9 |
2 | Correct | 14 ms | 584 KB | Number of queries: 9 |
3 | Correct | 17 ms | 504 KB | Number of queries: 9 |
4 | Correct | 16 ms | 584 KB | Number of queries: 9 |