Submission #70924

#TimeUsernameProblemLanguageResultExecution timeMemory
70924FLDutchmanCrayfish scrivener (IOI12_scrivener)C++14
34 / 100
1092 ms131400 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; //cerr<<getsz(l) << " " << l->lift.size() << endl; int i = 0; while(true){ //cout<<getsz(l)<<endl; nl->lift.pb(l); //cout<<nl->lift.size()<<endl; if(l->lift.size() <= i) return nl; l = l->lift[i++]; } return nl; } char getletter(llist *l, int i){ //cerr<<getsz(l) << " " << l->lift.size() << endl; 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) { //for(auto l : v) cout << getsz(l) << " " << (l ? to_string(l->lift.size()) :"") << endl; 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:30:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(l->lift.size() <= i) return nl;
            ~~~~~~~~~~~~~~~^~~~
#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...