제출 #885608

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

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

scrivener.cpp: In function 'void TypeLetter(char)':
scrivener.cpp:23:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     if(i-1 >= v[v[idx].str[i-1]].str.size()) break;
      |        ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scrivener.cpp:29:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     if(i-1 >= v[v[idx].hist[i-1]].hist.size()) break;
      |        ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scrivener.cpp: In function 'void UndoCommands(int)':
scrivener.cpp:41:44: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   41 |     if((u & (1<<i)) && v[temp].hist.size() > i) temp = v[temp].hist[i];
      |                        ~~~~~~~~~~~~~~~~~~~~^~~
scrivener.cpp:47:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |     if(i-1 >= v[v[idx].hist[i-1]].hist.size()) break;
      |        ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scrivener.cpp:49:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |     if(i < v[idx].hist.size()) v[idx].hist[i] = v[v[idx].hist[i-1]].hist[i-1];
      |        ~~^~~~~~~~~~~~~~~~~~~~
scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:61:43: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   61 |     if((p & (1<<i)) && v[temp].str.size() > i) temp = v[temp].str[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...