結果

問題 No.945 YKC饅頭
ユーザー tentententen
提出日時 2023-01-31 19:43:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 773 ms / 2,000 ms
コード長 2,312 bytes
コンパイル時間 4,915 ms
コンパイル使用メモリ 91,396 KB
実行使用メモリ 74,620 KB
最終ジャッジ日時 2023-09-13 12:10:26
合計ジャッジ時間 33,184 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
50,928 KB
testcase_01 AC 55 ms
50,820 KB
testcase_02 AC 66 ms
52,128 KB
testcase_03 AC 87 ms
52,012 KB
testcase_04 AC 62 ms
50,904 KB
testcase_05 AC 78 ms
51,388 KB
testcase_06 AC 89 ms
52,380 KB
testcase_07 AC 82 ms
52,876 KB
testcase_08 AC 63 ms
51,552 KB
testcase_09 AC 74 ms
51,840 KB
testcase_10 AC 83 ms
52,880 KB
testcase_11 AC 75 ms
52,880 KB
testcase_12 AC 81 ms
51,580 KB
testcase_13 AC 93 ms
52,948 KB
testcase_14 AC 88 ms
52,964 KB
testcase_15 AC 72 ms
52,172 KB
testcase_16 AC 68 ms
53,012 KB
testcase_17 AC 82 ms
51,932 KB
testcase_18 AC 82 ms
52,920 KB
testcase_19 AC 70 ms
52,204 KB
testcase_20 AC 64 ms
50,860 KB
testcase_21 AC 65 ms
51,092 KB
testcase_22 AC 94 ms
52,388 KB
testcase_23 AC 99 ms
52,360 KB
testcase_24 AC 99 ms
53,576 KB
testcase_25 AC 101 ms
52,612 KB
testcase_26 AC 96 ms
53,656 KB
testcase_27 AC 68 ms
52,200 KB
testcase_28 AC 67 ms
52,400 KB
testcase_29 AC 53 ms
50,848 KB
testcase_30 AC 54 ms
50,960 KB
testcase_31 AC 230 ms
57,824 KB
testcase_32 AC 300 ms
59,992 KB
testcase_33 AC 405 ms
65,580 KB
testcase_34 AC 450 ms
61,984 KB
testcase_35 AC 587 ms
67,380 KB
testcase_36 AC 409 ms
59,708 KB
testcase_37 AC 402 ms
59,380 KB
testcase_38 AC 436 ms
60,036 KB
testcase_39 AC 309 ms
60,072 KB
testcase_40 AC 346 ms
65,292 KB
testcase_41 AC 275 ms
59,516 KB
testcase_42 AC 538 ms
62,376 KB
testcase_43 AC 384 ms
57,332 KB
testcase_44 AC 538 ms
66,796 KB
testcase_45 AC 507 ms
62,256 KB
testcase_46 AC 215 ms
60,176 KB
testcase_47 AC 718 ms
62,284 KB
testcase_48 AC 239 ms
58,656 KB
testcase_49 AC 385 ms
60,980 KB
testcase_50 AC 527 ms
63,336 KB
testcase_51 AC 640 ms
66,812 KB
testcase_52 AC 597 ms
66,612 KB
testcase_53 AC 604 ms
66,696 KB
testcase_54 AC 613 ms
66,316 KB
testcase_55 AC 623 ms
67,160 KB
testcase_56 AC 236 ms
64,616 KB
testcase_57 AC 216 ms
63,352 KB
testcase_58 AC 694 ms
73,824 KB
testcase_59 AC 695 ms
74,536 KB
testcase_60 AC 555 ms
73,856 KB
testcase_61 AC 695 ms
74,620 KB
testcase_62 AC 691 ms
74,092 KB
testcase_63 AC 267 ms
67,276 KB
testcase_64 AC 568 ms
73,620 KB
testcase_65 AC 537 ms
73,716 KB
testcase_66 AC 500 ms
73,392 KB
testcase_67 AC 650 ms
74,532 KB
testcase_68 AC 557 ms
73,872 KB
testcase_69 AC 400 ms
69,732 KB
testcase_70 AC 444 ms
72,984 KB
testcase_71 AC 445 ms
73,140 KB
testcase_72 AC 601 ms
73,384 KB
testcase_73 AC 773 ms
74,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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();
    }
    
}
0