Submission #1042872

# Submission time Handle Problem Language Result Execution time Memory
1042872 2024-08-03T13:46:23 Z Dan4Life Bit Shift Registers (IOI21_registers) C++17
Compilation error
0 ms 0 KB
#include "dungeons.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
using vi = vector<int>;
using ll = long long;
int n;
const int mxN = (int)4e5+10;
const int mxLg = 23;
int S;

struct jmpNode{
	int loc;
	ll st;
	jmpNode(int x=-1, ll y=0){
		loc=x, st=y;
	}
};

jmpNode jmp[2][mxLg][mxN];

void init(int N, vi s, vi p, vi w, vi l) {
	n = N; S=s[0];
	for(int i = 0; i < n; i++){
		jmp[0][0][i] = jmpNode(l[i],p[i]);
		jmp[1][0][i] = jmpNode(w[i],s[i]);
	}
	jmp[0][0][n]=jmp[1][0][n] = jmpNode(n,0);
	for(int t : {0,1}){
		for(int i = 1; i < mxLg; i++){
			for(int j = 0; j < n; j++){
				jmp[t][i][j].loc = jmp[t][i-1][jmp[t][i-1][j].loc].loc;
				jmp[t][i][j].st = jmp[t][i-1][j].st+jmp[t][i-1][jmp[t][i-1][j].loc].st;
			}
			jmp[t][i][n] = jmpNode(n,0);
		}
	}
}

ll simulate(int x, int z) {
	ll strength = z;
	for(int i = mxLg-1; i>=0; i--)
		if(strength+jmp[0][i][x].st < S) 
			strength+=jmp[0][i][x].st, x=jmp[0][i][x].loc;
	if(strength<S) strength+=jmp[0][0][x].st, x=jmp[0][0][x].loc;
	for(int i = mxLg-1; i>=0; i--)
		if(jmp[1][i][x].loc!=n) 
			strength+=jmp[1][i][x].st, x=jmp[1][i][x].loc;
	if(x!=n) strength+=jmp[1][0][x].st, x=jmp[1][0][x].loc;
	return strength;
}

Compilation message

registers.cpp:1:10: fatal error: dungeons.h: No such file or directory
    1 | #include "dungeons.h"
      |          ^~~~~~~~~~~~
compilation terminated.