結果
| 問題 | No.588 空白と回文 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-23 19:31:38 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 260 ms / 2,000 ms |
| + 881µs | |
| コード長 | 492 bytes |
| 記録 | |
| コンパイル時間 | 323 ms |
| コンパイル使用メモリ | 76,712 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-08-23 19:31:49 |
| 合計ジャッジ時間 | 3,244 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
#include <iostream>
#include <cstdio>
using namespace std;
string s;
int n, ans;
int main() {
cin >> s;
n = s.size();
s = ' ' + s;
ans = 0;
for (int i = 1; i <= n; ++i) {
for (int j = i; j <= n; ++j) {
int cnt = 0;
for (int k = i; k <= (i + j) / 2; ++k) {
if (s[k] == s[i + j - k]) cnt += (k == i + j - k ? 1 : 2);
}
ans = max(ans, cnt);
}
}
printf("%d\n", ans);
return 0;
}