Submission #722108

# Submission time Handle Problem Language Result Execution time Memory
722108 2023-04-11T12:17:50 Z viwlesxq Easter Eggs (info1cup17_eastereggs) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

typedef int64_t ll;
typedef string str;

int findEgg(int n, vector <pair <int, int>> edges) {
  vector <int> g[n + 1];
  vector <int> path;
  for (auto [a, b] : edges) {
    g[a].push_back(b);
    g[b].push_back(a);
  }
  function <void(int, int)> dfs = [&](int v, int p) {
    path.push_back(v);
    for (int to : g[v]) {
      if (to == p) {
        continue;
      }
      prepare(to, v);
    }
  };
  dfs(1, -1);
  int l = 0, r = n - 1;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (query(vector <int>(path.begin() + l, path.begin() + mid))) {
      r = mid;
    } else {
      l = mid;
    }
  }
  return path[l];
}

Compilation message

eastereggs.cpp: In lambda function:
eastereggs.cpp:22:7: error: 'prepare' was not declared in this scope
   22 |       prepare(to, v);
      |       ^~~~~~~