Submission #1082333

#TimeUsernameProblemLanguageResultExecution timeMemory
1082333CyanberryDungeons Game (IOI21_dungeons)C++17
11 / 100
7087 ms26676 KiB
#include "dungeons.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> strL, pity, winR, lossR;

void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) {
	strL = s;
	pity = p;
	winR = w;
	lossR = l;
	return;
}

long long simulate(int loc, int strIn) {
	long long str = strIn;
	while (loc != strL.size()) {
		if (str >= strL[loc]) {
			str += strL[loc];
			loc = winR[loc];
		} else {
			str += pity[loc];
			loc = lossR[loc];
		}
	}
	return str;
}

Compilation message (stderr)

dungeons.cpp: In function 'long long int simulate(int, int)':
dungeons.cpp:17:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |  while (loc != strL.size()) {
      |         ~~~~^~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...