結果
問題 |
No.464 PPAP
|
ユーザー |
|
提出日時 | 2016-12-16 00:15:30 |
言語 | D (dmd 2.109.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 881 bytes |
コンパイル時間 | 800 ms |
コンパイル使用メモリ | 113,216 KB |
実行使用メモリ | 13,752 KB |
最終ジャッジ日時 | 2024-06-12 05:37:57 |
合計ジャッジ時間 | 4,416 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 3 TLE * 1 -- * 18 |
ソースコード
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; alias Tuple!(int, "l", int, "r") kaibun; string S; int N; bool is_kaibun(int l, int r) { foreach (i; 0..(r-l+1)/2) if (S[l+i] != S[r-i]) return false; return true; } void main() { S = readln.chomp; N = S.length.to!int; kaibun[] P1; foreach (i; 0..N) if (is_kaibun(0, i)) P1 ~= kaibun(0, i); kaibun[] P3; foreach (i; 0..N) if (is_kaibun(i, N-1)) P3 ~= kaibun(i, N-1); int ans = 0; foreach (p1; P1) foreach (p3; P3) { if (p3.l - p1.r <= 2) continue; foreach (i; p1.r+1..p3.l-1) if (is_kaibun(p1.r+1, i)) ans++; } ans.writeln; }