結果
| 問題 |
No.2234 palindromer
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-03-22 21:11:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 595 bytes |
| コンパイル時間 | 1,706 ms |
| コンパイル使用メモリ | 161,604 KB |
| 実行使用メモリ | 7,328 KB |
| 最終ジャッジ日時 | 2025-03-22 21:11:59 |
| 合計ジャッジ時間 | 2,422 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 4 WA * 9 |
ソースコード
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF (int)(1e18)
#define maxn 500005
using namespace std;
string s;
int sta[maxn];
int cnt = 0;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> s;
for(int i = 0;i < (int)s.length();++ i){
sta[++ cnt] = i;
while(cnt >= 2 && s[sta[cnt]] == s[sta[cnt - 1]]){
cnt -= 2;
}
}
cout << s;
int top = sta[cnt];
top = min(top,(int)(s.length()) - 2);
for(int i = top;i >= 0;-- i) cout << s[i];
return 0;
}
/*
ABBCDDE
ABBCDDEDDCBBA
*/
vjudge1