Created
June 1, 2021 01:18
-
-
Save sakapon/d7ef676e6c6bfc893408bf7361448890 to your computer and use it in GitHub Desktop.
競プロ典型 90 問 / Q004
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
class Q004 | |
{ | |
static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse); | |
static (int, int) Read2() { var a = Read(); return (a[0], a[1]); } | |
static void Main() | |
{ | |
var (h, w) = Read2(); | |
var a = Array.ConvertAll(new bool[h], _ => Read()); | |
var si = new int[h]; | |
var sj = new int[w]; | |
for (int i = 0; i < h; i++) | |
for (int j = 0; j < w; j++) | |
{ | |
si[i] += a[i][j]; | |
sj[j] += a[i][j]; | |
} | |
for (int i = 0; i < h; i++) | |
for (int j = 0; j < w; j++) | |
a[i][j] = si[i] + sj[j] - a[i][j]; | |
foreach (var r in a) | |
Console.WriteLine(string.Join(" ", r)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://atcoder.jp/contests/typical90/submissions/23103210