結果
問題 | No.945 YKC饅頭 |
ユーザー | tenten |
提出日時 | 2023-01-31 19:43:09 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 820 ms / 2,000 ms |
コード長 | 2,312 bytes |
コンパイル時間 | 2,880 ms |
コンパイル使用メモリ | 85,280 KB |
実行使用メモリ | 63,356 KB |
最終ジャッジ日時 | 2024-06-30 21:17:18 |
合計ジャッジ時間 | 32,424 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 61 ms
37,372 KB |
testcase_01 | AC | 63 ms
37,288 KB |
testcase_02 | AC | 74 ms
37,588 KB |
testcase_03 | AC | 99 ms
38,888 KB |
testcase_04 | AC | 69 ms
37,632 KB |
testcase_05 | AC | 84 ms
37,868 KB |
testcase_06 | AC | 96 ms
39,216 KB |
testcase_07 | AC | 85 ms
38,248 KB |
testcase_08 | AC | 68 ms
37,568 KB |
testcase_09 | AC | 82 ms
37,800 KB |
testcase_10 | AC | 90 ms
38,452 KB |
testcase_11 | AC | 80 ms
38,496 KB |
testcase_12 | AC | 91 ms
38,636 KB |
testcase_13 | AC | 97 ms
38,484 KB |
testcase_14 | AC | 95 ms
38,748 KB |
testcase_15 | AC | 79 ms
38,308 KB |
testcase_16 | AC | 73 ms
37,588 KB |
testcase_17 | AC | 91 ms
38,348 KB |
testcase_18 | AC | 91 ms
38,672 KB |
testcase_19 | AC | 74 ms
38,764 KB |
testcase_20 | AC | 66 ms
37,784 KB |
testcase_21 | AC | 70 ms
37,552 KB |
testcase_22 | AC | 103 ms
39,276 KB |
testcase_23 | AC | 107 ms
39,164 KB |
testcase_24 | AC | 112 ms
39,256 KB |
testcase_25 | AC | 104 ms
38,912 KB |
testcase_26 | AC | 107 ms
39,588 KB |
testcase_27 | AC | 75 ms
38,996 KB |
testcase_28 | AC | 75 ms
38,668 KB |
testcase_29 | AC | 62 ms
37,504 KB |
testcase_30 | AC | 60 ms
37,980 KB |
testcase_31 | AC | 241 ms
44,716 KB |
testcase_32 | AC | 279 ms
48,672 KB |
testcase_33 | AC | 468 ms
55,092 KB |
testcase_34 | AC | 493 ms
61,096 KB |
testcase_35 | AC | 593 ms
56,052 KB |
testcase_36 | AC | 420 ms
47,088 KB |
testcase_37 | AC | 445 ms
48,264 KB |
testcase_38 | AC | 475 ms
46,540 KB |
testcase_39 | AC | 362 ms
55,724 KB |
testcase_40 | AC | 397 ms
54,148 KB |
testcase_41 | AC | 310 ms
47,988 KB |
testcase_42 | AC | 565 ms
50,652 KB |
testcase_43 | AC | 381 ms
47,152 KB |
testcase_44 | AC | 548 ms
54,988 KB |
testcase_45 | AC | 555 ms
62,136 KB |
testcase_46 | AC | 239 ms
47,876 KB |
testcase_47 | AC | 499 ms
50,856 KB |
testcase_48 | AC | 261 ms
44,400 KB |
testcase_49 | AC | 496 ms
50,016 KB |
testcase_50 | AC | 594 ms
53,508 KB |
testcase_51 | AC | 678 ms
55,252 KB |
testcase_52 | AC | 645 ms
63,220 KB |
testcase_53 | AC | 677 ms
54,476 KB |
testcase_54 | AC | 653 ms
54,828 KB |
testcase_55 | AC | 669 ms
55,512 KB |
testcase_56 | AC | 295 ms
52,488 KB |
testcase_57 | AC | 233 ms
52,040 KB |
testcase_58 | AC | 761 ms
63,356 KB |
testcase_59 | AC | 753 ms
62,544 KB |
testcase_60 | AC | 597 ms
62,172 KB |
testcase_61 | AC | 746 ms
62,908 KB |
testcase_62 | AC | 759 ms
62,356 KB |
testcase_63 | AC | 291 ms
55,880 KB |
testcase_64 | AC | 616 ms
62,368 KB |
testcase_65 | AC | 571 ms
62,116 KB |
testcase_66 | AC | 568 ms
61,956 KB |
testcase_67 | AC | 733 ms
62,620 KB |
testcase_68 | AC | 643 ms
62,296 KB |
testcase_69 | AC | 434 ms
58,304 KB |
testcase_70 | AC | 466 ms
59,820 KB |
testcase_71 | AC | 481 ms
59,872 KB |
testcase_72 | AC | 659 ms
62,292 KB |
testcase_73 | AC | 820 ms
63,152 KB |
ソースコード
import java.io.*; import java.util.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); char[] ykc = "YKC".toCharArray(); HashMap<Character, Integer> idxes = new HashMap<>(); for (int i = 0; i < ykc.length; i++) { idxes.put(ykc[i], i); } TreeSet<Integer> all = new TreeSet<>(); for (int i = 1; i <= n; i++) { all.add(i); } int[] ans = new int[3]; while (m-- > 0) { Integer key = sc.nextInt(); int right = sc.nextInt(); int x = idxes.get(sc.next().charAt(0)); while ((key = all.ceiling(key)) != null) { if (key > right) { break; } all.remove(key); ans[x]++; } } System.out.println(String.join(" ", Arrays.stream(ans).mapToObj(String::valueOf).toArray(String[]::new))); } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }