제출 #321616

#제출 시각아이디문제언어결과실행 시간메모리
321616nikatamliani크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++14
100 / 100
579 ms154644 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5, A = 26; int nodes = 0, pos; int code[N][A], par[N][A], depth[N]; char ch[N]; vector<int> v; void TypeLetter(char c) { if(!code[pos][c - 'a']) { code[pos][c - 'a'] = ++nodes; ch[nodes] = c; par[nodes][0] = pos; for(int x = 1; x < A; ++x) { par[nodes][x] = par[par[nodes][x - 1]][x - 1]; } depth[nodes] = depth[pos] + 1; } v.push_back(code[pos][c - 'a']); pos = v.back(); } void UndoCommands(int x) { assert((int)v.size() - 1 - x >= 0); pos = v[(int)v.size() - 1 - x]; v.push_back(pos); } char GetLetter(int index) { int size = depth[pos]; int answer = pos; int up = depth[answer] - (index + 1); for(int i = 0; i < A; ++i) { if(up >> i & 1) { answer = par[answer][i]; } } return ch[answer]; } void Init() { }

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

scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:27:9: warning: unused variable 'size' [-Wunused-variable]
   27 |     int size = depth[pos];
      |         ^~~~
#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...