Submission #310889

# Submission time Handle Problem Language Result Execution time Memory
310889 2020-10-08T11:13:39 Z juggernaut Crayfish scrivener (IOI12_scrivener) C++14
5 / 100
390 ms 51704 KB
#include<bits/stdc++.h>
using namespace std;
int up[1000005][20],depth[1000005],pos[1000005],timer,tmp,v,i;
char res[1000005];
void Init(){}
void TypeLetter(char ch){
    res[++v]=ch;
	up[v][0]=tmp;
	depth[v]=depth[tmp]+1;
	tmp=v;
	pos[++timer]=tmp;
	for(i=1;i<20;i++)up[tmp][i]=up[up[tmp][i-1]][i-1];
}
void UndoCommands(int num){
    pos[++timer]=tmp=pos[timer-1-num];
}
char GetLetter(int p){
    p++;
    int to=tmp;
    for(i=19;i>=0;i--)if(depth[up[to][i]]>=p)to=up[to][i];
    return res[to];
}

Compilation message

scrivener.cpp: In function 'void UndoCommands(int)':
scrivener.cpp:15:9: warning: operation on 'timer' may be undefined [-Wsequence-point]
   15 |     pos[++timer]=tmp=pos[timer-1-num];
      |         ^~~~~~~
scrivener.cpp:15:9: warning: operation on 'timer' may be undefined [-Wsequence-point]
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 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 330 ms 51704 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 390 ms 44152 KB Output isn't correct
2 Halted 0 ms 0 KB -