Submission #918056

# Submission time Handle Problem Language Result Execution time Memory
918056 2024-01-29T12:57:01 Z aykhn Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
2 ms 516 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

vector<int> e;
vector<int> adj[600];

void dfs(int a, int p)
{
    e.push_back(a);
    for (int v : adj[a])
    {
        if (v == p) continue;
        dfs(v, a);
    }
}

int findEgg (int N, vector < pair < int, int > > bridges)
{
    for (int i = 0; i <= N; i++) adj[i].clear();
    for (pair<int, int> p : bridges)
    {
        adj[p.first].push_back(p.second);
        adj[p.second].push_back(p.first);
    }
    dfs(1, 1);
    int l = 0;
    int r = e.size() - 1;
    while (l < r)
    {
        int mid = (l + r) >> 1;
        vector<int> nw;
        for (int i = 0; i <= mid; i++) nw.push_back(e[i]);
        if (query(nw)) r = mid;
        else l = mid + 1;
    }
    return e[l];
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 452 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 484 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 516 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -