結果
問題 | No.1021 Children in Classrooms |
ユーザー | ntk3264 |
提出日時 | 2020-04-11 19:54:53 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,077 bytes |
コンパイル時間 | 2,481 ms |
コンパイル使用メモリ | 80,408 KB |
実行使用メモリ | 81,544 KB |
最終ジャッジ日時 | 2023-10-19 11:44:37 |
合計ジャッジ時間 | 8,657 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 139 ms
41,228 KB |
testcase_01 | AC | 142 ms
41,412 KB |
testcase_02 | AC | 132 ms
40,232 KB |
testcase_03 | AC | 237 ms
43,372 KB |
testcase_04 | AC | 242 ms
43,984 KB |
testcase_05 | AC | 230 ms
43,340 KB |
testcase_06 | AC | 235 ms
43,728 KB |
testcase_07 | AC | 243 ms
44,236 KB |
testcase_08 | AC | 239 ms
44,140 KB |
testcase_09 | TLE | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
ソースコード
import java.util.*; public class Main { Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().run(); } void run() { int n = sc.nextInt(); int m = sc.nextInt(); // int[] arr = new int[n]; List<Integer> list = new ArrayList<>(); for (int i=0; i<n; i++) list.add(sc.nextInt()); char[] order = sc.next().toCharArray(); for (int i=0; i<m; i++) { if (order[i]=='L') { int tmp = list.get(0)+list.get(1); list.remove(0); list.remove(0); list.add(0, tmp); list.add(0); } else { int tmp = list.get(n-2)+list.get(n-1); list.remove(n-1); list.remove(n-2); list.add(0, 0); list.add(n-1, tmp); } } StringBuilder sb = new StringBuilder(); for (int t: list) { sb.append(t+" "); } System.out.println(sb.toString()); } }