Submission #285259

# Submission time Handle Problem Language Result Execution time Memory
285259 2020-08-28T14:03:40 Z TMJN Crayfish scrivener (IOI12_scrivener) C++17
0 / 100
516 ms 69240 KB
int dp[1000000][21];
int len[1000000];
char c[1000000];
int t[1000000];
int cnt;

void Init() {
	
}

void TypeLetter(char L) {
	cnt++;
	len[cnt]=len[cnt-1]+1;
	t[cnt]=cnt;
	c[cnt]=L;
	dp[cnt][0]=t[cnt-1];
	for(int i=0;i<19;i++){
		dp[cnt][i+1]=dp[dp[cnt][i]][i];
	}
}

void UndoCommands(int U) {
	cnt++;
	len[cnt]=len[cnt-U-1];
	t[cnt]=t[cnt-U-1];
	for(int i=0;i<19;i++){
		dp[cnt][i+1]=dp[dp[cnt][i]][i];
	}
}

char GetLetter(int P) {
	P++;
	int p=t[cnt];
	int l=len[p];
	for(int i=20;i>=0;i--){
		if(l-(1<<i)>=P){
			p=dp[p][i];
		}
	}
	return c[p];
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 401 ms 69240 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 516 ms 64504 KB Output isn't correct
2 Halted 0 ms 0 KB -