Submission #169497

# Submission time Handle Problem Language Result Execution time Memory
169497 2019-12-20T17:15:27 Z Rouge_Hugo Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
304 ms 131076 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
vector<int>vv;
vector<int>v[600];
void dfs (int x,int p)
{
    vv.push_back(x);
    for(auto it:v[x])
    {
        if (it==p)continue;
        dfs(it,x);
    }
}
vector<int>o;
int q (int m)
{
    o.clear();
    for(int i=0;i<=m;i++)o.push_back(vv[i]);
    return query(o);
}
int findEgg(int n, vector < pair < int, int > > bridges)
{
    for(int i=0;i<n-1;i++)
    {
        int x=bridges[i].first,y=bridges[i].second;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    dfs(1,0);
    int st=0,end=vv.size()-1;
    while (st<end)
    {
       // cout<<st<<" "<<end<<endl;
        int m=(st+end)/2;
        if (q(m))
        {
            end=m;continue;
        }
        st=m+1;
    }
    return vv[st];
}
/*
vector<pair<int,int>>o;
int main()
{
    int n;cin>>n;
    for(int i=0;i<n-1;i++)
    {
        int x,y;cin>>x>>y;
        o.push_back({x,y});
    }
    cout<<findEgg(n,o);
}
*/
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 304 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 301 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -