結果

問題 No.2432 Flip and Move
ユーザー 👑 kakel-sankakel-san
提出日時 2023-08-18 23:18:08
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 312 ms / 2,000 ms
コード長 1,390 bytes
コンパイル時間 4,114 ms
コンパイル使用メモリ 107,264 KB
実行使用メモリ 77,952 KB
最終ジャッジ日時 2024-05-06 05:59:03
合計ジャッジ時間 8,649 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
18,944 KB
testcase_01 AC 30 ms
18,944 KB
testcase_02 AC 71 ms
23,296 KB
testcase_03 AC 312 ms
77,952 KB
testcase_04 AC 59 ms
27,392 KB
testcase_05 AC 58 ms
27,392 KB
testcase_06 AC 50 ms
23,040 KB
testcase_07 AC 209 ms
58,368 KB
testcase_08 AC 221 ms
61,696 KB
testcase_09 AC 308 ms
76,032 KB
testcase_10 AC 57 ms
21,632 KB
testcase_11 AC 63 ms
22,016 KB
testcase_12 AC 53 ms
20,992 KB
testcase_13 AC 59 ms
24,960 KB
testcase_14 AC 92 ms
34,688 KB
testcase_15 AC 261 ms
68,352 KB
testcase_16 AC 50 ms
22,144 KB
testcase_17 AC 69 ms
24,960 KB
testcase_18 AC 42 ms
20,736 KB
testcase_19 AC 61 ms
23,680 KB
testcase_20 AC 69 ms
26,112 KB
testcase_21 AC 64 ms
25,856 KB
testcase_22 AC 64 ms
27,520 KB
testcase_23 AC 41 ms
20,736 KB
testcase_24 AC 72 ms
26,752 KB
testcase_25 AC 62 ms
23,040 KB
testcase_26 AC 64 ms
24,448 KB
testcase_27 AC 36 ms
19,160 KB
testcase_28 AC 34 ms
19,200 KB
testcase_29 AC 61 ms
24,960 KB
testcase_30 AC 72 ms
25,216 KB
testcase_31 AC 58 ms
25,984 KB
testcase_32 AC 35 ms
19,552 KB
testcase_33 AC 72 ms
27,008 KB
testcase_34 AC 50 ms
23,040 KB
testcase_35 AC 53 ms
25,600 KB
testcase_36 AC 31 ms
18,944 KB
testcase_37 AC 31 ms
18,944 KB
testcase_38 AC 31 ms
19,200 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();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (h, w) = (c[0], c[1]);
        var k = long.Parse(ReadLine());
        var dp = new bool[h][];
        for (var i = 0; i < dp.Length; ++i) dp[i] = new bool[w];

        var rx = 0;
        var ry = 0;
        var dx = 1;
        var dy = 1;
        var time = 0;
        do
        {
            dp[rx][ry] = !dp[rx][ry];
            if (rx + dx < 0 || rx + dx >= h) dx = -dx;
            else rx += dx;
            if (ry + dy < 0 || ry + dy >= w) dy = -dy;
            else ry += dy;
            ++time;
        }
        while (rx != 0 || ry != 0 || dx != 1 || dy != 1);
        k %= time;
        for (var i = 0; i < k; ++i)
        {
            dp[rx][ry] = !dp[rx][ry];
            if (rx + dx < 0 || rx + dx >= h) dx = -dx;
            else rx += dx;
            if (ry + dy < 0 || ry + dy >= w) dy = -dy;
            else ry += dy;
        }
        // WriteLine(time);
        WriteLine(string.Join("\n", dp.Select(di => string.Concat(di.Select(d => d ? '#' : '.')))));
    }
}
0