結果
| 問題 |
No.1133 キムワイプイーター
|
| ユーザー |
|
| 提出日時 | 2023-11-07 21:44:30 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,252 bytes |
| コンパイル時間 | 2,215 ms |
| コンパイル使用メモリ | 80,152 KB |
| 実行使用メモリ | 53,012 KB |
| 最終ジャッジ日時 | 2024-09-25 23:28:33 |
| 合計ジャッジ時間 | 13,906 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 WA * 21 |
ソースコード
import java.util.*;
import java.lang.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
char[] s = sc.next().toCharArray();
int[][] kimwipes = new int[n+1][n+1];
for(int i = 0 ; i <= n ; i++){
Arrays.fill(kimwipes[i] , 1);
}
int x = 0;
int y = 0;
kimwipes[0][0] = 0;
for(int i = 0 ; i < s.length ; i++){
char c = s[i];
if(c == 'U' && y < n){
kimwipes[y+1][x] = 0;
y++;
}else if(c == 'D' && y > 0){
kimwipes[y-1][x] = 0;
y--;
}else if(c == 'R' && x < n){
kimwipes[y][x+1] = 0;
x++;
}else if(c == 'L' && x > 0){
kimwipes[y][x-1] = 0;
x--;
}
}
for(int i = n ; i >= 0 ; i--){
for(int j = n ; j >= 0 ; j--){
System.out.print(kimwipes[i][j]+" ");
}
System.out.println();
}
}
}