結果
| 問題 | No.588 空白と回文 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-10-08 23:24:24 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 865 bytes |
| 記録 | |
| コンパイル時間 | 12,722 ms |
| コンパイル使用メモリ | 379,408 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 16:06:37 |
| 合計ジャッジ時間 | 13,972 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 WA * 9 |
ソースコード
#![allow(non_snake_case)]
use std::cmp;
use std::io::{ self, prelude::* };
macro_rules! pick {
($tokens:expr) => {
$tokens.next().unwrap().parse().expect("parse error")
}
}
fn read() -> String {
let mut s = String::new();
io::stdin().read_to_string(&mut s).expect("i/o error");
s
}
fn main() {
let s = read();
let mut tokens = s.split_whitespace();
let S: String = pick!(tokens);
let S: Vec<_> = S.chars().collect();
let mut ans = 0;
for i in 0..S.len() {
let mut cur = 1;
for j in 1.. {
let l = i as i64 - j as i64;
let r = i as i64 + j as i64;
if l < 0 || r >= S.len() as i64 { break; }
if S[l as usize] == S[r as usize] {
cur += 2;
}
}
ans = cmp::max(ans, cur);
}
println!("{}", ans);
}