Submission #935667

# Submission time Handle Problem Language Result Execution time Memory
935667 2024-02-29T11:00:44 Z tnun Crayfish scrivener (IOI12_scrivener) C++14
0 / 100
1 ms 856 KB
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
struct node{
	char c;
	int p[20];
	int h;
};
vector<node> trie;
const int N=1000003;
int cur[N];
int current=0;
int curs;
node Add(char L,int par){
	node j;
	j.h=trie[par].h+1;
	j.p[0]=par;
	j.c=L;
	for(int i=1;i<20;i++){
		j.p[i]=trie[j.p[i-1]].p[i-1];
	}
	return j;
}
void TypeLetter(char L){
	cur[current]=trie.size();
	trie.pb(Add(L,curs));
	curs=cur[current];
	current++;
}
void UndoCommands(int S){
	cur[current]=cur[current-S+1];
	curs=cur[current];
	current++;
}
char GetLetter(int idx){
	idx++;
	int v=curs;
	for(int i=19;i>=0;i--){
		if(trie[trie[v].p[i]].h >= idx){
            v=trie[v].p[i];
        }
	}
	return trie[v].c;
}
void Init(){
	node first;
	first.c=0;
	for(int i=0;i<20;i++){
		first.p[i]=0;
	}
	first.h=0;
}

Compilation message

scrivener.cpp: In function 'void Init()':
scrivener.cpp:46:7: warning: variable 'first' set but not used [-Wunused-but-set-variable]
   46 |  node first;
      |       ^~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 856 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 572 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -