結果
| 問題 |
No.273 回文分解
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-22 02:01:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 719 bytes |
| コンパイル時間 | 2,682 ms |
| コンパイル使用メモリ | 196,040 KB |
| 最終ジャッジ日時 | 2025-01-09 09:30:31 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 28 WA * 4 |
ソースコード
#include<bits/stdc++.h>
using lint=long long;
int main(){
std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
std::string s;std::cin>>s;
{
std::string swp="$";
for(char c:s){
swp.push_back(c);
swp.push_back('$');
}
swp.swap(s);
}
lint n=s.length();
std::vector<lint>a(n);
for(lint i=0,j=0;i<n;){
for(;0<=i-j&&i+j<n&&s.at(i-j)==s.at(i+j);j++);
a.at(i)=j;
lint k=1;
for(;0<=i-k&&k+a.at(i-k)<j;k++){
a.at(i+k)=a.at(i-k);
}
i+=k,j-=k;
}
std::cout<<*std::max_element(a.begin(),a.end())-1<<'\n';
}
ngtkana