Submission #68426

#TimeUsernameProblemLanguageResultExecution timeMemory
68426nvmdavaCrayfish scrivener (IOI12_scrivener)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
char s[1000001];
int now = 0, i = 0, dir[1000001], sz[1000001];
void Init() {}
 
void TypeLetter(char L) {
	s[i] = L;
	dir[i] = now;
	sz[i] = sz[now] + 1;
	now = i;
	i++;
}
 
void UndoCommands(int U) {
	now = i - U - 1;
	s[i] = s[now];
	dir[i] = dir[now];
	sz[i] = sz[now];
	i++;
}
 
char GetLetter(int P) {
	int j = i - 1;
	int s = sz[j] - P - 1;
	while(s--){
		j = dir[j];
	}
	return s[j];
}

Compilation message (stderr)

scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:29:12: error: invalid types 'int[int]' for array subscript
  return s[j];
            ^