제출 #797645

#제출 시각아이디문제언어결과실행 시간메모리
797645XJP12수천개의 섬 (IOI22_islands)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
variant<bool,vector<int>> find_journey(int n, int m, vector<int> u, vector<int> v){
	if(n<3){
		return false;
	}
	int a=-1,b=-1,c=-1,d=-1;
	int peanut1=-1, peanut2=-1;
	for(int i=0; i<m; i++){
		if(u[i]==0){
			if(peanut1==-1){
				a=i;
				peanut1=v[i];
			}else{
				b=i;
				peanut2=v[i];
				break;
			}
		}
	}
	for(int i=0; i<m; i++){
		if(u[i]==peanut1){
			if(v[i]==0){
				c=i;
				break;
			}
		}
	}
	for(int i=0; i<m; i++){
		if(u[i]==peanut2){
			if(v[i]==0){
				d=i;
				break;
			}
		}
	}
	vector<int> x(8);
	if(ban==true && ban1>1){
		x={a,c,b,d,c,a,d,b};
		return x;
	}
}

컴파일 시 표준 에러 (stderr) 메시지

islands.cpp: In function 'std::variant<bool, std::vector<int, std::allocator<int> > > find_journey(int, int, std::vector<int>, std::vector<int>)':
islands.cpp:41:5: error: 'ban' was not declared in this scope; did you mean 'tan'?
   41 |  if(ban==true && ban1>1){
      |     ^~~
      |     tan
islands.cpp:41:18: error: 'ban1' was not declared in this scope
   41 |  if(ban==true && ban1>1){
      |                  ^~~~
islands.cpp:40:17: warning: control reaches end of non-void function [-Wreturn-type]
   40 |  vector<int> x(8);
      |                 ^