Submission #1359427

#TimeUsernameProblemLanguageResultExecution timeMemory
1359427opeleklanosThousands Islands (IOI22_islands)C++20
Compilation error
0 ms0 KiB
#include <iostream>
#include <vector>
#include <variant>
using namespace std;

variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V){

    int a = 0; int b = 0;
    for(int i = 0; i<M; i++){
        if(U[i] == 1) b++;
        else a++;
    }

    if(a <2 || b<1) return 0;

    return 1;
}

Compilation message (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:14:28: error: could not convert '0' from 'int' to 'std::variant<bool, std::vector<int, std::allocator<int> > >'
   14 |     if(a <2 || b<1) return 0;
      |                            ^
      |                            |
      |                            int
islands.cpp:16:12: error: could not convert '1' from 'int' to 'std::variant<bool, std::vector<int, std::allocator<int> > >'
   16 |     return 1;
      |            ^
      |            |
      |            int