結果
| 問題 | 
                            No.1133 キムワイプイーター
                             | 
                    
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-08-16 17:09:15 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 673 ms / 2,000 ms | 
| コード長 | 421 bytes | 
| コンパイル時間 | 201 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 12,796 KB | 
| 最終ジャッジ日時 | 2024-10-09 14:23:50 | 
| 合計ジャッジ時間 | 9,553 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 31 | 
ソースコード
n,m=map(int,input().split())
a,b=0,0
s=input()
D=[[1 for y in range(n+1)]for x in range(n+1)]
D[0][0]=0
for i in range(m):
    if s[i]=="U":a,b=a,b+1
    if s[i]=="R":a,b=a+1,b
    if s[i]=="L":a,b=a-1,b
    if s[i]=="D":a,b=a,b-1
        
    if 0<=a<=n and 0<=b<=n:
        D[a][b]=0
for y in range(n+1):
    for x in range(n+1):
        if x>0:print(" ",end="")
        print(D[x][n-y],end="")
    
    print("")