結果

問題 No.945 YKC饅頭
ユーザー ks2mks2m
提出日時 2019-12-09 23:16:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,264 ms / 2,000 ms
コード長 1,027 bytes
コンパイル時間 3,762 ms
コンパイル使用メモリ 75,352 KB
実行使用メモリ 82,516 KB
最終ジャッジ日時 2023-09-05 12:30:43
合計ジャッジ時間 42,628 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
53,044 KB
testcase_01 AC 90 ms
53,112 KB
testcase_02 AC 104 ms
53,056 KB
testcase_03 AC 130 ms
54,332 KB
testcase_04 AC 95 ms
53,136 KB
testcase_05 AC 113 ms
54,056 KB
testcase_06 AC 126 ms
53,424 KB
testcase_07 AC 115 ms
53,872 KB
testcase_08 AC 95 ms
53,208 KB
testcase_09 AC 112 ms
53,164 KB
testcase_10 AC 120 ms
51,600 KB
testcase_11 AC 110 ms
53,508 KB
testcase_12 AC 121 ms
53,160 KB
testcase_13 AC 132 ms
53,244 KB
testcase_14 AC 129 ms
52,356 KB
testcase_15 AC 109 ms
53,136 KB
testcase_16 AC 102 ms
52,464 KB
testcase_17 AC 122 ms
53,252 KB
testcase_18 AC 122 ms
53,488 KB
testcase_19 AC 104 ms
53,060 KB
testcase_20 AC 103 ms
53,112 KB
testcase_21 AC 100 ms
53,080 KB
testcase_22 AC 136 ms
53,884 KB
testcase_23 AC 135 ms
53,100 KB
testcase_24 AC 136 ms
53,472 KB
testcase_25 AC 135 ms
53,208 KB
testcase_26 AC 133 ms
53,296 KB
testcase_27 AC 99 ms
54,080 KB
testcase_28 AC 101 ms
55,040 KB
testcase_29 AC 84 ms
53,248 KB
testcase_30 AC 87 ms
54,068 KB
testcase_31 AC 281 ms
57,700 KB
testcase_32 AC 353 ms
60,608 KB
testcase_33 AC 513 ms
65,852 KB
testcase_34 AC 694 ms
62,908 KB
testcase_35 AC 1,007 ms
68,316 KB
testcase_36 AC 628 ms
59,684 KB
testcase_37 AC 641 ms
58,616 KB
testcase_38 AC 621 ms
59,096 KB
testcase_39 AC 404 ms
61,148 KB
testcase_40 AC 429 ms
66,248 KB
testcase_41 AC 321 ms
59,684 KB
testcase_42 AC 950 ms
62,816 KB
testcase_43 AC 627 ms
60,080 KB
testcase_44 AC 779 ms
67,136 KB
testcase_45 AC 752 ms
63,260 KB
testcase_46 AC 269 ms
59,844 KB
testcase_47 AC 715 ms
61,416 KB
testcase_48 AC 337 ms
57,512 KB
testcase_49 AC 480 ms
61,508 KB
testcase_50 AC 777 ms
62,684 KB
testcase_51 AC 986 ms
82,112 KB
testcase_52 AC 1,076 ms
75,000 KB
testcase_53 AC 964 ms
82,516 KB
testcase_54 AC 952 ms
73,000 KB
testcase_55 AC 974 ms
75,676 KB
testcase_56 AC 376 ms
68,460 KB
testcase_57 AC 312 ms
67,624 KB
testcase_58 AC 1,196 ms
76,096 KB
testcase_59 AC 1,264 ms
79,888 KB
testcase_60 AC 882 ms
74,368 KB
testcase_61 AC 1,213 ms
77,660 KB
testcase_62 AC 1,243 ms
74,868 KB
testcase_63 AC 313 ms
67,720 KB
testcase_64 AC 874 ms
74,704 KB
testcase_65 AC 802 ms
74,236 KB
testcase_66 AC 775 ms
75,308 KB
testcase_67 AC 1,071 ms
74,976 KB
testcase_68 AC 892 ms
73,896 KB
testcase_69 AC 504 ms
73,740 KB
testcase_70 AC 555 ms
73,612 KB
testcase_71 AC 553 ms
73,852 KB
testcase_72 AC 1,010 ms
74,196 KB
testcase_73 AC 1,250 ms
74,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Set;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int m = Integer.parseInt(sa[1]);
		TreeSet<Integer> set = new TreeSet<>();
		for (int i = 1; i <= n; i++) {
			set.add(i);
		}
		int[] ans = new int[3];
		for (int i = 0; i < m; i++) {
			sa = br.readLine().split(" ");
			int l = Integer.parseInt(sa[0]);
			int r = Integer.parseInt(sa[1]);
			String t = sa[2];
			Set<Integer> s = set.subSet(l, r + 1);
			if (t.equals("Y")) {
				ans[0] += s.size();
			} else if (t.equals("K")) {
				ans[1] += s.size();
			} else {
				ans[2] += s.size();
			}
			Integer[] arr = s.toArray(new Integer[0]);
			for (Integer o : arr) {
				set.remove(o);
			}
		}
		br.close();

		System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
	}
}
0