結果
| 問題 |
No.273 回文分解
|
| コンテスト | |
| ユーザー |
not_522
|
| 提出日時 | 2015-09-08 20:38:54 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 468 bytes |
| コンパイル時間 | 1,597 ms |
| コンパイル使用メモリ | 166,900 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-23 11:56:31 |
| 合計ジャッジ時間 | 2,517 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 WA * 8 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
auto r = s;
reverse(r.begin(), r.end());
const int n = s.size();
set<string> st;
for (int i = 0; i < n; ++i) {
for (int j = 1; i + j <= n && j < n; ++j) st.insert(s.substr(i, j));
}
int res = 0;
for (int i = 0; i < n; ++i) {
for (int j = 1; i + j <= n && j < n; ++j) {
if (st.count(r.substr(i, j))) res = max(res, j);
}
}
cout << res << endl;
}
not_522