Submission #70921

#TimeUsernameProblemLanguageResultExecution timeMemory
70921FLDutchmanCrayfish scrivener (IOI12_scrivener)C++14
0 / 100
208 ms68144 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define fast_io() ios::sync_with_stdio(false) #define FOR(i, l, r) for(int i = (l); i < (r); i++) struct llist{ vector<llist*> lift; char c; int sz = 1; llist (char c) : c(c){} }; int getsz(llist *l) { if(!l) return 0; return l->sz; } llist *insert(llist* l, char c){ llist *nl = new llist(c); nl->sz = getsz(l)+1; if(!l) return nl; int i = 0; while(l->lift.size() > i){ nl->lift.pb(l); l = l->lift[i++]; } return nl; } char getletter(llist *l, int i){ FOR(k, 0, 21) if(i & (1<<k)) l = l->lift[k]; return l->c; } vector <llist*> v; void Init() { v.pb(0); } void TypeLetter(char L) { v.pb(insert(v.back(), L)); } void UndoCommands(int U) { v.pb(v[v.size()-1-U]); } char GetLetter(int P) { auto l = v.back(); return getletter(l, getsz(l)-1 - P); }

Compilation message (stderr)

scrivener.cpp: In function 'llist* insert(llist*, char)':
scrivener.cpp:25:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(l->lift.size() > i){
           ~~~~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...