結果
| 問題 | No.1617 Palindrome Removal |
| コンテスト | |
| ユーザー |
👑 Nachia
|
| 提出日時 | 2021-07-22 22:07:05 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 2,000 ms |
| コード長 | 547 bytes |
| 記録 | |
| コンパイル時間 | 825 ms |
| コンパイル使用メモリ | 92,280 KB |
| 実行使用メモリ | 6,432 KB |
| 最終ジャッジ日時 | 2026-06-21 23:34:41 |
| 合計ジャッジ時間 | 1,689 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
int main(){
string S; cin >> S;
string rS = S;
reverse(S.begin(),S.end());
if(S != rS){
cout << S.size() << "\n";
return 0;
}
if(S == string(S.size(),S[0])){
if(S.size() % 2 == 0) cout << "0\n";
else cout << "-1\n";
return 0;
}
if(S.size() == 3){
cout << "-1\n";
return 0;
}
cout << (S.size() - 2) << "\n";
return 0;
}
Nachia