結果

問題 No.273 回文分解
ユーザー not_522not_522
提出日時 2015-09-08 20:38:54
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 468 bytes
コンパイル時間 1,441 ms
コンパイル使用メモリ 153,496 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-25 00:15:20
合計ジャッジ時間 3,056 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 WA -
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 WA -
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 3 ms
4,376 KB
testcase_28 AC 3 ms
4,376 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 WA -
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0