Submission #79049

#TimeUsernameProblemLanguageResultExecution timeMemory
79049TAMREFCrayfish scrivener (IOI12_scrivener)C++11
5 / 100
3 ms1460 KiB
#include <bits/stdc++.h> using namespace std; const int mx = 1e3 + 5; const int lg = 20; struct node{ node(){} node(node *c, char x, int i) : c(c),x(x),i(i) {} node *p[lg], *c; char x; int i; void show(){ printf("x = %c, i = %d, c = %p\n",x,i,c); } }; vector<node> N; int n; void Init() { } void TypeLetter(char L) { //printf("Type(%c)\n",L); printf(""); N.emplace_back(); //puts("f1"); N[n] = node(nullptr, L, !n ? 0 : N[n-1].i + 1); //puts("f2"); node &x = N[n]; //puts("f3"); x.p[0] = (!n ? nullptr : &N[n-1]); //puts("f4"); for(int j = 1; j < lg; j++){ printf(""); if(x.p[j-1] != nullptr) x.p[j] = x.p[j-1] -> p[j-1]; else break; } //puts("f5"); x.c = &x; //N[n].show(); ++n; } void UndoCommands(int U) { //printf("Undo(%d)\n",U); N.emplace_back(); node p = N[n - 1 - U]; N[n] = node(p.c, 'U', p.i); node &x = N[n]; x.p[0] = &p; for(int j = 1; j < lg; j++){ if(x.p[j-1]) x.p[j] = x.p[j-1] -> p[j-1]; } //N[n].show(); ++n; } char GetLetter(int P) { //printf("Get(%d)\n",P); node *b = &N[n-1]; if(b->i < P) puts("BAAM!"); for(int j = lg; j >= 0; j--){ if(b->i == P) return b->c->x; if(b->p[j] && b->p[j]->i >= P) b = b->p[j]; } //printf("bi : %d\n",b->i); //puts("asdf"); return b->i == P ? b->c->x : b->p[0]->c->x; }

Compilation message (stderr)

scrivener.cpp: In function 'void TypeLetter(char)':
scrivener.cpp:24:14: warning: zero-length gnu_printf format string [-Wformat-zero-length]
     printf("");
              ^
scrivener.cpp:34:18: warning: zero-length gnu_printf format string [-Wformat-zero-length]
         printf("");
                  ^
#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...