# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
356096 | parsabahrami | Three Friends (BOI14_friends) | C++17 | 212 ms | 34796 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Call my Name and Save me from The Dark
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
#define SZ(x) (int) x.size()
#define F first
#define S second
const int N = 2e6 + 10, MOD[] = {696969569, (int) 1e9 + 9};
int n, H[2][N], pw[2][N], base = 70; char S[N]; vector<int> R;
pii get(int l, int r) {
if (r < l) return {0, 0};
pii h;
h.F = (H[0][r] - 1ll * H[0][l - 1] * pw[0][r - l + 1] % MOD[0] + MOD[0]) % MOD[0];
h.S = (H[1][r] - 1ll * H[1][l - 1] * pw[1][r - l + 1] % MOD[1] + MOD[1]) % MOD[1];
return h;
}
int main() {
pw[0][0] = pw[1][0] = 1;
for (int i = 1; i < N; i++) for (int j = 0; j < 2; j++) pw[j][i] = 1ll * base * pw[j][i - 1] % MOD[j];
scanf("%d%s", &n, S + 1);
if (n % 2 == 0) return !printf("NOT POSSIBLE\n");
for (int i = 1; i <= n; i++) {
for (int j = 0; j < 2; j++) H[j][i] = (1ll * H[j][i - 1] * base % MOD[j] + S[i] - 'A' + 1) % MOD[j];
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |