제출 #1003773

#제출 시각아이디문제언어결과실행 시간메모리
1003773ByeWorld크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++14
100 / 100
288 ms98420 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back #define fi first #define se second #define lf (id<<1) #define rg ((id<<1)|1) #define md ((l+r)>>1) #define ld long double using namespace std; typedef pair<int,int> pii; typedef pair<pii, int> ipii; const int MAXN = 1e6+10; const int LOG = 20; const int MOD = 998244353; const int SQRT = 450; const vector<int> NOL = {}; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const vector<int> dx = {1, -1, 0, 0}; const vector<int> dy = {0, 0, 1, -1}; int anc[MAXN][LOG+3]; char val[MAXN]; int siz[MAXN]; int nw = 0; void Init(){} void TypeLetter(char L) { nw++; val[nw] = L; anc[nw][0] = nw-1; siz[nw] = siz[nw-1]+1; for(int i=1; i<LOG; i++){ anc[nw][i] = anc[ anc[nw][i-1] ][i-1]; } // cout << nw << ' ' << val[nw] << "nw\n"; } void UndoCommands(int U) { nw++; val[nw] = val[nw-U-1]; siz[nw] = siz[nw-U-1]; for(int i=0; i<LOG; i++){ anc[nw][i] = anc[nw-U-1][i]; } } char GetLetter(int P) { int up = siz[nw]-P-1; int ret = nw; for(int i=LOG-1; i>=0; i--){ if((up>>i) & 1) ret = anc[ret][i]; } return val[ret]; }
#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...