Submission #633660

#TimeUsernameProblemLanguageResultExecution timeMemory
633660flappybirdThousands Islands (IOI22_islands)C++17
Compilation error
0 ms0 KiB
#include "islands.h"

#include <bits/stdc++.h>
using namespace std;

#define MAX 101010

int deg[MAX];
vector<int> adj[MAX];
vector<int> radj[MAX];
int chk[MAX];
int N, M;

variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) {
	int i;
	::N = N;
	::M = M;
	for (i = 0; i < M; i++) deg[U[i]]++, adj[U[i]].push_back(V[i]), radj[V[i]].push_back(U[i]);
	queue<int> q;
	for (i = 0; i < N; i++) if (!deg[i]) q.push(i);

	while (q.size()) {
		int t = q.front();
		q.pop();
		chk[t] = 1;
		for (auto v : radj[t]) if (!chk[v]) {
			deg[v]--;
			if (deg[v] == 0) q.push(v);
		}
	}
	if (chk[0]) return false;
	else return vector<int>() { 4, 6, 3, 4 });
}

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:32:27: error: expected ';' before '{' token
   32 |  else return vector<int>() { 4, 6, 3, 4 });
      |                           ^~
      |                           ;
islands.cpp:32:2: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   32 |  else return vector<int>() { 4, 6, 3, 4 });
      |  ^~~~
islands.cpp:32:28: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   32 |  else return vector<int>() { 4, 6, 3, 4 });
      |                            ^
islands.cpp:32:30: warning: left operand of comma operator has no effect [-Wunused-value]
   32 |  else return vector<int>() { 4, 6, 3, 4 });
      |                              ^
islands.cpp:32:36: warning: right operand of comma operator has no effect [-Wunused-value]
   32 |  else return vector<int>() { 4, 6, 3, 4 });
      |                                    ^
islands.cpp:32:39: warning: right operand of comma operator has no effect [-Wunused-value]
   32 |  else return vector<int>() { 4, 6, 3, 4 });
      |                                       ^
islands.cpp:32:40: error: expected ';' before '}' token
   32 |  else return vector<int>() { 4, 6, 3, 4 });
      |                                        ^~
      |                                        ;
islands.cpp:32:41: warning: right operand of comma operator has no effect [-Wunused-value]
   32 |  else return vector<int>() { 4, 6, 3, 4 });
      |                                         ^
islands.cpp:32:42: error: expected primary-expression before ')' token
   32 |  else return vector<int>() { 4, 6, 3, 4 });
      |                                          ^