結果
問題 |
No.693 square1001 and Permutation 2
|
ユーザー |
![]() |
提出日時 | 2022-12-20 22:18:38 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 388 bytes |
コンパイル時間 | 14,111 ms |
コンパイル使用メモリ | 390,908 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-18 02:08:59 |
合計ジャッジ時間 | 11,475 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 |
ソースコード
fn main() { let mut xx = String::new(); std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok(); let mut xx: Vec<i64> = xx.split_whitespace().skip(1).flat_map(str::parse).collect(); xx.sort_unstable(); let answer = xx .iter() .enumerate() .map(|(i, &x)| (x - i as i64 - 1).abs()) .sum::<i64>(); println!("{answer}"); }