# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
781623 | 2023-07-13T08:46:06 Z | Andrey | Easter Eggs (info1cup17_eastereggs) | C++14 | 17 ms | 368 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; vector<int> haha[513]; vector<int> bruh(513); vector<int> wut(0); int br,p; void dfs(int a, int t) { if(p >= br/2) { return; } wut.push_back(a); if(bruh[a] == 1) { bruh[a] = 2; p++; } for(int v: haha[a]) { if(v != t && p < br/2) { dfs(v,a); } } } int findEgg (int n, vector < pair < int, int > > bridges) { for(int i = 0; i < 513; i++) { haha[i].clear(); } int a,b,c; for(int i = 0; i < n-1; i++) { a = bridges[i].first; b = bridges[i].second; haha[a].push_back(b); haha[b].push_back(a); } for(int i = 1; i <= n; i++) { bruh[i] = 1; } br = n; p = 0; while(br > 1) { wut.clear(); p = 0; dfs(1,-1); if(query(wut)) { c = 2; } else { c = 1; } br = 0; for(int i = 1; i <= n; i++) { if(bruh[i] != 0) { if(bruh[i] == c) { br++; bruh[i] = 1; } else { bruh[i] = 0; } } } } for(int i = 1; i <= n; i++) { if(bruh[i] == 1) { return i; } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 308 KB | Number of queries: 4 |
2 | Correct | 1 ms | 208 KB | Number of queries: 4 |
3 | Correct | 2 ms | 208 KB | Number of queries: 4 |
4 | Correct | 1 ms | 308 KB | Number of queries: 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 356 KB | Number of queries: 8 |
2 | Correct | 12 ms | 352 KB | Number of queries: 9 |
3 | Correct | 15 ms | 352 KB | Number of queries: 9 |
4 | Correct | 14 ms | 336 KB | Number of queries: 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 368 KB | Number of queries: 9 |
2 | Correct | 16 ms | 336 KB | Number of queries: 9 |
3 | Correct | 17 ms | 356 KB | Number of queries: 9 |
4 | Correct | 13 ms | 360 KB | Number of queries: 9 |