結果

問題 No.1974 2x2 Flipper
ユーザー 👑 kakel-sankakel-san
提出日時 2022-06-10 23:46:45
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,375 bytes
コンパイル時間 882 ms
コンパイル使用メモリ 111,056 KB
実行使用メモリ 42,156 KB
最終ジャッジ日時 2023-10-21 05:52:29
合計ジャッジ時間 5,760 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
25,624 KB
testcase_01 AC 45 ms
30,228 KB
testcase_02 AC 32 ms
25,616 KB
testcase_03 AC 118 ms
37,892 KB
testcase_04 AC 67 ms
32,552 KB
testcase_05 WA -
testcase_06 AC 84 ms
34,516 KB
testcase_07 AC 68 ms
32,788 KB
testcase_08 AC 36 ms
27,652 KB
testcase_09 AC 89 ms
34,948 KB
testcase_10 WA -
testcase_11 AC 73 ms
33,840 KB
testcase_12 AC 107 ms
37,140 KB
testcase_13 AC 75 ms
33,752 KB
testcase_14 AC 58 ms
31,896 KB
testcase_15 AC 120 ms
38,208 KB
testcase_16 WA -
testcase_17 AC 93 ms
35,340 KB
testcase_18 AC 39 ms
27,660 KB
testcase_19 AC 38 ms
27,664 KB
testcase_20 AC 65 ms
32,380 KB
testcase_21 AC 155 ms
42,156 KB
testcase_22 AC 150 ms
42,136 KB
testcase_23 AC 154 ms
42,148 KB
testcase_24 AC 163 ms
42,144 KB
testcase_25 AC 29 ms
25,624 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static void Main()
    {
        var c = NList;
        var (h, w) = (c[0], c[1]);
        var res = new int[h][];
        var count = 0;
        for (var i = 0; i < h; ++i)
        {
            res[i] = Enumerable.Repeat(1, w).ToArray();
        }
        if (h % 2 == 0 && w % 2 == 0)
        {
            count = h * w;
        }
        else if (h % 2 == 0)
        {
            for (var i = 0; i < h; ++i) res[i][w - 1] = 0;
            count = h * (w - 1);
        }
        else if (w % 2 == 0)
        {
            for (var j = 0; j < w; ++j) res[h - 1][j] = 0;
            count = (h - 1) * w;
        }
        else if (h <= w)
        {
            for (var i = 0; i < h; ++i) res[i][i] = 0;
            for (var i = h; i < w; ++i) res[h - 1][i] = 0;
            count = h * (w - 1);
        }
        else
        {
            for (var i = 0; i < w; ++i) res[i][i] = 0;
            for (var i = w; i < h; ++i) res[i][w - 1] = 0;
            count = (h - 1) * w;
        }
        if (h == 1 || w == 1) count = 0;
        WriteLine(count);
        WriteLine(string.Join("\n", res.Select(r => string.Join(" ", r))));
    }
}
0