답안 #62558

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
62558 2018-07-29T06:00:10 Z zetapi 크레이피쉬 글쓰는 기계 (IOI12_scrivener) C++14
0 / 100
1000 ms 56504 KB
#include <bits/stdc++.h>
using namespace std;

#define pb  push_back
#define mp  make_pair
#define ll  long long
#define itr ::iterator 

typedef pair<int,int>  pii;

const int MAX=1e6+9;

vector<char> X;
int ind,tot,arr[MAX],height[MAX],Parent[MAX][22];

void Init() 
{

}

void TypeLetter(char L) 
{
	X.pb(L);
	Parent[++ind][0]=arr[tot++];
	height[ind]=height[Parent[ind][0]]+1;
	for(int A=1;A<21;A++)
		Parent[ind][A]=Parent[Parent[ind][A-1]][A-1];
	arr[tot]=ind;
	return ;
}

void UndoCommands(int U) 
{
	++tot;
	arr[tot]=arr[tot-U-1];
	return ;
}

char GetLetter(int P) 
{
	P++;
	int res=arr[tot];
	for(int A=20;A>=0;A--)
	{
		if(height[Parent[res][A]]>=P)
			res=Parent[res][A];
	}
	//cout<<cur<<" "<<res<<" "<<height[res]<<"\n";
	return X[res];
}

/*signed main()
{
	ios_base::sync_with_stdio(false);

	
	TypeLetter('a');
	TypeLetter('b');
	TypeLetter('d');
	UndoCommands(2);
	UndoCommands(1);
	cout<<GetLetter(2);
	return 0;
}*/
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 938 ms 56504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1059 ms 56504 KB Time limit exceeded
2 Halted 0 ms 0 KB -