Submission #915159

# Submission time Handle Problem Language Result Execution time Memory
915159 2024-01-23T12:25:35 Z Pikachu Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
1 ms 600 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

const int maxn = 520, oo = 1e9;
int n;
vector<int> adj[maxn];
vector<int> pos;

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

    auto DFS = [] (auto DFS, int u, int par) {
        pos.push_back(u);
        for (int v : adj[u]) {
            if (v == par) continue;
            DFS(v);
        }
    };

    int l = 0, r = n - 1, ans = r;
    while (l <= r) {
        int mid = (l + r) >> 1;
        if (query(vector<int>(pos.begin(), pos.begin() + mid + 1))) {
            ans = mid;
            r = mid - 1;
        }
        else l = mid + 1;
    }
    
    return ans;
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:20:10: warning: variable 'DFS' set but not used [-Wunused-but-set-variable]
   20 |     auto DFS = [] (auto DFS, int u, int par) {
      |          ^~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 596 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 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -