제출 #632103

#제출 시각아이디문제언어결과실행 시간메모리
632103Minindu2006수천개의 섬 (IOI22_islands)C++17
컴파일 에러
0 ms0 KiB
#include "islands.h"
#include<bits/stdc++.h>
#include <variant>
#include <vector>
using namespace std;

int n, m, can = -1;
vector<int> u, v;
vector<int> adj[1001];
void dfs(int node, vector<int> &ans);


std::variant<bool, std::vector<int>> find_journey(
    int N, int M, std::vector<int> U, std::vector<int> V) {
  n = N, m = M;
  U = u, v = V;
  
    if(m <= 2)
      return 0;
    int z = 0;
    vector<int> cur(3);
    for(int i=0;i<m;i++)
    {
      if(u[i] == 0)
      { 
        if(z < 2)
          cur[z] = i;
        z++;
      }
      else
        cur[2] = i;
    }
    if(z <= 1)
      return 0;
    for(int i=0;i<3;i++)
      cur.push_back(cur[i]);    
    return cur;
  
}

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