結果
問題 | No.1374 Absolute Game |
ユーザー |
|
提出日時 | 2022-10-08 10:56:15 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 534 bytes |
コンパイル時間 | 13,877 ms |
コンパイル使用メモリ | 387,340 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-22 10:54:40 |
合計ジャッジ時間 | 15,856 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 6 WA * 20 |
ソースコード
fn main() {let mut n = String::new();std::io::stdin().read_line(&mut n).ok();let n: usize = n.trim().parse().unwrap();let mut c = String::new();std::io::stdin().read_line(&mut c).ok();let mut c: Vec<isize> = c.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();let summary = c.iter().sum::<isize>();c.sort();if summary < 0 { c.reverse(); }let a = c.iter().skip(n/2).sum::<isize>();let b = c.iter().take(n/2).sum::<isize>();println!("{}", a.abs() - b.abs());}