結果

問題 No.945 YKC饅頭
ユーザー tentententen
提出日時 2022-08-29 16:41:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,127 ms / 2,000 ms
コード長 1,599 bytes
コンパイル時間 3,292 ms
コンパイル使用メモリ 80,804 KB
実行使用メモリ 79,172 KB
最終ジャッジ日時 2024-11-06 13:52:32
合計ジャッジ時間 37,108 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
52,860 KB
testcase_01 AC 93 ms
53,184 KB
testcase_02 AC 108 ms
52,984 KB
testcase_03 AC 134 ms
53,376 KB
testcase_04 AC 106 ms
53,020 KB
testcase_05 AC 126 ms
53,228 KB
testcase_06 AC 134 ms
53,380 KB
testcase_07 AC 125 ms
53,244 KB
testcase_08 AC 106 ms
53,008 KB
testcase_09 AC 118 ms
53,304 KB
testcase_10 AC 126 ms
53,216 KB
testcase_11 AC 116 ms
52,976 KB
testcase_12 AC 131 ms
53,164 KB
testcase_13 AC 134 ms
53,340 KB
testcase_14 AC 132 ms
53,120 KB
testcase_15 AC 114 ms
52,968 KB
testcase_16 AC 110 ms
52,876 KB
testcase_17 AC 130 ms
53,144 KB
testcase_18 AC 133 ms
53,288 KB
testcase_19 AC 115 ms
52,880 KB
testcase_20 AC 107 ms
53,200 KB
testcase_21 AC 108 ms
53,080 KB
testcase_22 AC 143 ms
53,332 KB
testcase_23 AC 142 ms
53,416 KB
testcase_24 AC 143 ms
53,552 KB
testcase_25 AC 144 ms
53,320 KB
testcase_26 AC 139 ms
53,264 KB
testcase_27 AC 112 ms
53,160 KB
testcase_28 AC 110 ms
53,112 KB
testcase_29 AC 106 ms
52,912 KB
testcase_30 AC 95 ms
53,236 KB
testcase_31 AC 294 ms
56,860 KB
testcase_32 AC 340 ms
59,492 KB
testcase_33 AC 640 ms
65,748 KB
testcase_34 AC 536 ms
62,684 KB
testcase_35 AC 682 ms
66,140 KB
testcase_36 AC 481 ms
58,620 KB
testcase_37 AC 505 ms
58,924 KB
testcase_38 AC 501 ms
59,064 KB
testcase_39 AC 410 ms
60,664 KB
testcase_40 AC 442 ms
64,320 KB
testcase_41 AC 358 ms
58,644 KB
testcase_42 AC 608 ms
61,572 KB
testcase_43 AC 439 ms
60,188 KB
testcase_44 AC 624 ms
65,368 KB
testcase_45 AC 590 ms
61,868 KB
testcase_46 AC 261 ms
59,020 KB
testcase_47 AC 834 ms
61,824 KB
testcase_48 AC 301 ms
57,024 KB
testcase_49 AC 520 ms
61,472 KB
testcase_50 AC 627 ms
61,732 KB
testcase_51 AC 730 ms
65,916 KB
testcase_52 AC 691 ms
65,912 KB
testcase_53 AC 735 ms
65,640 KB
testcase_54 AC 708 ms
65,612 KB
testcase_55 AC 1,127 ms
79,172 KB
testcase_56 AC 339 ms
63,700 KB
testcase_57 AC 299 ms
65,456 KB
testcase_58 AC 817 ms
72,660 KB
testcase_59 AC 833 ms
73,024 KB
testcase_60 AC 667 ms
72,556 KB
testcase_61 AC 828 ms
72,940 KB
testcase_62 AC 828 ms
73,240 KB
testcase_63 AC 334 ms
65,976 KB
testcase_64 AC 712 ms
72,496 KB
testcase_65 AC 642 ms
72,752 KB
testcase_66 AC 648 ms
72,748 KB
testcase_67 AC 814 ms
72,724 KB
testcase_68 AC 697 ms
72,400 KB
testcase_69 AC 494 ms
68,980 KB
testcase_70 AC 529 ms
72,092 KB
testcase_71 AC 537 ms
72,052 KB
testcase_72 AC 730 ms
72,644 KB
testcase_73 AC 885 ms
73,000 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