Submission #965475

# Submission time Handle Problem Language Result Execution time Memory
965475 2024-04-18T17:48:21 Z hugsfromadicto Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 600 KB
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;

vector<int>v;
vector<int>g[405];


void dfs(int node, int par)
{
    for(int i : g[node])
    {
        if(i != par)
            dfs(i,node);
    }
}


int findEgg (int n, vector<pair<int,int>>b)
{

    v.clear();
    for(int i = 0; i <= n; ++i)
        g[i].clear();
    
    for(pair<int,int> i : b)
    {
        g[i.first].push_back(i.second);
        g[i.second].push_back(i.first);
    }

    dfs(1,1);
    int l = 0, r = v.size() - 1;
    while(l < r)
    {
        int mid = (l + r) / 2;
        vector<int>w;
        for(int i = 0; i <= mid; ++i)
            w.push_back(v[i]);
        if(query(w))
            r = mid;
        else
            l = mid + 1;
    }
    return v[l];
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -