#include <iostream>
#include <fstream>
#include <cstring>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include "grader.h"
using namespace std;
#define endl "\n"
#define F first
#define S second
#define pb push_back
typedef long long ll;
const int M = 530;
const int mod = 1e9+7;
vector <int> adj[M], path;
void dfs(int node, int p)
{
path.pb(node);
for(auto i : adj[node]){
if(i == p) continue;
dfs(i, node);
}
return;
}
int findEgg(int n, vector < pair <int,int> > bridges)
{
for(auto i : bridges){
adj[i.F].pb(i.S);
adj[i.S].pb(i.F);
}
dfs(1, 0);
int l = 1, r = n;
while(l < r){
int mid = (l + r) / 2;
vector <int> v;
for(int i = 0; i < mid; ++i) v.pb(path[i]);
if(query(v)) r = mid;
else l = mid + 1;
}
return l;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
456 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
287 ms |
131076 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
277 ms |
131076 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |