結果

問題 No.464 PPAP
ユーザー cielciel
提出日時 2016-12-16 00:20:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 724 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 518 ms
コンパイル使用メモリ 53,432 KB
実行使用メモリ 99,456 KB
最終ジャッジ日時 2024-05-07 15:20:41
合計ジャッジ時間 2,222 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 27 ms
23,932 KB
testcase_08 AC 7 ms
22,180 KB
testcase_09 AC 5 ms
21,696 KB
testcase_10 AC 724 ms
99,456 KB
testcase_11 AC 31 ms
81,224 KB
testcase_12 AC 43 ms
96,716 KB
testcase_13 AC 21 ms
96,856 KB
testcase_14 AC 47 ms
96,916 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 1 ms
6,940 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 21 ms
96,452 KB
testcase_24 AC 21 ms
96,480 KB
testcase_25 AC 21 ms
96,312 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
    1 | #import<vector>
      |  ^~~~~~
main.cpp:2:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
    2 | #import<algorithm>
      |  ^~~~~~
main.cpp:3:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
    3 | #import<cstdio>
      |  ^~~~~~
main.cpp:4:44: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | char s[5001];int f[5000][5000],l=0,i=0,j,k;main(){
      |                                            ^~~~

ソースコード

diff #

#import<vector>
#import<algorithm>
#import<cstdio>
char s[5001];int f[5000][5000],l=0,i=0,j,k;main(){
	long long r=0;std::vector<int>H,T;for(scanf("%s",s);s[l];l++);
	for(;i<l;i++)for(k=0;k<2;k++)for(j=0;0<=i-j&&i+j+k<l&&s[i-j]==s[i+j+k];j++)f[i-j][i+j+k]=1;
	for(i=0;i<l;i++){if(f[0][i])H.push_back(i);if(f[i][l-1])T.push_back(i);}
	for(auto&e:H)for(i=e+1;i<l;i++)if(f[e+1][i])r+=T.end()-std::lower_bound(T.begin(),T.end(),i+2);
	printf("%lld\n",r);
}
0