結果
| 問題 | No.1617 Palindrome Removal |
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2021-07-22 21:33:07 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 431 bytes |
| 記録 | |
| コンパイル時間 | 1,369 ms |
| コンパイル使用メモリ | 213,604 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-21 22:47:33 |
| 合計ジャッジ時間 | 2,513 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
int main() {
using namespace std;
cin.tie(nullptr)->sync_with_stdio(false);
string s;
cin >> s;
int n = size(s);
if (count(begin(s), end(s), s[0]) == n) {
cout << (n & 1 ? -1 : 0) << '\n';
exit(0);
}
if (s != string(rbegin(s), rend(s))) {
cout << n << '\n';
exit(0);
}
if (n == 3) {
cout << "-1\n";
exit(0);
}
cout << n - 2 << '\n';
}
risujiroh