# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
974511 | kilkuwu | Palindromes (APIO14_palindrome) | C++17 | 530 ms | 57820 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>
#define nl '\n'
#ifdef LOCAL
#include "template/debug.hpp"
#else
#define dbg(...) ;
#define timer(...) ;
#endif
namespace hash {
using u64 = uint64_t;
using u32 = uint32_t;
constexpr int kSeed = -1; // change this to fixed seed for predictable base
constexpr u64 kAlpha = 1000000007; // the value is from 0 -> kAlphabet - 1
constexpr u64 kMod = (1ULL << 61) - 1;
static_assert(kMod - kAlpha > 2);
// randomly getting an odd base from kAlpha + 1 -> kMod - 1
u64 get_random_base(u64 not_this = -1) {
std::mt19937_64 h_rng(
kSeed == -1
? std::chrono::high_resolution_clock::now().time_since_epoch().count()
: kSeed);
auto rd = std::uniform_int_distribution<u64>(kAlpha + 2, kMod - 1);
u64 base = rd(h_rng);
base -= base % 2 == 0;
while (base == not_this) {
base = rd(h_rng);
base -= base % 2 == 0;
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |