제출 #736871

#제출 시각아이디문제언어결과실행 시간메모리
736871onlk97Thousands Islands (IOI22_islands)C++17
컴파일 에러
0 ms0 KiB
#include "islands.h"

#include <variant>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

vector <int> bruh[1010][1010];
std::variant<bool, std::vector<int>> find_journey(int N, int M, std::vector<int> U, std::vector<int> V) {
    if (N==2){
        vector <int> a,b;
        for (int i=0; i<M; i++){
            if (!U[i]) a.push_back(i);
            else b.push_back(i);
        } 
        if (a.size()>=2&&b.size()){
            vector <int> ans;
            ans.push_back(a[0]); ans.push_back(b[0]); ans.push_back(a[1]);
            ans.push_back(a[0]); ans.push_back(b[0]); ans.push_back(a[1]);
            return ans;
        }
        return 0;
    }
    bool subtask2=(N<=400);
    bool subtask3=(N<=1000);
    if (N<=1000){
        for (int i=0; i<M; i++){
            bruh[U[i]][V[i]].push_back(i);
        }
        for (int i=0; i<N; i++){
            for (int j=0; j<N; j++){
                if (i==j) continue;
                if (bruh[i][j].size()!=1) subtask2=0;
            }
        }
        for (int i=0; i<N; i++){
            for (int j=i+1; j<N; j++){
                if (bruh[i][j].size()!=bruh[j][i].size()) subtask3=0;
            }
        }
    }
    if (subtask2){
        vector <int> ans;
        ans.push_back(bruh[0][1][0]);
        ans.push_back(bruh[1][0][0]);
        ans.push_back(bruh[0][2][0]);
        ans.push_back(bruh[2][0][0]);
        ans.push_back(bruh[1][0][0]);
        ans.push_back(bruh[0][1][0]);
        ans.push_back(bruh[2][0][0]);
        ans.push_back(bruh[0][2][0]);
        return ans;
    }
    
}

컴파일 시 표준 에러 (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:22:16: error: could not convert '0' from 'int' to 'std::variant<bool, std::vector<int, std::allocator<int> > >'
   22 |         return 0;
      |                ^
      |                |
      |                int