제출 #685352

#제출 시각아이디문제언어결과실행 시간메모리
685352irmuun수천개의 섬 (IOI22_islands)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "islands.h" using namespace std; #define pb push_back variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V){ if(N==2){ vector<int>v0,v1; for(int i=0;i<M;i++){ if(U[i]==0){ v0.pb(i); } else{ v1.pb(i); } } if(v0.size()<2||v1.size()<1){ return false; } return vector<int>{v0[0],v1[0],v0[1],v0[0],v1[0],v0[1]}; } if(N<=1000&&M%2==0){ vector<int>vec; for(int i=0;i<M;i+=2){ if(U[i]==0){ vec.pb(i); vec.pb(i+1) } if(U[i+1]==0){ vec.pb(i+1); vec.pb(i); } } if(vec.size()<4){ return 0; } return vector<int>{vec[0],vec[1],vec[2],vec[3],vec[1],vec[0],vec[3],vec[2]}; } return false; }

컴파일 시 표준 에러 (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:26:16: error: expected ';' before '}' token
   26 |     vec.pb(i+1)
      |                ^
      |                ;
   27 |    }
      |    ~            
islands.cpp:34:11: error: could not convert '0' from 'int' to 'std::variant<bool, std::vector<int, std::allocator<int> > >'
   34 |    return 0;
      |           ^
      |           |
      |           int