結果
| 問題 |
No.1133 キムワイプイーター
|
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 20:15:37 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 85 ms / 2,000 ms |
| コード長 | 628 bytes |
| コンパイル時間 | 137 ms |
| コンパイル使用メモリ | 82,352 KB |
| 実行使用メモリ | 78,296 KB |
| 最終ジャッジ日時 | 2025-03-20 20:15:46 |
| 合計ジャッジ時間 | 3,067 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 31 |
ソースコード
n, m = map(int, input().split())
s = input().strip()
# Initialize grid with all 1s except (0,0)
grid = [[1] * (n + 1) for _ in range(n + 1)]
grid[0][0] = 0
x, y = 0, 0 # Starting position
for move in s:
# Update position based on the move
if move == 'U':
y += 1
elif move == 'D':
y -= 1
elif move == 'R':
x += 1
elif move == 'L':
x -= 1
# Check and consume the Kimwipe at the new position
if grid[y][x] == 1:
grid[y][x] = 0
# Output the grid from top (y=n) to bottom (y=0)
for y_coord in range(n, -1, -1):
print(' '.join(map(str, grid[y_coord])))
lam6er