Submission #104262

# Submission time Handle Problem Language Result Execution time Memory
104262 2019-04-04T14:04:09 Z arman_ferdous Crayfish scrivener (IOI12_scrivener) C++14
60 / 100
1000 ms 91016 KB
// #include "grader.h"
#include <bits/stdc++.h>
using namespace std;

const int N = 1e6+10;
char c[N];
int lev[N];
int cur, freePtr;
int p[N][20], state[N], ptr;

void Init() {
	lev[0] = -1;
	memset(p,-1,sizeof p);
	c[0] = '?';
	cur = 0; freePtr = 1;
	state[0] = cur; ptr = 0;
}

void TypeLetter(char L) {
	int idx = freePtr++;
	p[idx][0] = cur;
	c[idx] = L, lev[idx] = lev[cur] + 1;
	cur = idx;

	for(int j = 1; j < 20; j++)
		if(p[cur][j-1] + 1)
			p[cur][j] = p[p[cur][j-1]][j-1];
	state[++ptr] = cur;
}

void UndoCommands(int U) {
	state[ptr+1] = state[max(0, ptr - U)];
	ptr++;
	cur = state[ptr];
}

char GetLetter(int P) {
	int tmp = cur, need = lev[cur] - P;
	for(int j = 19; j >= 0; j--) 
		if(need >= (1<<j)) {
			need -= (1<<j);
			tmp = p[tmp][j];
		}
	return c[tmp];
}
# Verdict Execution time Memory Grader output
1 Correct 76 ms 78584 KB Output is correct
2 Correct 65 ms 78712 KB Output is correct
3 Correct 67 ms 78584 KB Output is correct
4 Correct 67 ms 78584 KB Output is correct
5 Correct 65 ms 78584 KB Output is correct
6 Correct 68 ms 78700 KB Output is correct
7 Correct 65 ms 78644 KB Output is correct
8 Correct 66 ms 78572 KB Output is correct
9 Correct 63 ms 78712 KB Output is correct
10 Correct 67 ms 78584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 66 ms 78676 KB Output is correct
2 Correct 64 ms 78612 KB Output is correct
3 Correct 64 ms 78584 KB Output is correct
4 Correct 69 ms 78584 KB Output is correct
5 Correct 80 ms 78712 KB Output is correct
6 Correct 77 ms 78560 KB Output is correct
7 Correct 77 ms 78584 KB Output is correct
8 Correct 68 ms 78584 KB Output is correct
9 Correct 67 ms 78532 KB Output is correct
10 Correct 66 ms 78584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 73 ms 78684 KB Output is correct
2 Correct 69 ms 78712 KB Output is correct
3 Correct 78 ms 78744 KB Output is correct
4 Correct 78 ms 78712 KB Output is correct
5 Correct 70 ms 78712 KB Output is correct
6 Correct 69 ms 78712 KB Output is correct
7 Correct 66 ms 78712 KB Output is correct
8 Correct 69 ms 78684 KB Output is correct
9 Correct 69 ms 78712 KB Output is correct
10 Correct 73 ms 78712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 662 ms 84572 KB Output is correct
2 Correct 698 ms 89464 KB Output is correct
3 Correct 439 ms 90076 KB Output is correct
4 Correct 467 ms 91016 KB Output is correct
5 Correct 584 ms 89520 KB Output is correct
6 Correct 412 ms 90164 KB Output is correct
7 Correct 673 ms 89820 KB Output is correct
8 Correct 522 ms 90144 KB Output is correct
9 Correct 700 ms 90288 KB Output is correct
10 Correct 223 ms 89080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 752 ms 84264 KB Output is correct
2 Correct 823 ms 89208 KB Output is correct
3 Correct 458 ms 89664 KB Output is correct
4 Correct 487 ms 90312 KB Output is correct
5 Correct 472 ms 89432 KB Output is correct
6 Correct 510 ms 89308 KB Output is correct
7 Correct 481 ms 89464 KB Output is correct
8 Correct 736 ms 89188 KB Output is correct
9 Execution timed out 1008 ms 89692 KB Time limit exceeded
10 Halted 0 ms 0 KB -