# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1099551 | Choco | Easter Eggs (info1cup17_eastereggs) | C++14 | 1 ms | 600 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"
#define ll long long
using namespace std;
vector<vector<int>>v(520);
vector<int>order;
vector<bool>check(520,0);
void dfs(int i){
check[i]=1;
order.push_back(i);
for(int j=0;j<(v[i].size());j++)
if(!check[j])
dfs(j);
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
for(int i=0;i<513;i++){
v[i].clear();
check[i]=0;
}
order.clear();
for(int i=0;i<(bridges.size());i++){
int x=bridges[i].first;
int y=bridges[i].second;
v[i].push_back(y);
v[y].push_back(x);
}
dfs(1);
int l=0,r=N-1;
while(l!=r){
ll mid=(l+1+r)/2;
if(query(vector<int>(order.begin(),order.begin()+mid)))
r=mid-1;
else
l=mid;
}
return order[l];
}
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... |