Submission #538824

# Submission time Handle Problem Language Result Execution time Memory
538824 2022-03-17T20:22:56 Z Spade1 Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 464 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;

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

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

    dfs(1, 0);
    int l = 1, r = N;
    while (l < r) {
        int mid = (l+r)/2;
        vector<int> check;
        for (int i = 1; i <= mid; ++i) check.pb(ord[i]);
        bool q = query(check);
        if (q) r = mid;
        else l = mid + 1;
    }
    return l;
}
# 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 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -