結果

問題 No.945 YKC饅頭
ユーザー tentententen
提出日時 2022-08-29 16:41:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 719 ms / 2,000 ms
コード長 1,599 bytes
コンパイル時間 2,678 ms
コンパイル使用メモリ 87,240 KB
実行使用メモリ 63,116 KB
最終ジャッジ日時 2024-04-24 06:43:45
合計ジャッジ時間 30,071 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
39,372 KB
testcase_01 AC 84 ms
40,164 KB
testcase_02 AC 93 ms
40,284 KB
testcase_03 AC 107 ms
40,464 KB
testcase_04 AC 80 ms
38,776 KB
testcase_05 AC 96 ms
40,240 KB
testcase_06 AC 112 ms
40,444 KB
testcase_07 AC 103 ms
40,332 KB
testcase_08 AC 92 ms
40,076 KB
testcase_09 AC 94 ms
40,692 KB
testcase_10 AC 110 ms
40,408 KB
testcase_11 AC 102 ms
40,068 KB
testcase_12 AC 107 ms
40,316 KB
testcase_13 AC 112 ms
40,364 KB
testcase_14 AC 110 ms
40,372 KB
testcase_15 AC 100 ms
40,296 KB
testcase_16 AC 87 ms
38,396 KB
testcase_17 AC 109 ms
40,324 KB
testcase_18 AC 106 ms
40,344 KB
testcase_19 AC 100 ms
40,328 KB
testcase_20 AC 93 ms
39,272 KB
testcase_21 AC 86 ms
40,108 KB
testcase_22 AC 116 ms
40,780 KB
testcase_23 AC 118 ms
40,492 KB
testcase_24 AC 119 ms
40,576 KB
testcase_25 AC 120 ms
40,696 KB
testcase_26 AC 120 ms
40,864 KB
testcase_27 AC 92 ms
40,012 KB
testcase_28 AC 100 ms
39,984 KB
testcase_29 AC 74 ms
39,860 KB
testcase_30 AC 77 ms
38,560 KB
testcase_31 AC 264 ms
45,092 KB
testcase_32 AC 286 ms
48,988 KB
testcase_33 AC 580 ms
55,264 KB
testcase_34 AC 467 ms
50,800 KB
testcase_35 AC 567 ms
55,576 KB
testcase_36 AC 439 ms
47,476 KB
testcase_37 AC 427 ms
47,480 KB
testcase_38 AC 419 ms
47,000 KB
testcase_39 AC 332 ms
48,872 KB
testcase_40 AC 376 ms
53,644 KB
testcase_41 AC 313 ms
48,904 KB
testcase_42 AC 541 ms
51,220 KB
testcase_43 AC 373 ms
47,548 KB
testcase_44 AC 534 ms
54,620 KB
testcase_45 AC 496 ms
50,832 KB
testcase_46 AC 270 ms
48,548 KB
testcase_47 AC 537 ms
51,764 KB
testcase_48 AC 258 ms
45,396 KB
testcase_49 AC 396 ms
50,364 KB
testcase_50 AC 529 ms
51,292 KB
testcase_51 AC 623 ms
55,768 KB
testcase_52 AC 590 ms
55,668 KB
testcase_53 AC 712 ms
55,796 KB
testcase_54 AC 613 ms
54,968 KB
testcase_55 AC 597 ms
54,624 KB
testcase_56 AC 294 ms
52,944 KB
testcase_57 AC 257 ms
55,768 KB
testcase_58 AC 671 ms
62,644 KB
testcase_59 AC 695 ms
62,912 KB
testcase_60 AC 557 ms
62,376 KB
testcase_61 AC 708 ms
62,892 KB
testcase_62 AC 709 ms
62,684 KB
testcase_63 AC 286 ms
56,384 KB
testcase_64 AC 584 ms
62,668 KB
testcase_65 AC 552 ms
62,452 KB
testcase_66 AC 648 ms
62,528 KB
testcase_67 AC 632 ms
62,704 KB
testcase_68 AC 576 ms
62,476 KB
testcase_69 AC 397 ms
59,112 KB
testcase_70 AC 440 ms
60,512 KB
testcase_71 AC 439 ms
60,488 KB
testcase_72 AC 637 ms
62,608 KB
testcase_73 AC 719 ms
63,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        int m = sc.nextInt();
        TreeSet<Integer> all = new TreeSet<>();
        for (int i = 1; i <= n; i++) {
            all.add(i);
        }
        int[] counts = new int[26];
        while (m-- > 0) {
            Integer left = sc.nextInt();
            int right = sc.nextInt();
            int idx = sc.next().charAt(0) - 'A';
            while ((left = all.ceiling(left)) != null) {
                if (left > right) {
                    break;
                }
                counts[idx]++;
                all.remove(left);
            }
        }
        System.out.println(counts['Y' - 'A'] + " " + counts['K' - 'A'] + " " + counts['C' - 'A']);
    }
}
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 String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0