제출 #1056864

#제출 시각아이디문제언어결과실행 시간메모리
1056864Malix수천개의 섬 (IOI22_islands)C++17
컴파일 에러
0 ms0 KiB
#include "islands.h" #include <variant> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vii; typedef pair<int,int> pi; typedef vector<pi> pii; typedef tuple<int,int,int> tii; typedef vector<ll> li; typedef vector<li> lii; #define REP(i,a,b) for(int i=a;i<b;i++) #define F first #define S second #define PB push_back #define MP make_pair #define LSOne(s) ((s)&(-s)) ll INF=1e18+10; int inf=1e9+10; ll M=1e9+7; int n,m; std::variant<bool, std::vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V) { n=N;m=M; if(n==2){ if(m<=2)return 0; vi a; REP(i,0,m)if(U[i]==0)a.PB(i); int p=-1; REP(i,0,m)if(U[i]!=0)p=i; int k=s.size(); if(k<2)return 0; vi ans; ans.PB(a[0]);ans.PB(p);ans.PB(a[1]);ans.PB(a[0]);ans.PB(p);ans.PB(a[1]); return ans; } if (N == 4) { return std::vector<int>({0, 1, 2, 4, 0, 3, 2, 1, 4, 3}); } 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:33:20: error: could not convert '0' from 'int' to 'std::variant<bool, std::vector<int, std::allocator<int> > >'
   33 |     if(m<=2)return 0;
      |                    ^
      |                    |
      |                    int
islands.cpp:38:11: error: 's' was not declared in this scope
   38 |     int k=s.size();
      |           ^
islands.cpp:39:19: error: could not convert '0' from 'int' to 'std::variant<bool, std::vector<int, std::allocator<int> > >'
   39 |     if(k<2)return 0;
      |                   ^
      |                   |
      |                   int