Submission #797621

#TimeUsernameProblemLanguageResultExecution timeMemory
797621OspleiThousands Islands (IOI22_islands)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
 
using namespace std;
 
typedef pair<int,int> ii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii; 
typedef vector<vii> wgraf;
typedef pair<int,ii> edge;
typedef vector <ll> vl;
typedef pair <ll, ll> LL;
typedef vector <LL> vll;
 
#define UNVISITED 0
#define VISITED 1
#define pb push_back
#define F first
#define S second

struct nodo{
	int v, id;
};

variant <bool, vector <int>> find_journey(int N, int M, int[] U, int[] V){
	
	vector <int> ans;
	
	if (N==2){

		int cont0=0, cont1=0;
			
		vector <nodo> grafo[N+5];

		for (ll i=0; i<m; i++) {
			grafo[U[i]].pb({V[i], i});
			
			if (U[i]==0) cont0++;
			else cont1++;
		}

		if (cont0>=2 && cont1>=1){

			ans.pb(grafo[0][0].id);
			ans.pb(grafo[1][0].id);
			ans.pb(grafo[0][1].id);
			ans.pb(grafo[0][0].id);
			ans.pb(grafo[1][0].id);
			ans.pb(grafo[0][1].id);

		} else return vector <int> ans;

	} else return ans;
}

Compilation message (stderr)

islands.cpp:26:63: error: expected ',' or '...' before 'U'
   26 | variant <bool, vector <int>> find_journey(int N, int M, int[] U, int[] V){
      |                                                               ^
islands.cpp: In function 'std::variant<bool, std::vector<int, std::allocator<int> > > find_journey(int, int, int*)':
islands.cpp:36:18: error: 'm' was not declared in this scope
   36 |   for (ll i=0; i<m; i++) {
      |                  ^
islands.cpp:37:10: error: 'U' was not declared in this scope
   37 |    grafo[U[i]].pb({V[i], i});
      |          ^
islands.cpp:37:20: error: 'V' was not declared in this scope
   37 |    grafo[U[i]].pb({V[i], i});
      |                    ^
islands.cpp:52:30: error: expected primary-expression before 'ans'
   52 |   } else return vector <int> ans;
      |                              ^~~
islands.cpp:52:29: error: expected ';' before 'ans'
   52 |   } else return vector <int> ans;
      |                             ^~~~
      |                             ;
islands.cpp:52:30: warning: statement has no effect [-Wunused-value]
   52 |   } else return vector <int> ans;
      |                              ^~~