Submission #538826

# Submission time Handle Problem Language Result Execution time Memory
538826 2022-03-17T20:39:54 Z Spade1 Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
253 ms 131072 KB
#include <bits/stdc++.h>
#include "grader.h"
#define pii pair<int, int>
#define ll long long
#define ld long double
#define st first
#define nd second
#define pb push_back
#define INF INT_MAX
using namespace std;

vector<int> adj[600];
vector<int> ord;
int ans = 3;

void dfs(int i, int prt) {
    ord.pb(i);
    for (auto j : adj[i]) {
        if (j == prt) continue;
        dfs(j, i);
    }
}

int findEgg(int N, vector<pii> bridges) {
    for (int i = 0; i < N - 1; ++i) {
        int u = bridges[i].st;
        int v = bridges[i].nd;
        adj[u].pb(v);
        adj[v].pb(u);
    }

    dfs(1, 0);
    int l = 0, r = N-1;
    while (l < r) {
        int mid = (l+r)/2;
        vector<int> check;
        for (int i = 0; i <= mid; ++i) check.pb(ord[i]);
        bool q = query(check);
        if (q) r = mid;
        else l = mid + 1;
    }
    return ord[l];
}
# Verdict Execution time Memory Grader output
1 Runtime error 253 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 203 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 235 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -