Submission #1239666

#TimeUsernameProblemLanguageResultExecution timeMemory
1239666AlperenT_Thousands Islands (IOI22_islands)C++20
Compilation error
0 ms0 KiB
#include "islands.h"

#include <variant>
#include <vector>
#include <bits/stdc++.h> 
//#include "segments.h"
#pragma GCC optimize("O3,unroll-loops") 
#pragma GCC target("avx2") 
#define pb push_back
#define F first
#define pii pair<int,int> 
#define all(a) a.begin(),a.end()
#define S second 
#define sz(a) (int)a.size()
#define rep(i , a , b) for(int i = (a) ; i <= (b) ; i++)
#define per(i , a , b) for(int i = (a) ; i >= (b) ; i--)
#define ld double
#define ll long long 
using namespace std ;
const int maxn = 5000 + 10 , inf = 1e9+ 10 , mod = 998244353;
int mark[maxn] ;
std::variant<bool, std::vector<int>> find_journey(int n, int m, std::vector<int> U, std::vector<int> V) {
  rep(i , 0 ,m-1){
    G[U[i]].pb({V[i] , i}); 
  }
  vector <int> vec ;
  int v = 0; 
  while(sz(G[v]) <= 2 || sz(vec)){
    vec.pb(v) ;
    if(sz(G[v]) ==0)return false ; 
    v = G[v][0] ;
    if(mark[v] == 1){ok = 1;break;}
    mark[v] = 1;
  }
  return 1 ;

  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:24:5: error: 'G' was not declared in this scope
   24 |     G[U[i]].pb({V[i] , i});
      |     ^
islands.cpp:28:12: error: 'G' was not declared in this scope
   28 |   while(sz(G[v]) <= 2 || sz(vec)){
      |            ^
islands.cpp:14:20: note: in definition of macro 'sz'
   14 | #define sz(a) (int)a.size()
      |                    ^
islands.cpp:32:22: error: 'ok' was not declared in this scope
   32 |     if(mark[v] == 1){ok = 1;break;}
      |                      ^~
islands.cpp:35:10: error: could not convert '1' from 'int' to 'std::variant<bool, std::vector<int, std::allocator<int> > >'
   35 |   return 1 ;
      |          ^
      |          |
      |          int