제출 #797643

#제출 시각아이디문제언어결과실행 시간메모리
797643ChrisM2309Thousands Islands (IOI22_islands)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

variant<bool, vector<int>> find_journey(int N, int M, int[] U, int[] V){
    int cont0 = 0, cont1 = 0;
    int b1 = -1, b2 = -1, b3 = -1;
    for (int i = 0; i < M; i++){
        if(U[i] == 0){
            cont0++;
            if(b1==-1) b1 = i;
            else b2 = i;
        }
        else cont1++;
        b3 = i;
    }
    if(cont0 > 1 and cont1 > 0){
        vector<int> ans = {b1, b3, b2, b1, b3, b2};
        return ans;
    } 
    return false;
}

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

islands.cpp:4:61: error: expected ',' or '...' before 'U'
    4 | variant<bool, vector<int>> find_journey(int N, int M, int[] U, int[] V){
      |                                                             ^
islands.cpp: In function 'std::variant<bool, std::vector<int, std::allocator<int> > > find_journey(int, int, int*)':
islands.cpp:8:12: error: 'U' was not declared in this scope
    8 |         if(U[i] == 0){
      |            ^