Submission #762471

# Submission time Handle Problem Language Result Execution time Memory
762471 2023-06-21T12:26:36 Z beepbeepsheep Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
394 ms 131072 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

const int maxn=520;
vector<short> adj[maxn];
vector<short> v;
int ptr;
vector<int> q;
void dfs(short x, short 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 394 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 310 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 288 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -