Submission #744319

# Submission time Handle Problem Language Result Execution time Memory
744319 2023-05-18T12:07:40 Z MON Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
89 ms 131072 KB
#include <vector>
#include "grader.h"
using namespace std;

vector<int> e,vecini[513];

void dfs(int a = 1,int p = -1)
{
    e.emplace_back(a);
    for(auto &it : vecini[a])
        if(it != p) dfs(it);
}

int findEgg (int N, vector < pair < int, int > > bridges)
{
    e = {1}; for(int i = 1; i <= N ; i++) vecini[i].clear();
    for(auto &it : bridges)
        {
            vecini[it.first].emplace_back(it.second);
            vecini[it.second].emplace_back(it.first);
        }

    dfs(); int ans = 0,pas = 1; while(pas <= N) pas <<= 1;
    for(; pas ; pas >>= 1)
        {
            if(ans + pas >= N) continue;
            if(!query(vector<int>(e.begin() + 1,e.begin() + 1 + (ans + pas)))) ans += pas;
        }

    return ans + 1;
}
# Verdict Execution time Memory Grader output
1 Runtime error 77 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 89 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 80 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -