Submission #548698

#TimeUsernameProblemLanguageResultExecution timeMemory
548698ikaurovCrayfish scrivener (IOI12_scrivener)C++14
60 / 100
1098 ms83336 KiB
#pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #include <bits/stdc++.h> using namespace std; #define all(arr) (arr).begin(), (arr).end() #define ll long long #define ld long double #define pb push_back #define sz(x) int((x).size()) #define fi first #define se second #define endl '\n' const int N = 1e6 + 20, LOG = 20; int par[N][LOG]; int dp[N]; string s = "."; void Init(){} void TypeLetter(char c){ int idx = sz(s); dp[idx] = dp[idx - 1] + 1; s.pb(c); par[idx][0] = idx - 1; for (int i = 1; i < LOG; i++) par[idx][i] = par[par[idx][i - 1]][i - 1]; } void UndoCommands(int x){ int idx = sz(s); dp[idx] = dp[max(idx - 1 - x, 0)]; s.pb('#'); par[idx][0] = max(idx - 1 - x, 0); for (int i = 1; i < LOG; i++) par[idx][i] = par[par[idx][i - 1]][i - 1]; } char GetLetter(int pos){ int cur = sz(s) - 1; for (int i = LOG - 1; i >= 0; i--){ if (dp[par[cur][i]] > pos) cur = par[cur][i]; } return s[cur]; } // signed main(){ // ios_base::sync_with_stdio(0); // cin.tie(0); // // cout.precision(20); // Init(); // TypeLetter('a'); // TypeLetter('b'); // GetLetter(1); // TypeLetter('d'); // UndoCommands(2); // UndoCommands(1); // GetLetter(2); // TypeLetter('e'); // UndoCommands(1); // UndoCommands(5); // TypeLetter('c'); // GetLetter(2); // UndoCommands(2); // GetLetter(2); // }

Compilation message (stderr)

scrivener.cpp:2: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    2 | #pragma GCC optimization ("O3")
      | 
scrivener.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    3 | #pragma GCC optimization ("unroll-loops")
      |
#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...