Submission #890561

# Submission time Handle Problem Language Result Execution time Memory
890561 2023-12-21T13:19:16 Z Iwantbemaster Easter Eggs (info1cup17_eastereggs) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
int i, cur[1005];
vector<int> result[1005];
void DFS(int res, int ans){
	cur[++i] = res;
	for(auto to : result[res]){
		if(to == ans) continue;
		DFS(to, res);
	}
}
int Query(int res){
	vector<int> v;
	for(int i = 1; i <= res; i++) v.push_back(ord[i]);
	return query(v);
}

int findEgg(int n, vector<pair<int, int>> bridges){
	for(int i = 1; i <= N; i++) result[i].clear();
	for(auto e: bridges){
		result[e.first].push_back(e.second);
		result[e.second].push_back(e.first);
	} i = 0; DFS(1, 0);
	int l = 1, r = N;
	while(l < r){
		int m = l + (r - l) / 2;
		if(Query(m)) r = m;
		else l = m + 1;
	} return cur[l];
}

Compilation message

eastereggs.cpp: In function 'int Query(int)':
eastereggs.cpp:15:44: error: 'ord' was not declared in this scope
   15 |  for(int i = 1; i <= res; i++) v.push_back(ord[i]);
      |                                            ^~~
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:20:22: error: 'N' was not declared in this scope
   20 |  for(int i = 1; i <= N; i++) result[i].clear();
      |                      ^
eastereggs.cpp:25:17: error: 'N' was not declared in this scope
   25 |  int l = 1, r = N;
      |                 ^