Submission #1695351
Source Code Expand
use std::io; use std::cmp; fn main() { let n: i64 = next_int(); let k: i64 = next_int(); let x: Vec<i64> = next_vec(); let ans: i64 = x.into_iter().map(|i| cmp::min(i * 2, (k - i) * 2)).sum(); println!("{}", ans); } fn next_int() -> i64 { let mut buf = String::new(); io::stdin().read_line(&mut buf).unwrap(); buf.trim().parse().unwrap() } fn next_vec() -> Vec<i64> { let mut buf = String::new(); io::stdin().read_line(&mut buf).unwrap(); buf.split_whitespace().map(|n| n.parse().unwrap()).collect() }
Submission Info
Submission Time | |
---|---|
Task | B - Collecting Balls (Easy Version) |
User | nicklaw296 |
Language | Rust (1.15.1) |
Score | 200 |
Code Size | 575 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 4352 KB |
Compile Error
warning: unused variable: `n`, #[warn(unused_variables)] on by default --> ./Main.rs:5:9 | 5 | let n: i64 = next_int(); | ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | subtask0_0.txt, subtask0_1.txt, subtask0_2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, subtask0_0.txt, subtask0_1.txt, subtask0_2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 2 ms | 4352 KB |
02.txt | AC | 2 ms | 4352 KB |
03.txt | AC | 2 ms | 4352 KB |
04.txt | AC | 2 ms | 4352 KB |
05.txt | AC | 2 ms | 4352 KB |
06.txt | AC | 2 ms | 4352 KB |
07.txt | AC | 2 ms | 4352 KB |
subtask0_0.txt | AC | 2 ms | 4352 KB |
subtask0_1.txt | AC | 2 ms | 4352 KB |
subtask0_2.txt | AC | 2 ms | 4352 KB |