結果
問題 |
No.464 PPAP
|
ユーザー |
|
提出日時 | 2016-12-16 01:00:01 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 952 bytes |
コンパイル時間 | 630 ms |
コンパイル使用メモリ | 110,580 KB |
実行使用メモリ | 94,772 KB |
最終ジャッジ日時 | 2024-06-12 05:38:02 |
合計ジャッジ時間 | 4,595 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 WA * 1 |
ソースコード
import std.stdio; import std.array; import std.string; import std.conv; import std.algorithm; import std.typecons; import std.range; import std.random; import std.math; import std.container; import std.numeric; import std.bigint; import core.bitop; void main() { auto S = readln.chomp; auto N = S.length.to!int; auto LR = new int[][](N); auto P3_left = new int[](N); int left, right; foreach (d; 0..2) foreach (i; 0..N) { left = i; right = i+d; while (left >= 0 && right < N && S[left] == S[right]) { LR[left] ~= right; if (right == N-1) P3_left[left] = 1; left--; right++; } } auto acm = new int[](N+1); foreach (i; 0..N) acm[i+1] = acm[i] + P3_left[i]; int ans; foreach (r1; LR[0]) { if (r1 >= N-3) continue; foreach (r2; LR[r1+1]) { if (r2 >= N-2) continue; ans += acm[N] - acm[r2+2]; } } ans.writeln; }