結果
問題 | No.273 回文分解 |
ユーザー |
|
提出日時 | 2020-05-01 19:35:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 637 bytes |
コンパイル時間 | 1,659 ms |
コンパイル使用メモリ | 170,020 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 15:53:07 |
合計ジャッジ時間 | 2,908 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(int)(n);i++) using namespace std; using ll = long long ; using P = pair<int,int> ; using pll = pair<ll,ll>; constexpr int INF = 1e9; constexpr ll LINF = 1e18; constexpr int MOD = 1000000007; int main(){ string s; cin >> s; int n = s.size(); int mx = 0; for(int i=0;i<n;i++){ for(int j=0;j+i<=n;j++){ if(i==0 &&j==n) continue; string now = s.substr(i,j); string rev = now; reverse(rev.begin(),rev.end()); if(now == rev) mx = max(mx,j); } } cout << mx << endl; return 0; }