結果
| 問題 |
No.1974 2x2 Flipper
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-06-10 23:46:45 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,375 bytes |
| コンパイル時間 | 989 ms |
| コンパイル使用メモリ | 107,648 KB |
| 実行使用メモリ | 35,968 KB |
| 最終ジャッジ日時 | 2024-09-21 07:02:11 |
| 合計ジャッジ時間 | 5,871 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 22 WA * 3 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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))));
}
}