This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("fma,sse,sse2,sse3,avx")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef pair<int, int> pii;
const int MAX = 10001;
const int LOG = 14;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
#define pb push_back
#define sz(x) (int) x.size()
#define fr first
#define sc second
#define mp make_pair
#define all(x) x.begin(), x.end()
#define dbg(x) cout << #x << ": " << "[ " << x << " ]\n"
string s, ans[MAX][LOG];
int query(int I, int K){
if(I + (1 << K) >= sz(s)) return 0;
return s.substr(I, (1 << K)) == ans[I][K];
}
void init(int n, const char S[]){
for(int i = 0; i < n; i++)
s += S[i], ans[i][0] = S[i];
for(int j = 1; j < LOG; j++){
for(int i = 0; i + (1 << j) <= n; i++){
for(int k = 0; k < min(sz(ans[i][j - 1]), sz(ans[i + (1 << (j - 1))][j - 1])); k++){
ans[i][j] += ans[i][j - 1][k];
ans[i][j] += ans[i + (1 << (j - 1))][j - 1][k];
}
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |