Submission #711446

# Submission time Handle Problem Language Result Execution time Memory
711446 2023-03-17T01:51:32 Z ooo Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
2 ms 592 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
#define fi first
#define se second
#define ll long long 
vector< vector<int> > g;
vector<int> thutu;
void dfs(ll u, ll t)
{   
    thutu.push_back(u);
    for(int i = 0; i < int(g[u].size()); ++i)
    {
        ll v = g[u][i];
        if(v == t) continue;
        dfs(v, u);
    }
}
int findEgg (int n, vector < pair < int, int > > bridges)
{
    g.clear();
    thutu.clear();
    g.resize(n+1);
    for(int i = 0; i < int(bridges.size()); ++i)
    {
        g[bridges[i].fi].push_back(bridges[i].se);
        g[bridges[i].se].push_back(bridges[i].fi);
    }

    dfs(1, 0);
    ll l = 0; ll r = n-1;
    while(l < r)
    {
        ll mid = (l+r)/2;
        if(query(vector<int>(thutu.begin(), thutu.begin()+mid)))
            r = mid;
        else l = mid+1;
    }
    return thutu[l];
    return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 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 -