Submission #1116800

# Submission time Handle Problem Language Result Execution time Memory
1116800 2024-11-22T12:04:09 Z Sofiatpc Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
187 ms 131072 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

const int MAXN = 520;
vector<int> adj[MAXN], v;

void dfs(int s, int p){
    v.push_back(s);
    for(int viz : adj[s])
        if(viz != p)dfs(viz,s);
}

int findEgg (int n, vector < pair < int, int > > bridges)
{
    for(int i = 0; i < n-1; i++){
        adj[bridges[i].first].push_back(bridges[i].second);
        adj[bridges[i].second].push_back(bridges[i].first);
    }

    dfs(1,0);

    int l = 0, r = n-1;
    while(l != r){
        int mid = (l+r)/2;

        vector<int> temp;
        for(int i = 0; i <= mid; i++)temp.push_back(v[i]);

        if(query(temp) == 1)r = mid;
        else l = mid+1;
    }

    return v[l];
}
# Verdict Execution time Memory Grader output
1 Runtime error 187 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 155 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 167 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -