Submission #115596

# Submission time Handle Problem Language Result Execution time Memory
115596 2019-06-08T09:20:01 Z faustaadp Crayfish scrivener (IOI12_scrivener) C++17
0 / 100
18 ms 7424 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];
int te,X;
int p[19][1000001],ii;
void Init() 
{
	return ;
	//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);
		p[0][te]=0;
	}
	else
	{
		A[te]=mp(L,A[te-1].se+1);
		p[0][te]=te-1;
		for(ii=1;ii<19;ii++)
			p[ii][te]=p[ii-1][p[ii-1][te]];
	}
	te++;
	return ;
}

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

char GetLetter(int P) 
{
	X=te-1;
	for(ii=18;ii>=0;ii--)
		if(A[p[ii][X]].se>P)
			X=p[ii][X];
		else
		if(A[p[ii][X]].se==P)
			return A[p[ii][X]].fi;
}

Compilation message

scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:54:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 512 KB Output is correct
2 Incorrect 3 ms 512 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 768 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 768 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 18 ms 7424 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 17 ms 7296 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -