Submission #742780

# Submission time Handle Problem Language Result Execution time Memory
742780 2023-05-16T23:15:54 Z Abrar_Al_Samit Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
2 ms 592 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

const int nax = 513;
vector<int>g[nax];
vector<int>order;

void dfs(int v, int p = 0) {
    order.push_back(v);
    for(int u : g[v]) if(u!=p) {
        dfs(u, v);
    }
}
int findEgg (int N, vector<pair<int,int>>bridges) {
    for(int i=1; i<=N; ++i) {
        g[i].clear();
    }
    for(int i=1; i<N; ++i) {
        auto [u, v] = bridges[i-1];
        g[u].push_back(v);
        g[v].push_back(u);
    }

    dfs(1);

    int lo = 0, hi = order.size();

    while(lo<hi-1) {
        int mid = (lo+hi)/2;

        vector<int>Qset;
        for(int i=0; i<mid; ++i) {
            Qset.push_back(order[i]);
        }
        if(query(Qset)) {
            hi = mid;
        } else {
            lo = mid;
        }
    }
    return order[lo];
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 592 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -