Submission #918080

# Submission time Handle Problem Language Result Execution time Memory
918080 2024-01-29T13:05:19 Z fuad27 Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
1 ms 512 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
const int n = 1000;
vector<int> g[n];
vector<int> v;
void dfs(int at, int p) {
  v.push_back(at);
  for(int to:g[at]) {
    if(to==p)continue;
    dfs(to, at);
  }
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
  for(auto i:bridges) {
    g[i.first].push_back(i.second);
    g[i.second].push_back(i.first);
  }
  dfs(1,0);
  int l = 0, r = v.size()-1, res = -1;
  while(l <= r) {
    int mid = (l+r)/2;
    vector<int> q;
    for(int i = 0;i<mid;i++)q.push_back(v[i]);
    if(query(q)) {
      r=mid-1;
      res=v[mid-1];
    }
    else {
      l=mid+1;
    }
  }
  for(int i = 0;i<=n;i++)g[i].clear();
  return res;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 480 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -