Submission #893176

#TimeUsernameProblemLanguageResultExecution timeMemory
893176Trisanu_DasThousands Islands (IOI22_islands)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "islands.h" using namespace std; 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.push_back(i); else v1.push_back(i); } if(v0.size() < 2 || v1.size() < 1) return false; return {v0[0], v1[0], v0[1], v0[0], v1[0], v0[1]}; } if(N <= 400){ int p[N + 5][N + 5]; for(int i = 0; i < M; i++) p[U[i]][V[i]]=i; return {p[0][1],p[1][0],p[0][2],p[2][0],p[1][0],p[0][1],p[2][0],p[0][2]}; } return false; }

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:13:51: error: could not convert '{v0.std::vector<int>::operator[](0), v1.std::vector<int>::operator[](0), v0.std::vector<int>::operator[](1), v0.std::vector<int>::operator[](0), v1.std::vector<int>::operator[](0), v0.std::vector<int>::operator[](1)}' from '<brace-enclosed initializer list>' to 'std::variant<bool, std::vector<int, std::allocator<int> > >'
   13 |   return {v0[0], v1[0], v0[1], v0[0], v1[0], v0[1]};
      |                                                   ^
      |                                                   |
      |                                                   <brace-enclosed initializer list>
islands.cpp:18:74: error: could not convert '{p[0][1], p[1][0], p[0][2], p[2][0], p[1][0], p[0][1], p[2][0], p[0][2]}' from '<brace-enclosed initializer list>' to 'std::variant<bool, std::vector<int, std::allocator<int> > >'
   18 |   return {p[0][1],p[1][0],p[0][2],p[2][0],p[1][0],p[0][1],p[2][0],p[0][2]};
      |                                                                          ^
      |                                                                          |
      |                                                                          <brace-enclosed initializer list>