Submission #1009392

# Submission time Handle Problem Language Result Execution time Memory
1009392 2024-06-27T12:59:12 Z LilPluton Easter Eggs (info1cup17_eastereggs) C++14
100 / 100
13 ms 748 KB
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;

const int N = 2e5 + 5;
vector<int>g[600];
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)
{
    for(int i = 0; i <= N; ++i)
        g[i].clear();
    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 = 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 Correct 0 ms 344 KB Number of queries: 4
2 Correct 1 ms 344 KB Number of queries: 4
3 Correct 0 ms 344 KB Number of queries: 4
4 Correct 0 ms 344 KB Number of queries: 4
# Verdict Execution time Memory Grader output
1 Correct 2 ms 484 KB Number of queries: 8
2 Correct 7 ms 344 KB Number of queries: 9
3 Correct 11 ms 344 KB Number of queries: 9
4 Correct 13 ms 748 KB Number of queries: 9
# Verdict Execution time Memory Grader output
1 Correct 9 ms 344 KB Number of queries: 9
2 Correct 9 ms 608 KB Number of queries: 9
3 Correct 10 ms 740 KB Number of queries: 9
4 Correct 9 ms 344 KB Number of queries: 9