結果

問題 No.464 PPAP
ユーザー cielciel
提出日時 2016-12-16 00:11:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 619 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 617 ms
コンパイル使用メモリ 53,248 KB
実行使用メモリ 27,264 KB
最終ジャッジ日時 2024-05-07 15:20:30
合計ジャッジ時間 1,942 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 22 ms
7,680 KB
testcase_08 AC 5 ms
7,680 KB
testcase_09 AC 4 ms
7,168 KB
testcase_10 AC 619 ms
27,264 KB
testcase_11 AC 16 ms
21,120 KB
testcase_12 AC 27 ms
26,752 KB
testcase_13 AC 8 ms
26,752 KB
testcase_14 AC 31 ms
27,008 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 8 ms
23,296 KB
testcase_24 AC 8 ms
23,168 KB
testcase_25 AC 8 ms
23,168 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>
      |  ^~~~~~

ソースコード

diff #

#import<vector>
#import<algorithm>
#import<cstdio>
char s[5001];
bool f[5000][5000];
int main(){
	long long r=0;
	scanf("%s",s);
	int l=0;for(;s[l];l++);
	for(int i=0;i<l;i++)for(int k=0;k<2;k++){
		for(int j=0;0<=i-j&&i+j+k<l;j++){
			if(s[i-j]!=s[i+j+k])break;
			f[i-j][i+j+k]=true;
		}
	}
	std::vector<int>H,T;
	for(int 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(int 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