結果

問題 No.3387 23578 Sequence
コンテスト
ユーザー elphe
提出日時 2025-11-28 22:23:23
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 368 bytes
コンパイル時間 14,046 ms
コンパイル使用メモリ 399,620 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-11-28 22:24:30
合計ジャッジ時間 15,575 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use proconio::{input, fastout};

#[fastout]
fn main() {
	input! {
		n: usize,
		a: [u8; n],
	}
	
	println!("{}", output(solve(n, a)));
}

fn solve(n: usize, a: Vec<u8>) -> bool {
	for i in 0..n {
		if a[i] + a[(n - 1) - i] != a[0] + a[n - 1] {
			return false;
		}
	}
	true
}

fn output(ans: bool) -> &'static str {
	match ans {
		true => "Yes",
		false => "No",
	}
}
0