結果

問題 No.1133 キムワイプイーター
ユーザー kusagame12kusagame12
提出日時 2023-11-07 21:44:30
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,252 bytes
コンパイル時間 2,514 ms
コンパイル使用メモリ 79,652 KB
実行使用メモリ 67,720 KB
最終ジャッジ日時 2023-11-07 21:44:47
合計ジャッジ時間 15,838 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
56,400 KB
testcase_01 AC 143 ms
57,592 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 409 ms
61,328 KB
testcase_10 AC 443 ms
65,748 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 464 ms
66,340 KB
testcase_14 AC 314 ms
64,964 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 136 ms
57,400 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 140 ms
57,852 KB
testcase_27 WA -
testcase_28 AC 145 ms
57,628 KB
testcase_29 AC 127 ms
56,404 KB
testcase_30 WA -
testcase_31 AC 137 ms
57,768 KB
testcase_32 AC 138 ms
57,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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();
        }
        
    }
}
0