# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
972167 | duckindog | Selling RNA Strands (JOI16_selling_rna) | C++17 | 269 ms | 22100 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.
#include <bits/stdc++.h>
using namespace std;
const int N = 5'000 + 10,
base = 19937;
int n, m;
using ull = unsigned long long;
ull pw[N];
struct Hash {
int n;
vector<ull> h;
Hash() {}
Hash(string s) : n(s.size()), h(s.size() + 1) {
pw[0] = 1;
for (int i = 1; i <= n; ++i) {
h[i] = h[i - 1] * base + s[i - 1];
pw[i] = pw[i - 1] * base;
}
}
ull get(int l, int r) { return h[r] - h[l - 1] * pw[r - l + 1]; }
} h[N];
int32_t main() {
cin.tie(0)->sync_with_stdio(0);
cin >> n >> m;
# | 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... |