Submission #785647

#TimeUsernameProblemLanguageResultExecution timeMemory
785647MODDI크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
int up[1000005][24], dep[1000005], pos[1000005];
char bukva[1000005];
int cur, i, n;


void Init() {
	n = 0;
	pos[0] = 0;
	dep[0] = -1;
	for(int i = 0; i < 24; i++)	up[0][i] = 0;
}

void TypeLetter(char L) {
	++n;
	pos[n] = n;
	dep[n] = dep[pos[n-1]]+1;
	up[n][0] = pos[n-1];
	for(int i = 1; i < 24; i++)	up[n][i] = up[up[n][i-1]][i-1];
}

void UndoCommands(int U) {
	++n;
	pos[n] = pos[n-1-U];
}

char GetLetter(int P) {
	cur = pos[n];
	for(int i = 23; i >=0; --i){
		if(dep[up[cur][i]] >= P)	cur = up[cur][i];
	}
	return cr[cur];
}

Compilation message (stderr)

scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:33:9: error: 'cr' was not declared in this scope; did you mean 'cur'?
   33 |  return cr[cur];
      |         ^~
      |         cur