結果

問題 No.1133 キムワイプイーター
ユーザー kusagame12kusagame12
提出日時 2023-11-07 21:55:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 523 ms / 2,000 ms
コード長 1,252 bytes
コンパイル時間 2,860 ms
コンパイル使用メモリ 79,320 KB
実行使用メモリ 67,312 KB
最終ジャッジ日時 2023-11-07 21:55:55
合計ジャッジ時間 15,623 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
57,948 KB
testcase_01 AC 147 ms
57,956 KB
testcase_02 AC 391 ms
61,936 KB
testcase_03 AC 519 ms
67,292 KB
testcase_04 AC 495 ms
67,312 KB
testcase_05 AC 523 ms
67,292 KB
testcase_06 AC 453 ms
66,220 KB
testcase_07 AC 473 ms
62,560 KB
testcase_08 AC 488 ms
62,320 KB
testcase_09 AC 406 ms
61,608 KB
testcase_10 AC 463 ms
66,168 KB
testcase_11 AC 522 ms
67,092 KB
testcase_12 AC 490 ms
67,236 KB
testcase_13 AC 517 ms
66,404 KB
testcase_14 AC 299 ms
65,220 KB
testcase_15 AC 367 ms
61,852 KB
testcase_16 AC 453 ms
62,212 KB
testcase_17 AC 316 ms
61,816 KB
testcase_18 AC 417 ms
62,412 KB
testcase_19 AC 313 ms
59,256 KB
testcase_20 AC 410 ms
62,556 KB
testcase_21 AC 416 ms
62,292 KB
testcase_22 AC 425 ms
62,568 KB
testcase_23 AC 153 ms
57,968 KB
testcase_24 AC 151 ms
57,960 KB
testcase_25 AC 315 ms
60,080 KB
testcase_26 AC 148 ms
56,144 KB
testcase_27 AC 147 ms
57,980 KB
testcase_28 AC 147 ms
57,840 KB
testcase_29 AC 147 ms
57,976 KB
testcase_30 AC 456 ms
62,572 KB
testcase_31 AC 146 ms
57,692 KB
testcase_32 AC 147 ms
57,976 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 = 0 ; j <= n ; j++){
                System.out.print(kimwipes[i][j]+" ");
            }
            System.out.println();
        }
        
    }
}
0