Submission #61571

# Submission time Handle Problem Language Result Execution time Memory
61571 2018-07-26T07:40:09 Z FutymyClone Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
400 ms 131072 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

const int N = 515;
vector <int> g[N], vertices;
int n, a[N];

void dfs (int u, int p) {
    vertices.push_back(u);
    for (int v: g[u]) {
        if (v == p) continue;
        dfs(v, u);
    }
}

int findEgg (int N, vector <pair <int, int> > bridges) {
    n = N;
    for (auto i: bridges) {
        g[i.first].push_back(i.second);
        g[i.second].push_back(i.first);
    }

    dfs(1, 1);

    int l = 1;
    int r = n;

    vector <int> islands;
    while (l <= r) {
        int mid = (l + r) / 2;
        islands.clear();
        for (int i = 1; i <= mid; i++) {
            islands.push_back(vertices[i - 1]);
        }

        if (query(islands)) r = mid - 1;
        else l = mid + 1;
    }

    return vertices[l - 1];
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1026 ms 131072 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 131072 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1050 ms 131072 KB Time limit exceeded
2 Halted 0 ms 0 KB -