| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 310739 | ly20 | Palindromic Partitions (CEOI17_palindromic) | C++17 | 1 ms | 384 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10, MOD = 1e9 + 7, P = 29;
string s;
int t;
long long hs[MAXN], pot[MAXN];
long long val(int i, int j) {
    long long resp = hs[i] - (hs[j + 1] * pot[j - i + 1]) % MOD;
    resp += MOD;
    resp %= MOD;
    return resp;
}
int main() {
    scanf("%d", &t);
    while(t--) {
        cin >> s;
        int n = s.size();
        pot[0] = 1;
        for(int i = 1; i <= n; i++) {
            pot[i] = pot[i - 1] * P;
            pot[i] %= MOD;
        }
        hs[n] = 0;
        for(int i = n - 1; i >= 0; i--) {
            hs[i] = hs[i + 1] * P + (s[i] - 'a');
            hs[i] %= MOD;
        }
        int ini1 = 0, fim1 = 0, ini2 = n - 1, fim2 = n - 1;
        int resp = 0;
        while(fim1 < fim2) {
            long long vl1 = val(ini1, fim1), vl2 = val(ini2, fim2);
            if(vl1 == vl2) {
                resp += 2;
                ini1 = fim1 + 1; fim1 = ini1;
                ini2 = fim2 - 1; fim2 = ini2;
            }
            else {
                fim1++; fim2--;
            }
        }
        if(ini1 <= ini2) resp++;
        printf("%d\n", resp);
    }
    return 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... | ||||
