結果

問題 No.2432 Flip and Move
ユーザー 👑 kakel-sankakel-san
提出日時 2023-08-18 23:18:08
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 291 ms / 2,000 ms
コード長 1,390 bytes
コンパイル時間 2,094 ms
コンパイル使用メモリ 67,952 KB
実行使用メモリ 83,160 KB
最終ジャッジ日時 2023-08-18 23:18:20
合計ジャッジ時間 8,799 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
21,852 KB
testcase_01 AC 54 ms
23,844 KB
testcase_02 AC 90 ms
26,208 KB
testcase_03 AC 291 ms
83,160 KB
testcase_04 AC 79 ms
32,604 KB
testcase_05 AC 80 ms
32,684 KB
testcase_06 AC 76 ms
28,004 KB
testcase_07 AC 232 ms
63,704 KB
testcase_08 AC 218 ms
64,640 KB
testcase_09 AC 286 ms
81,228 KB
testcase_10 AC 82 ms
26,420 KB
testcase_11 AC 89 ms
26,884 KB
testcase_12 AC 80 ms
25,996 KB
testcase_13 AC 91 ms
27,764 KB
testcase_14 AC 107 ms
38,056 KB
testcase_15 AC 247 ms
73,412 KB
testcase_16 AC 74 ms
24,828 KB
testcase_17 AC 88 ms
28,820 KB
testcase_18 AC 67 ms
22,164 KB
testcase_19 AC 86 ms
26,116 KB
testcase_20 AC 93 ms
27,148 KB
testcase_21 AC 89 ms
30,912 KB
testcase_22 AC 98 ms
31,856 KB
testcase_23 AC 73 ms
22,128 KB
testcase_24 AC 94 ms
29,852 KB
testcase_25 AC 79 ms
27,812 KB
testcase_26 AC 79 ms
28,316 KB
testcase_27 AC 59 ms
21,860 KB
testcase_28 AC 58 ms
21,936 KB
testcase_29 AC 88 ms
27,864 KB
testcase_30 AC 99 ms
26,952 KB
testcase_31 AC 81 ms
29,140 KB
testcase_32 AC 61 ms
21,920 KB
testcase_33 AC 114 ms
32,248 KB
testcase_34 AC 75 ms
25,080 KB
testcase_35 AC 75 ms
30,816 KB
testcase_36 AC 61 ms
23,908 KB
testcase_37 AC 63 ms
19,804 KB
testcase_38 AC 62 ms
21,728 KB
権限があれば一括ダウンロードができます

ソースコード

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