結果

問題 No.945 YKC饅頭
ユーザー tentententen
提出日時 2021-03-11 08:29:37
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,522 ms / 2,000 ms
コード長 872 bytes
コンパイル時間 2,200 ms
コンパイル使用メモリ 80,528 KB
実行使用メモリ 74,468 KB
最終ジャッジ日時 2024-04-21 00:28:42
合計ジャッジ時間 51,586 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
42,272 KB
testcase_01 AC 148 ms
42,680 KB
testcase_02 AC 216 ms
44,036 KB
testcase_03 AC 237 ms
45,984 KB
testcase_04 AC 188 ms
44,600 KB
testcase_05 AC 212 ms
45,376 KB
testcase_06 AC 239 ms
44,420 KB
testcase_07 AC 218 ms
44,700 KB
testcase_08 AC 177 ms
42,788 KB
testcase_09 AC 199 ms
44,672 KB
testcase_10 AC 220 ms
44,176 KB
testcase_11 AC 226 ms
45,572 KB
testcase_12 AC 216 ms
44,120 KB
testcase_13 AC 247 ms
46,044 KB
testcase_14 AC 230 ms
45,688 KB
testcase_15 AC 215 ms
43,936 KB
testcase_16 AC 207 ms
43,192 KB
testcase_17 AC 219 ms
45,996 KB
testcase_18 AC 230 ms
43,948 KB
testcase_19 AC 180 ms
42,568 KB
testcase_20 AC 192 ms
43,696 KB
testcase_21 AC 197 ms
45,476 KB
testcase_22 AC 243 ms
46,320 KB
testcase_23 AC 249 ms
45,936 KB
testcase_24 AC 245 ms
46,092 KB
testcase_25 AC 250 ms
45,760 KB
testcase_26 AC 246 ms
45,960 KB
testcase_27 AC 159 ms
42,436 KB
testcase_28 AC 162 ms
42,360 KB
testcase_29 AC 143 ms
42,036 KB
testcase_30 AC 135 ms
42,492 KB
testcase_31 AC 429 ms
48,064 KB
testcase_32 AC 404 ms
50,792 KB
testcase_33 AC 828 ms
55,596 KB
testcase_34 AC 930 ms
54,256 KB
testcase_35 AC 1,110 ms
58,668 KB
testcase_36 AC 931 ms
51,592 KB
testcase_37 AC 986 ms
51,872 KB
testcase_38 AC 911 ms
51,416 KB
testcase_39 AC 630 ms
51,492 KB
testcase_40 AC 623 ms
55,196 KB
testcase_41 AC 414 ms
50,972 KB
testcase_42 AC 1,120 ms
58,448 KB
testcase_43 AC 903 ms
51,452 KB
testcase_44 AC 1,042 ms
59,012 KB
testcase_45 AC 1,078 ms
54,888 KB
testcase_46 AC 307 ms
49,776 KB
testcase_47 AC 979 ms
56,356 KB
testcase_48 AC 609 ms
47,824 KB
testcase_49 AC 760 ms
51,100 KB
testcase_50 AC 1,166 ms
57,932 KB
testcase_51 AC 1,346 ms
69,872 KB
testcase_52 AC 1,300 ms
66,020 KB
testcase_53 AC 1,398 ms
69,676 KB
testcase_54 AC 1,302 ms
70,040 KB
testcase_55 AC 1,323 ms
69,828 KB
testcase_56 AC 340 ms
57,976 KB
testcase_57 AC 277 ms
57,660 KB
testcase_58 AC 1,411 ms
73,888 KB
testcase_59 AC 1,295 ms
69,000 KB
testcase_60 AC 965 ms
68,316 KB
testcase_61 AC 1,415 ms
73,980 KB
testcase_62 AC 1,466 ms
73,912 KB
testcase_63 AC 380 ms
59,524 KB
testcase_64 AC 1,028 ms
72,932 KB
testcase_65 AC 1,022 ms
70,312 KB
testcase_66 AC 904 ms
68,664 KB
testcase_67 AC 1,270 ms
73,848 KB
testcase_68 AC 1,004 ms
73,244 KB
testcase_69 AC 631 ms
63,816 KB
testcase_70 AC 781 ms
63,828 KB
testcase_71 AC 733 ms
64,064 KB
testcase_72 AC 1,160 ms
73,128 KB
testcase_73 AC 1,522 ms
74,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		TreeSet<Integer> empty = new TreeSet<>();
		for (int i = 1; i <= n; i++) {
		    empty.add(i);
		}
		int[] counts = new int[3];
		for (int i = 0; i < m; i++) {
		    int left = sc.nextInt();
		    int right = sc.nextInt();
		    char type = sc.next().charAt(0);
		    int idx;
		    if (type == 'Y') {
		        idx = 0;
		    } else if (type == 'K') {
		        idx = 1;
		    } else {
		        idx = 2;
		    }
		    Integer key = left - 1;
		    while ((key = empty.higher(key)) != null) {
		        if (key > right) {
		            break;
		        }
		        counts[idx]++;
		        empty.remove(key);
		    }
		}
		System.out.println(counts[0] + " " + counts[1] + " " + counts[2]);
   }
}

0