結果

問題 No.2548 Problem Selection
ユーザー ⁣
提出日時 2024-07-22 12:14:21
言語 Rust
(1.77.0)
結果
RE  
実行時間 -
コード長 378 bytes
コンパイル時間 14,163 ms
コンパイル使用メモリ 389,656 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-22 12:14:39
合計ジャッジ時間 16,735 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
6,816 KB
testcase_01 AC 33 ms
6,816 KB
testcase_02 AC 376 ms
6,940 KB
testcase_03 AC 7 ms
6,940 KB
testcase_04 AC 86 ms
6,940 KB
testcase_05 AC 386 ms
6,944 KB
testcase_06 AC 5 ms
6,944 KB
testcase_07 AC 40 ms
6,940 KB
testcase_08 AC 308 ms
6,940 KB
testcase_09 AC 131 ms
6,944 KB
testcase_10 AC 155 ms
6,944 KB
testcase_11 AC 485 ms
6,944 KB
testcase_12 AC 125 ms
6,944 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 RE -
testcase_15 AC 1 ms
6,944 KB
testcase_16 AC 1 ms
6,944 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 1 ms
6,940 KB
testcase_22 RE -
testcase_23 AC 1 ms
6,940 KB
testcase_24 AC 1 ms
6,944 KB
testcase_25 RE -
testcase_26 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn g() -> Vec<usize> {
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	s.split_whitespace().flat_map(str::parse).collect()
}
fn main() {
	let (n, mut v) = (g(), g());
	v.sort();
	let v: Vec<_> = v.windows(2).map(|a| (a[1] - a[0]).pow(2)).collect();
	println!(
		"{}",
		v.windows(n[1] - 1)
			.map(|a| a.iter().sum::<usize>())
			.min()
			.unwrap()
	)
}
0