Submission #751986

#TimeUsernameProblemLanguageResultExecution timeMemory
751986minhcoolCrayfish scrivener (IOI12_scrivener)C++17
100 / 100
816 ms103404 KiB
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ll long long #define fi first #define se second #define pb push_back #define mp make_pair typedef pair<int, int> ii; typedef pair<ii, int> iii; typedef pair<ii, ii> iiii; const int N = 1e6 + 5; const int oo = 1e18 + 7, mod = 1e9 + 7; mt19937 rng(1); int n; int cnt; int lst[N][25], len[N]; char cc[N]; void Init(){ cnt = 0; for(int i = 0; i <= 20; i++) lst[0][i] = 0; len[0] = 0; } void TypeLetter(char c){ cnt++; len[cnt] = len[cnt - 1] + 1; cc[cnt] = c; lst[cnt][0] = cnt - 1; for(int i = 1; i <= 20; i++) lst[cnt][i] = lst[lst[cnt][i - 1]][i - 1]; } void UndoCommands(int x){ cnt++; len[cnt] = len[cnt - x - 1]; lst[cnt][0] = lst[cnt - x - 1][0]; cc[cnt] = cc[cnt - x - 1]; for(int i = 1; i <= 20; i++) lst[cnt][i] = lst[lst[cnt][i - 1]][i - 1]; } char GetLetter(int x){ x++; int temp = len[cnt] - x; //if(!temp) return cc[cnt]; int pos = cnt; for(int i = 20; i >= 0; i--) if(temp & (1LL << i)) pos = lst[pos][i]; return cc[pos]; }

Compilation message (stderr)

scrivener.cpp:18:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   18 | const int oo = 1e18 + 7, mod = 1e9 + 7;
      |                ~~~~~^~~
#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...