# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
61593 | 2018-07-26T07:50:19 Z | IOrtroiii | Easter Eggs (info1cup17_eastereggs) | C++14 | 59 ms | 3000 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; const int N = 1e5 + 5; int n; vector<int> G[N]; bool can[N], chosen[N]; int cur, need, cnt; vector<int> ask; bool egg[N]; void dfs(int u,int p) { if (cnt == need) return; if (can[u]) cnt++; ask.push_back(u); chosen[u] = 1; for (int v : G[u]) if (v != p) { dfs(v, u); } } int findEgg(int N,vector<pair<int,int> > bridges) { n = N; for (int i = 1; i <= n; ++i) can[i] = 1; for (int i = 1; i <= n; ++i) G[i].clear(); for (auto ed : bridges) { int u = ed.first, v = ed.second; G[u].push_back(v), G[v].push_back(u); } cur = n; while (cur != 1) { ask.clear(); need = cur / 2; for (int i = 1; i <= n; ++i) chosen[i] = 0; cnt = 0; dfs(1, 1); if (query(ask)) { for (int i = 1; i <= n; ++i) if (!chosen[i]) { can[i] = 0; } cur = need; } else { for (int v : ask) can[v] = 0; cur -= need; } } for (int i = 1; i <= n; ++i) if (can[i]) { return i; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2552 KB | Number of queries: 4 |
2 | Correct | 5 ms | 2612 KB | Number of queries: 4 |
3 | Correct | 5 ms | 2816 KB | Number of queries: 4 |
4 | Correct | 5 ms | 2816 KB | Number of queries: 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 2892 KB | Number of queries: 8 |
2 | Correct | 30 ms | 2892 KB | Number of queries: 9 |
3 | Correct | 31 ms | 2892 KB | Number of queries: 9 |
4 | Correct | 27 ms | 2892 KB | Number of queries: 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 59 ms | 2892 KB | Number of queries: 9 |
2 | Correct | 29 ms | 2892 KB | Number of queries: 9 |
3 | Correct | 40 ms | 2892 KB | Number of queries: 9 |
4 | Correct | 40 ms | 3000 KB | Number of queries: 9 |