Submission #797636

#TimeUsernameProblemLanguageResultExecution timeMemory
797636Joshi503Thousands Islands (IOI22_islands)C++17
0 / 100
2 ms468 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:33:1: warning: control reaches end of non-void function [-Wreturn-type]
   33 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...