結果
問題 | No.1441 MErGe |
ユーザー | tenten |
提出日時 | 2021-03-30 12:05:28 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 895 bytes |
コンパイル時間 | 2,556 ms |
コンパイル使用メモリ | 76,800 KB |
実行使用メモリ | 72,928 KB |
最終ジャッジ日時 | 2024-05-07 15:30:58 |
合計ジャッジ時間 | 14,890 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 115 ms
59,860 KB |
testcase_01 | AC | 126 ms
54,092 KB |
testcase_02 | AC | 142 ms
53,984 KB |
testcase_03 | AC | 229 ms
57,688 KB |
testcase_04 | AC | 242 ms
46,112 KB |
testcase_05 | AC | 308 ms
47,836 KB |
testcase_06 | AC | 363 ms
47,832 KB |
testcase_07 | AC | 325 ms
47,732 KB |
testcase_08 | AC | 913 ms
72,928 KB |
testcase_09 | AC | 857 ms
70,920 KB |
testcase_10 | TLE | - |
testcase_11 | TLE | - |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int q = sc.nextInt(); long base = 0; ArrayList<Long> list = new ArrayList<>(); list.add(base); for (int i = 0; i < n; i++) { base += sc.nextInt(); list.add(base); } StringBuilder sb = new StringBuilder(); for (int i = 0; i < q; i++) { int type = sc.nextInt(); int left = sc.nextInt(); int right = sc.nextInt(); if (type == 1) { for (int j = left; j < right; j++) { list.remove(left); } } else { sb.append(list.get(right) - list.get(left - 1)).append("\n"); } } System.out.print(sb); } }