Submission #762292

# Submission time Handle Problem Language Result Execution time Memory
762292 2023-06-21T09:09:31 Z beepbeepsheep Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
225 ms 131072 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

const int maxn=520;
vector<int> adj[maxn];
vector<int> v;
int ptr;
vector<int> q;
void dfs(int x, int p){
    v.emplace_back(x);
    for (auto u:adj[x]){
        if (u==p) continue;
        dfs(u,x);
    }
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
    for (auto [u,v]:bridges){
        adj[u].emplace_back(v);
        adj[v].emplace_back(u);
    }
    dfs(1,-1);
    int l=0,r=N,m;
    while (l!=r-1){
        m=(l+r)>>1;
        while (ptr<m){
            q.emplace_back(v[ptr++]);
        }
        while (ptr>m){
            q.pop_back();
            ptr--;
        }
        if (query(q)) r=m;
        else l=m;
    }
    return v[l];
}
# Verdict Execution time Memory Grader output
1 Runtime error 225 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 173 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 161 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -