# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
916362 | andrei_iorgulescu | Easter Eggs (info1cup17_eastereggs) | C++14 | 17 ms | 1004 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;
int n;
bool pot[1000];
vector<int>g[1000];
int nrk,cate;
vector<int>noduri;
bool viz[1000];
bool innoduri[1000];
void dfs(int nod)
{
viz[nod] = true;
if (nrk == cate / 2)
return;
noduri.push_back(nod);
if (pot[nod] == true)
nrk++;
for (auto vecin : g[nod])
if (!viz[vecin])
dfs(vecin);
}
int findEgg (int N, vector<pair<int,int>>bridges)
{
n = N;
for (int i = 1; i <= n; i++)
g[i].clear();
for (int i = 1; i <= n; i++)
pot[i] = true;
for (auto it : bridges)
{
g[it.first].push_back(it.second);
g[it.second].push_back(it.first);
}
cate = n;
while (cate > 1)
{
for (int i = 1; i <= n; i++)
viz[i] = false;
nrk = 0;
noduri.clear();
dfs(1);
int x = query(noduri);
for (int i = 1; i <= n; i++)
innoduri[i] = false;
for (auto it : noduri)
innoduri[it] = true;
if (x == 1)
{
for (int i = 1; i <= n; i++)
if (innoduri[i] == false)
pot[i] = false;
}
else
{
for (int i = 1; i <= n; i++)
if (innoduri[i] == true)
pot[i] = false;
}
cate = 0;
for (int i = 1; i <= n; i++)
if (pot[i] == true)
cate++;
}
for (int i = 1; i <= n; i++)
if (pot[i] == true)
return i;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |