結果
問題 |
No.1617 Palindrome Removal
|
ユーザー |
![]() |
提出日時 | 2021-07-22 21:23:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 603 bytes |
コンパイル時間 | 1,739 ms |
コンパイル使用メモリ | 172,200 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-17 16:11:27 |
合計ジャッジ時間 | 2,926 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 3 |
other | AC * 2 WA * 18 |
ソースコード
#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 << 0 << endl; return 0; } set<char> ss; rep(i,N){ ss.insert(S[i]); } if(ss.size()>1){ cout << 2 << endl; return 0; } if(N%2==0){ cout << N << endl; return 0; } cout << -1 << endl; }