結果

問題 No.1021 Children in Classrooms
ユーザー n_gojon_gojo
提出日時 2020-04-13 15:12:43
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,041 bytes
コンパイル時間 3,701 ms
コンパイル使用メモリ 78,452 KB
実行使用メモリ 60,748 KB
最終ジャッジ日時 2023-10-25 05:33:25
合計ジャッジ時間 10,258 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
57,192 KB
testcase_01 AC 130 ms
57,340 KB
testcase_02 AC 131 ms
57,336 KB
testcase_03 AC 267 ms
60,748 KB
testcase_04 AC 285 ms
60,708 KB
testcase_05 AC 268 ms
60,428 KB
testcase_06 AC 277 ms
60,748 KB
testcase_07 AC 286 ms
60,312 KB
testcase_08 AC 289 ms
60,384 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();
        List<Integer> room = new ArrayList<>();
        for (int i=0;i<n;i++) {
            room.add(sc.nextInt());
        }
        String str = sc.next();
        char[] c = str.toCharArray();

        for (char c1 : c) {
            if(c1=='R'){
                room.set((room.size() - 2), (room.get(room.size() - 1) + room.get(room.size() - 2)));
                room.remove(room.size() - 1);
                room.add(0,0);
            }else{
                room.set(1, (room.get(0) + room.get(1)));
                room.remove(0);
                room.add(0);
            }
        }

        System.out.print(room.get(0));
        for (int i=1;i<n;i++) {
            System.out.print(" ");
            System.out.print(room.get(i));
        }
        System.out.println("");
    }
}
0