結果

問題 No.1133 キムワイプイーター
ユーザー lloyzlloyz
提出日時 2022-06-17 20:43:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 77,952 KB
最終ジャッジ日時 2024-04-17 11:44:14
合計ジャッジ時間 3,650 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,712 KB
testcase_01 AC 40 ms
51,968 KB
testcase_02 AC 76 ms
70,016 KB
testcase_03 AC 96 ms
77,952 KB
testcase_04 AC 93 ms
75,776 KB
testcase_05 AC 99 ms
77,696 KB
testcase_06 AC 91 ms
74,496 KB
testcase_07 AC 88 ms
74,880 KB
testcase_08 AC 83 ms
74,112 KB
testcase_09 AC 89 ms
71,680 KB
testcase_10 AC 99 ms
73,472 KB
testcase_11 AC 96 ms
75,392 KB
testcase_12 AC 96 ms
77,696 KB
testcase_13 AC 96 ms
74,368 KB
testcase_14 AC 72 ms
65,664 KB
testcase_15 AC 83 ms
70,144 KB
testcase_16 AC 81 ms
71,808 KB
testcase_17 AC 58 ms
64,512 KB
testcase_18 AC 64 ms
69,888 KB
testcase_19 AC 56 ms
63,744 KB
testcase_20 AC 62 ms
67,584 KB
testcase_21 AC 63 ms
70,144 KB
testcase_22 AC 64 ms
69,888 KB
testcase_23 AC 40 ms
51,840 KB
testcase_24 AC 40 ms
51,712 KB
testcase_25 AC 56 ms
63,744 KB
testcase_26 AC 40 ms
51,712 KB
testcase_27 AC 41 ms
51,840 KB
testcase_28 AC 41 ms
51,840 KB
testcase_29 AC 41 ms
51,712 KB
testcase_30 AC 66 ms
70,400 KB
testcase_31 AC 42 ms
51,712 KB
testcase_32 AC 41 ms
51,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
s = input()

ANS = [[1 for _ in range(n + 1)] for _ in range(n + 1)]
ANS[n][0] = 0
cx, cy = n, 0
for i in range(m):
    if s[i] == 'U':
        dx, dy = -1, 0
    elif s[i] == 'R':
        dx, dy = 0, 1
    elif s[i] == 'D':
        dx, dy = 1, 0
    elif s[i] == 'L':
        dx, dy = 0, -1
    if 0 <= cx + dx <= n and 0 <= cy + dy <= n:
        cx += dx
        cy += dy
    ANS[cx][cy] = 0
for ans in ANS:
    print(*ans)
0