結果
問題 | No.588 空白と回文 |
ユーザー | はまやんはまやん |
提出日時 | 2017-11-03 22:30:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 296 ms / 2,000 ms |
コード長 | 1,319 bytes |
コンパイル時間 | 1,511 ms |
コンパイル使用メモリ | 166,796 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-22 15:55:57 |
合計ジャッジ時間 | 3,576 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<b;i++) #define rrep(i,a,b) for(int i=a;i>=b;i--) #define fore(i,a) for(auto &i:a) #pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } //--------------------------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------------------------- ∧_∧ ∧_∧ (´<_` ) Welcome to My Coding Space! ( ´_ゝ`) / ⌒i / \ | | / / ̄ ̄ ̄ ̄/ | __(__ニつ/ _/ .| .|____ \/____/ (u ⊃ ---------------------------------------------------------------------------------------------------*/ string S; //--------------------------------------------------------------------------------------------------- void _main() { cin >> S; int N = S.length(); int ans = 1; rep(L, 0, N) rep(R, L + 1, N) { int M = R - L + 1; int a = 0; rep(i, 0, M / 2) if (S[L + i] != S[R - i]) a += 2; ans = max(ans, M - a); } cout << ans << endl; }