Submission #1769048
Source Code Expand
fn main() { let (w, h) = get::tuple::<usize,usize>(); let ps = get::vals::<usize>(w); let qs = get::vals::<usize>(h); let trunk = ps.iter().sum::<usize>() + qs.iter().sum::<usize>(); let mut branch = 0; for i in 0 .. w { for j in 0 .. h { branch += std::cmp::min(ps[i], qs[j]) } } println!("{}", trunk + branch) } #[allow(dead_code)] mod get { use std::io::*; use std::str::*; pub fn val<T: FromStr>() -> T { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); buf.trim_right().parse::<T>().ok().unwrap() } pub fn vals<T: FromStr>(n: usize) -> Vec<T> { let mut vec: Vec<T> = vec![]; for _ in 0 .. n { vec.push(val()); } vec } pub fn tuple<T1: FromStr, T2: FromStr>() -> (T1, T2) { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); let mut it = buf.trim_right().split_whitespace(); let x = it.next().unwrap().parse::<T1>().ok().unwrap(); let y = it.next().unwrap().parse::<T2>().ok().unwrap(); (x, y) } pub fn tuples<T1: FromStr, T2: FromStr>(n: usize) -> Vec<(T1, T2)> { let mut vec: Vec<(T1, T2)> = vec![]; for _ in 0 .. n { vec.push(tuple()); } vec } pub fn tuple3<T1: FromStr, T2: FromStr, T3: FromStr>() -> (T1, T2, T3) { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); let mut it = buf.trim_right().split_whitespace(); let x = it.next().unwrap().parse::<T1>().ok().unwrap(); let y = it.next().unwrap().parse::<T2>().ok().unwrap(); let z = it.next().unwrap().parse::<T3>().ok().unwrap(); (x, y, z) } pub fn tuple3s<T1: FromStr, T2: FromStr, T3: FromStr>(n: usize) -> Vec<(T1, T2, T3)> { let mut vec: Vec<(T1, T2, T3)> = vec![]; for _ in 0 .. n { vec.push(tuple3()); } vec } pub fn list<T: FromStr>() -> Vec<T> { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect() } pub fn lists<T: FromStr>(h: usize) -> Vec<Vec<T>> { let mut mat: Vec<Vec<T>> = vec![]; for _ in 0 .. h { mat.push(list()); } mat } pub fn chars() -> Vec<char> { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); buf.trim_right().chars().collect() } }
Submission Info
Submission Time | |
---|---|
Task | C - Gr-idian MST |
User | aimy |
Language | Rust (1.15.1) |
Score | 0 |
Code Size | 2534 Byte |
Status | TLE |
Exec Time | 2103 ms |
Memory | 6396 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 500 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | TLE | 2103 ms | 6396 KB |
02.txt | TLE | 2103 ms | 6396 KB |
03.txt | TLE | 2103 ms | 6396 KB |
04.txt | TLE | 2103 ms | 6396 KB |
05.txt | TLE | 2103 ms | 6396 KB |
06.txt | TLE | 2103 ms | 6396 KB |
07.txt | TLE | 2103 ms | 6396 KB |
08.txt | TLE | 2103 ms | 6396 KB |
09.txt | TLE | 2103 ms | 6396 KB |
10.txt | TLE | 2103 ms | 6396 KB |
11.txt | TLE | 2103 ms | 6396 KB |
12.txt | TLE | 2103 ms | 6396 KB |
13.txt | TLE | 2103 ms | 6396 KB |
14.txt | TLE | 2103 ms | 6396 KB |
15.txt | TLE | 2103 ms | 6396 KB |
16.txt | AC | 17 ms | 4352 KB |
17.txt | AC | 17 ms | 4352 KB |
18.txt | AC | 17 ms | 4352 KB |
19.txt | AC | 17 ms | 4352 KB |
20.txt | TLE | 2103 ms | 6396 KB |
21.txt | TLE | 2103 ms | 6396 KB |
22.txt | TLE | 2103 ms | 6396 KB |
23.txt | TLE | 2103 ms | 6396 KB |
24.txt | TLE | 2103 ms | 6396 KB |
25.txt | AC | 2 ms | 4352 KB |
26.txt | AC | 2 ms | 4352 KB |
27.txt | AC | 2 ms | 4352 KB |
28.txt | AC | 2 ms | 4352 KB |
s1.txt | AC | 2 ms | 4352 KB |
s2.txt | AC | 2 ms | 4352 KB |