Submission #50516543


Source Code Expand

use proconio::input;

fn main() {
    input! {
        h: usize,
        w: usize,
        a: [[usize; w]; h],
    };
    let rows = a
        .iter()
        .map(|r| r.iter().sum::<usize>())
        .collect::<Vec<usize>>();
    let cols = (0..w)
        .map(|j| (0..h).map(|i| a[i][j]).sum::<usize>())
        .collect::<Vec<usize>>();
    for i in 0..h {
        for j in 0..w {
            let ans = rows[i] + cols[j] - a[i][j];
            print!("{}{}", ans, if j == w - 1 { "\n" } else { " " });
        }
    }
}

Submission Info

Submission Time
Task 004 - Cross Sum(★2)
User bouzuya
Language Rust (rustc 1.70.0)
Score 2
Code Size 523 Byte
Status AC
Exec Time 322 ms
Memory 71252 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 2 / 2
Status
AC × 4
AC × 16
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All hand01.txt, hand02.txt, hand03.txt, hand04.txt, random01.txt, random02.txt, random03.txt, random04.txt, random05.txt, random06.txt, random07.txt, random08.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Case Name Status Exec Time Memory
hand01.txt AC 1 ms 2004 KiB
hand02.txt AC 3 ms 2000 KiB
hand03.txt AC 1 ms 2072 KiB
hand04.txt AC 322 ms 71252 KiB
random01.txt AC 25 ms 5932 KiB
random02.txt AC 104 ms 24544 KiB
random03.txt AC 62 ms 15344 KiB
random04.txt AC 82 ms 19724 KiB
random05.txt AC 2 ms 2192 KiB
random06.txt AC 17 ms 4584 KiB
random07.txt AC 282 ms 62748 KiB
random08.txt AC 56 ms 12868 KiB
sample_01.txt AC 1 ms 1912 KiB
sample_02.txt AC 1 ms 1884 KiB
sample_03.txt AC 0 ms 2000 KiB
sample_04.txt AC 0 ms 1924 KiB