結果
問題 | No.1617 Palindrome Removal |
ユーザー |
![]() |
提出日時 | 2021-07-22 21:24:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 605 bytes |
コンパイル時間 | 2,047 ms |
コンパイル使用メモリ | 172,300 KB |
実行使用メモリ | 5,424 KB |
最終ジャッジ日時 | 2024-07-17 16:13:06 |
合計ジャッジ時間 | 3,001 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 18 WA * 2 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define ll long long#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)#define Pr pair<ll,ll>#define Tp tuple<ll,ll,ll>using Graph = vector<vector<int>>;const ll mod = 998244353;int main() {string S; cin >> S;int N = S.size();string T = S;reverse(T.begin(),T.end());if(S!=T){cout << N << endl; return 0;}set<char> ss;rep(i,N){ss.insert(S[i]);}if(ss.size()>1){cout << N-2 << endl; return 0;}if(N%2==0){cout << 0 << endl; return 0;}cout << -1 << endl;}