結果

問題 No.1021 Children in Classrooms
ユーザー n_gojon_gojo
提出日時 2020-04-13 14:25:40
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 981 bytes
コンパイル時間 4,742 ms
コンパイル使用メモリ 77,768 KB
実行使用メモリ 62,008 KB
最終ジャッジ日時 2023-10-25 02:16:19
合計ジャッジ時間 12,102 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
62,008 KB
testcase_01 AC 120 ms
57,148 KB
testcase_02 AC 110 ms
56,172 KB
testcase_03 AC 270 ms
60,784 KB
testcase_04 AC 261 ms
60,848 KB
testcase_05 AC 267 ms
60,420 KB
testcase_06 AC 292 ms
60,544 KB
testcase_07 AC 306 ms
60,568 KB
testcase_08 AC 306 ms
60,668 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class No1021 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] room = new int[n];
        for (int i=0;i<n;i++) {
            room[i]=sc.nextInt();
        }
        String str = sc.next();
        char[] c = str.toCharArray();

        for (char c1 : c) {
            if(c1=='R'){
                for (int i=(n-2);i>=0;i--) {
                    room[i+1]+=room[i];
                    room[i]=0;
                }
            }else{
                for (int i=1;i<n;i++) {
                    room[i-1]+=room[i];
                    room[i]=0;
                }
            }
        }
        System.out.print(room[0]);
        for (int i=1;i<n;i++) {
            System.out.print(' ');
            System.out.print(room[i]);
        }

        System.out.println("");
    }
}
0