# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
61636 | minhcool | Easter Eggs (info1cup17_eastereggs) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include "grader.h"
using namespace std;
const int N = 515;
int ck[N], cur, num;
vector<int> Adjlist[N], check;
void dfs(int u, int p){
if(cur == num) return;
if(ck[u]){
cur++;
}
check.push_back(u);
for(auto v: Adjlist[u]){
if(v != p){
dfs(v, u);
}
}
}
void findEgg(int N, vector<pair<int, int>> bridges){
memset(ck, 1, sizeof ck);
int n = N, cnt;
for(int i = 0; i < n; i++){
bridges.first.push_back(bridges.second);
bridges.second.push_back(bridges.first);
}
num = n;
while(num != 1){
cnt = (num + 1) / 2;
check.clear();
cur = 0;
dfs(1, 1);
if(query(check)){
for(int i = 1; i <= n; i++) ck[i] = 0;
for(int i = 0; i < check.size(); i++) ck[check[i]] = 1;
cnt = num;
}
else{
for(int i = 0; i < check.size(); i++) ck[check[i]] = 0;
cnt -= num;
}
}
for(int i = 1; i <= n; i++) if(ck[i]) return i;
}