Submission #68473

# Submission time Handle Problem Language Result Execution time Memory
68473 2018-08-17T07:55:51 Z nvmdava Crayfish scrivener (IOI12_scrivener) C++17
0 / 100
1000 ms 600 KB
#include <bits/stdc++.h>
using namespace std;
char s[1000001];
int now = 0, i = 1, dir[1000001][21], sz[1000001];
void Init() {}

int find(int i, int x){
	if(sz[i] == x){
		return i;
	}
	int l = 0, r = 20;
	while(l + 1 != r){
		int m = (l + r) / 2;
		if(sz[i] - (1 << m) < x){
			r = x;
		} else {
			l = x;
		}
	}
	return find(dir[i][l], x);
}

void TypeLetter(char L) {
	s[i] = L;
	dir[i][0] = now;
	sz[i] = sz[now] + 1;
	for(int j = 0; j < 21; j++){
		if(sz[i] <= (1 << j)) break;
		dir[i][j] = find(now, sz[i] - (1 << j));
	}
	now = i;
	i++;
}
 
void UndoCommands(int U) {
	now = i - U - 1;
	s[i] = s[now];
	for(int j = 0; j <= 20; j++)dir[i][j] = dir[now][j];
	sz[i] = sz[now];
	i++;
}

char GetLetter(int P) {
	return s[find(i - 1, P + 1)];
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 488 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 488 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 600 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 600 KB Time limit exceeded
2 Halted 0 ms 0 KB -