Submission #797635

#TimeUsernameProblemLanguageResultExecution timeMemory
797635Joshi503Thousands Islands (IOI22_islands)C++17
Compilation error
0 ms0 KiB
// Source: https://usaco.guide/general/io

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

struct datos{
	bool ok;
	vector<int> v;
};

struct datos find_journey(int N, int M, vector<int> U, vector<int> V){
	if(N == 2){
		datos res;
		res.ok = 0;
		if(M == 1) return res;
		int ida = -1, regreso = -1;
		for(int i = 0; i < m; i++){
			if(U[i] == 0 && V[i] == 1) ida = i;
			if(U[i] == 1 && V[i] == 0) regreso = i;
		}
		if(ida == -1) return res;
		vector<int> x;
		res.ok = 1;
		if(regreso != -1){
			x = {ida, regreso};
			res.v = x;
			return res;
		}
		x = {0, 1, 0};
		res.v = x;
		return res;
	}
}

Compilation message (stderr)

islands.cpp: In function 'datos find_journey(int, int, std::vector<int>, std::vector<int>)':
islands.cpp:17:22: error: 'm' was not declared in this scope
   17 |   for(int i = 0; i < m; i++){
      |                      ^
islands.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]
   33 | }
      | ^