Submission #1009387

# Submission time Handle Problem Language Result Execution time Memory
1009387 2024-06-27T12:56:38 Z LilPluton Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
6 ms 10072 KB
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;

const int N = 2e5 + 5;
vector<vector<int>>g(N);
vector<int>v;


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

int findEgg(int N, vector<pair<int,int>> bridges)
{
    g.clear();
    g.resize(N + 1);
    v.clear();
    for(auto i : bridges)
    {
        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 = l; i <= mid; ++i)
        {
            w.push_back(i);
        }
        if(query(w))
            r = mid;
        else
            l = mid + 1;
    }
    return l;
}
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 10072 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 10072 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 10072 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -