Submission #464807

# Submission time Handle Problem Language Result Execution time Memory
464807 2021-08-14T08:01:33 Z okaragul Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
2 ms 456 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;

vector<vector<int>> g;
vector<int> ord;

void dfs(int v, int p){
    ord.push_back(v);
    for(auto &ch:g[v]) if(ch!=p) dfs(ch, v);
}

int findEgg (int N, vector < pair < int, int > > bridges)
{
    g.assign(N, vector<int>()); ord.clear();
    for(int i = 0; i < N-1; i++){
        auto &[a, b]=bridges[i];
        g[a-1].push_back(b-1);
        g[b-1].push_back(a-1);
    }
    dfs(0, -1);
    int l=1, r=N;
    while(l<r){
        int mid=(l+r)/2;
        
        vector<int> tmp;
        for(int i = 0; i < mid; i++) tmp.push_back(ord[i]+1);

        if(!query(tmp)) l=mid+1;
        else r=mid;
    }
    return 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 Runtime error 1 ms 444 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -