제출 #79054

#제출 시각아이디문제언어결과실행 시간메모리
79054TAMREF크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++11
34 / 100
1082 ms102416 KiB
#include <bits/stdc++.h> using namespace std; const int mx = 1e3 + 5; const int lg = 20; struct node{ node(){} node(int c, char x, int i) : c(c),x(x),i(i) { memset(p,-1,sizeof(p)); } int p[lg], c; char x; int i; void show(){ printf("x = %c, i = %d, c = %d\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(0, L, !n ? 0 : N[n-1].i + 1); //puts("f2"); node &x = N[n]; //puts("f3"); x.p[0] = (!n ? -1 : n-1); //puts("f4"); for(int j = 1; j < lg; j++){ printf(""); //printf("j = %d\n",j); if(x.p[j-1] != -1) x.p[j] = N[x.p[j-1]].p[j-1]; else break; } //puts("f5"); x.c = n; //N[n].show(); ++n; } void UndoCommands(int U) { //printf("Undo(%d)\n",U); N.emplace_back(); if(U == n){ N[n] = node(-1, 'U', -1); node &x = N[n]; ++n; return; } node p = N[n - 1 - U]; N[n] = node(p.c, 'U', p.i); node &x = N[n]; x.p[0] = n - 1 - U; for(int j = 1; j < lg; j++){ if(x.p[j-1] != -1) x.p[j] = N[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 N[b.c].x; if(b.p[j] != -1 && N[b.p[j]].i >= P) b = N[b.p[j]]; } //printf("bi : %d\n",b->i); //puts("asdf"); return b.i == P ? N[b.c].x : N[N[b.p[0]].c].x; }

컴파일 시 표준 에러 (stderr) 메시지

scrivener.cpp: In function 'void TypeLetter(char)':
scrivener.cpp:26:14: warning: zero-length gnu_printf format string [-Wformat-zero-length]
     printf("");
              ^
scrivener.cpp:36:18: warning: zero-length gnu_printf format string [-Wformat-zero-length]
         printf("");
                  ^
scrivener.cpp: In function 'void UndoCommands(int)':
scrivener.cpp:52:15: warning: unused variable 'x' [-Wunused-variable]
         node &x = N[n];
               ^
#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...