Submission #115587

# Submission time Handle Problem Language Result Execution time Memory
115587 2019-06-08T09:11:53 Z faustaadp Crayfish scrivener (IOI12_scrivener) C++17
0 / 100
5 ms 640 KB
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
pair<char,int> A[1000001];
short int te,X;
short int p[22][1000001];
short int LO[1000005],ii;
void Init() 
{
	for(ii=1;ii<=1000002;ii++)
		LO[ii]=ceil(log(ii)/log(2));
}
void TypeLetter(char L) 
{
	if(te==0)
		A[te]=mp(L,0);
	else
		A[te]=mp(L,A[te-1].se+1);
	if(te==0)
		p[0][te]=0;
	else
		p[0][te]=te-1;
	for(ii=1;ii<LO[te+1];ii++)
		p[ii][te]=p[ii-1][p[ii-1][te]];
	te++;
}

void UndoCommands(int U) 
{
	A[te]=A[te-U-1];
	p[0][te]=p[0][te-U-1];
	for(ii=1;ii<LO[te+1];ii++)
		p[ii][te]=p[ii-1][p[ii-1][te]];
	te++;
//	cek();
}

char GetLetter(int P) 
{
	X=te-1;
	for(ii=LO[te+1]-1;ii>=0;ii--)
		if(A[p[ii][X]].se>=P)
		{
			if(A[p[ii][X]].se==P)
			{
				X=p[ii][X];
				break;
			}
			X=p[ii][X];
		}
	return A[X].fi;
//	return hai[P];
}
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -