답안 #892745

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
892745 2023-12-25T20:31:51 Z Isam Easter Eggs (info1cup17_eastereggs) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>

#include "grader.h"

#ifdef DEBUG
  #include "debug.h"
#else
  #define debug(...) void(37)
#endif

using namespace std;

constexpr int sz = 2e5 + 5;

#define pii pair<int, int>
#define F first
#define S second

int timel;
int tin[sz];

vector<vector<int>> g;

inline void Dfs(int node, int fa = 1){
	tin[++timel] = node;
	for(auto &to : g[node]){
		if(to == fa) continue;
		Dfs(to, node);
	}
	return;
}

bool Query(int l, int r){
	vector<int> v;
	for(register int i{l}; i <= r; ++i) v.emplace_back(tin[i]);
	return query(v);
}

int findEgg(int N, vector < pair < int, int > > bridges){
	g.resize(N+1);
	for(register int i(0), a, b; i < N; ++i){
		a = bridges[i].F, b = bridges[i].S;
		g[a].emplace_back(b), g[b].emplace_back(a);
	}
	Dfs(1)
	int l = 1, r = N, mid, best;
	while(l < r){
		mid = l + ((r - l) >> 1);
		if(Query(l, mid)){
			r = mid;
		}else{
			l = mid + 1;
		}
	}
	return tin[r];
}

Compilation message

eastereggs.cpp: In function 'bool Query(int, int)':
eastereggs.cpp:35:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   35 |  for(register int i{l}; i <= r; ++i) v.emplace_back(tin[i]);
      |                   ^
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:41:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   41 |  for(register int i(0), a, b; i < N; ++i){
      |                   ^
eastereggs.cpp:41:25: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   41 |  for(register int i(0), a, b; i < N; ++i){
      |                         ^
eastereggs.cpp:41:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   41 |  for(register int i(0), a, b; i < N; ++i){
      |                            ^
eastereggs.cpp:45:8: error: expected ';' before 'int'
   45 |  Dfs(1)
      |        ^
      |        ;
   46 |  int l = 1, r = N, mid, best;
      |  ~~~    
eastereggs.cpp:47:8: error: 'l' was not declared in this scope
   47 |  while(l < r){
      |        ^
eastereggs.cpp:47:12: error: 'r' was not declared in this scope
   47 |  while(l < r){
      |            ^
eastereggs.cpp:48:3: error: 'mid' was not declared in this scope
   48 |   mid = l + ((r - l) >> 1);
      |   ^~~
eastereggs.cpp:55:13: error: 'r' was not declared in this scope
   55 |  return tin[r];
      |             ^