Submission #872048

# Submission time Handle Problem Language Result Execution time Memory
872048 2023-11-12T07:55:21 Z MON Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
182 ms 131072 KB
#include<iostream>
#include<vector>
using namespace std;

int query(vector<int> islands);

vector<int> vecini[513]; vector<int> v = {0};

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

vector<int> get(int p)
{
    vector<int> g;
    for(int i = 1; i <= p ; i++) g.emplace_back(v[i]);
    return g;
}

int findEgg(int N, vector<pair<int,int>> bridges)
{
    for(auto &it : bridges) vecini[it.first].emplace_back(it.second),vecini[it.second].emplace_back(it.first);
    dfs(1); int n = N;
    int pas = 1, ans = 0; for(; pas <= N ; pas <<= 1);
    for(; pas ; pas >>= 1)
        if(ans + pas <= n) ans += pas * (1 ^ query(get(ans+pas)));
    return v[ans + 1];
}
# Verdict Execution time Memory Grader output
1 Runtime error 182 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 128 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 140 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -