Submission #68426

# Submission time Handle Problem Language Result Execution time Memory
68426 2018-08-17T06:24:37 Z nvmdava Crayfish scrivener (IOI12_scrivener) C++17
Compilation error
0 ms 0 KB
#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

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