# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
229776 | tatyam | 회문 (APIO14_palindrome) | C++17 | 303 ms | 23760 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ull = uint64_t;
using u128 = __uint128_t;
using pii = pair<int, int>;
template<class T, class U> bool chmax(T& a, const U& b){ if(a < b){ a = b; return 1; } return 0; }
constexpr ull mod = 0x1fffffffffffffff, base = 257;
struct RollingHash{
const int n;
vector<ull> data, power;
static constexpr ull mul(ull a, ull b){
u128 c = (u128)a * b;
ull ans = ull(c >> 61) + ull(c & mod);
if(ans >= mod) ans -= mod;
return ans;
}
RollingHash(const string& s): n(s.size()), data(n + 1), power(n + 1){
power[0] = 1;
data[0] = 1;
for(int i = 0; i < n; i++){
power[i + 1] = mul(power[i], base);
data[i + 1] = mul(data[i], base) + s[i];
if(data[i + 1] >= mod) data[i + 1] -= mod;
}
}
ull get(int l, int r){
const ull L = mul(data[l], power[r - l]);
const ull R = data[r];
return R - L + (R < L ? mod : 0);
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |