Submission #442930

#TimeUsernameProblemLanguageResultExecution timeMemory
442930alan8585Dungeons Game (IOI21_dungeons)C++17
11 / 100
7074 ms21652 KiB
#include "dungeons.h"
#include <iostream>
#include <vector>
#include <bits/stdc++.h>

using namespace std;
vector<int> to[2], S[2];
int N;

void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) {
	N = n;
	for(int i = 0; i < n; i++) {
		S[1].push_back(s[i]);
		S[0].push_back(p[i]);
	}
	for(int i = 0; i < n; i++) {
		to[1].push_back(w[i]);
		to[0].push_back(l[i]);
	}
	return;
}

long long simulate(int x, int z) {
	long long Z = z;
	int cnt = 0;
	while(x != N) {
		bool flag = (S[1][x] <= Z);
		Z += S[flag][x];
		x = to[flag][x];
	}
	return Z;
}

Compilation message (stderr)

dungeons.cpp: In function 'long long int simulate(int, int)':
dungeons.cpp:25:6: warning: unused variable 'cnt' [-Wunused-variable]
   25 |  int cnt = 0;
      |      ^~~
#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...