제출 #885615

#제출 시각아이디문제언어결과실행 시간메모리
885615Glauco크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++17
100 / 100
694 ms156556 KiB
#include <bits/stdc++.h> using namespace std; int idx = 0; struct node{ char c; vector<int> fat; int size; }; vector<node> v(1e6+5); void Init(){ v[0].c = '0'; v[0].size = 0; } void TypeLetter(char l){ idx++; v[idx].c = l; v[idx].size = v[idx-1].size+1; v[idx].fat.push_back(idx-1); for(int i = 1; 1; i++){ if(i-1 >= v[v[idx].fat[i-1]].fat.size()) break; v[idx].fat.push_back(v[v[idx].fat[i-1]].fat[i-1]); } } void UndoCommands(int u){ idx++; v[idx] = v[idx-u-1]; } char GetLetter(int p){ p = v[idx].size-p-1; int temp = idx; int l = log2(p)+2; for(int i = l; i >= 0; i--){ if((p & (1<<i)) && v[temp].fat.size() > i) temp = v[temp].fat[i]; } return v[temp].c; }

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

scrivener.cpp: In function 'void TypeLetter(char)':
scrivener.cpp:24:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     if(i-1 >= v[v[idx].fat[i-1]].fat.size()) break;
      |        ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:38:43: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   38 |     if((p & (1<<i)) && v[temp].fat.size() > i) temp = v[temp].fat[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...