Submission #37535614


Source Code Expand

use proconio::{input, fastout};

#[fastout]
fn main() {
    // input
    input!{h: usize, w: usize, a: [[usize; w]; h]}

    let mut b = vec![vec![0; w]; h];
    let mut sum_columns = vec![0; w];
    let mut sum_rows = vec![0; h];

    for i in 0..h {
        for j in 0..w {
            sum_rows[i] += a[i][j];
            sum_columns[j] += a[i][j];
        }
    }

    for i in 0..h {
        for j in 0..w {
            b[i][j] = sum_columns[j] + sum_rows[i] - a[i][j];
            print!("{} ", b[i][j]);
        }
        print!("\n");
    }
}

Submission Info

Submission Time
Task 004 - Cross Sum(★2)
User cohsh
Language Rust (1.42.0)
Score 2
Code Size 550 Byte
Status AC
Exec Time 354 ms
Memory 102596 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 5 ms 2188 KiB
hand02.txt AC 2 ms 2376 KiB
hand03.txt AC 3 ms 2140 KiB
hand04.txt AC 354 ms 102596 KiB
random01.txt AC 41 ms 8616 KiB
random02.txt AC 131 ms 35332 KiB
random03.txt AC 86 ms 21868 KiB
random04.txt AC 106 ms 28352 KiB
random05.txt AC 7 ms 2208 KiB
random06.txt AC 33 ms 6540 KiB
random07.txt AC 314 ms 90424 KiB
random08.txt AC 76 ms 18728 KiB
sample_01.txt AC 4 ms 2180 KiB
sample_02.txt AC 2 ms 2168 KiB
sample_03.txt AC 1 ms 2040 KiB
sample_04.txt AC 1 ms 2068 KiB