結果

問題 No.765 ukuku 2
ユーザー ei1333333ei1333333
提出日時 2018-10-30 01:22:39
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 834 bytes
コンパイル時間 3,663 ms
コンパイル使用メモリ 199,264 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-26 19:57:19
合計ジャッジ時間 7,661 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;
using pi = pair< int, int >;


int main() {
  string s;
  cin >> s;
  int ret = 0;
  for(int i = 0; i < s.size(); i++) {
    {
      int j = i - 1, k = i + 1, match = 0;
      while(j >= 0 && k < s.size() && s[j] == s[k]) {
        match += 2;
        --j;
        ++k;
      }
      ret = max(ret, match);
    }
    if(i - 1 >= 0) {
      int j = i - 2, k = i + 1, match = 1;
      while(j >= 0 && k < s.size() && s[j] == s[k]) {
        match += 2;
        --j;
        ++k;
      }
      ret = max(ret, match);
    }
    if(i + 1 < s.size()) {
      int j = i - 1, k = i + 2, match = 1;
      while(j >= 0 && k < s.size() && s[j] == s[k]) {
        match += 2;
        --j;
        ++k;
      }
      ret = max(ret, match);
    }
  }
  cout << ret << endl;
}
0