Submission #419994

# Submission time Handle Problem Language Result Execution time Memory
419994 2021-06-07T21:16:02 Z Runtime_error_ Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
8 ms 516 KB
#include <bits/stdc++.h>
#include "grader.h"
#define pb push_back
using namespace std;
const int inf = 1e3+9;

vector<int> DfsOrder,adj[inf];

void dfs(int u,int p){
    DfsOrder.pb(u);
    for(auto v:adj[u])
        if(v != p)
            dfs(v,u);
}

int findEgg (int n, vector < pair < int, int > > bridges)
{
    for(int i=0;i<n;i++)
        adj[i].clear();
    DfsOrder.clear();
    for(auto o:bridges)
        adj[o.first].pb(o.second),
        adj[o.second].pb(o.first);

    dfs(1,-1);
    int l = 0,r = n-1;
    while(r!=l){
        int mid = (l+r)/2;
        if(query(vector<int>(DfsOrder.begin(),DfsOrder.begin()+mid+1)))
            r = mid;
        else
            l = mid+1;
    }
    return DfsOrder[l];
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 336 KB Number of queries: 8
2 Runtime error 2 ms 456 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 516 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -