Submission #713034

# Submission time Handle Problem Language Result Execution time Memory
713034 2023-03-21T00:33:48 Z lam Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
2 ms 592 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
const int maxn = 1010;
typedef pair<int,int> ii;
#define ff first
#define ss second
int n;
vector <int> question;
int dau[maxn],s[maxn];
vector <int> adj[maxn],comp;
void dfs(int x, int p)
{
    comp.push_back(x);
    for (int i:adj[x])
        if (i!=p) dfs(i,x);
}
int findEgg(int N, vector <ii> bridges)
{
    n=N;
    question.clear();
    for (int i=1; i<=n; i++) adj[i].clear();
    for (ii i:bridges)
    {
        adj[i.ff].push_back(i.ss);
        adj[i.ss].push_back(i.ff);
    }
    dfs(1,1);
    int l=0; int r=n-1;
    int ans = -1;
    while (l<r)
    {
        int mid=(l+r)/2;
        vector <int> tmp;
        for (int i=0; i<=mid; i++) tmp.push_back(comp[i]);
        if (query(tmp)) r=mid;
        else l=mid+1;
    }
    return comp[ans];
}
# 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 -