結果
問題 | No.945 YKC饅頭 |
ユーザー | htensai |
提出日時 | 2019-12-10 17:59:51 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 2,228 bytes |
コンパイル時間 | 2,998 ms |
コンパイル使用メモリ | 80,532 KB |
実行使用メモリ | 83,692 KB |
最終ジャッジ日時 | 2024-06-24 01:56:36 |
合計ジャッジ時間 | 69,429 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 167 ms
43,132 KB |
testcase_01 | AC | 170 ms
42,596 KB |
testcase_02 | AC | 227 ms
45,712 KB |
testcase_03 | AC | 268 ms
46,456 KB |
testcase_04 | AC | 213 ms
43,948 KB |
testcase_05 | AC | 221 ms
44,380 KB |
testcase_06 | AC | 241 ms
44,620 KB |
testcase_07 | AC | 246 ms
44,532 KB |
testcase_08 | AC | 191 ms
43,116 KB |
testcase_09 | AC | 226 ms
44,124 KB |
testcase_10 | AC | 240 ms
44,388 KB |
testcase_11 | AC | 238 ms
45,120 KB |
testcase_12 | AC | 233 ms
44,672 KB |
testcase_13 | AC | 256 ms
46,132 KB |
testcase_14 | AC | 258 ms
45,848 KB |
testcase_15 | AC | 247 ms
45,816 KB |
testcase_16 | AC | 226 ms
44,832 KB |
testcase_17 | AC | 264 ms
46,728 KB |
testcase_18 | AC | 251 ms
44,584 KB |
testcase_19 | AC | 179 ms
43,092 KB |
testcase_20 | AC | 224 ms
43,936 KB |
testcase_21 | AC | 229 ms
44,596 KB |
testcase_22 | AC | 267 ms
46,376 KB |
testcase_23 | AC | 258 ms
45,620 KB |
testcase_24 | AC | 262 ms
46,188 KB |
testcase_25 | AC | 266 ms
46,500 KB |
testcase_26 | AC | 262 ms
46,808 KB |
testcase_27 | AC | 166 ms
42,728 KB |
testcase_28 | AC | 167 ms
42,668 KB |
testcase_29 | AC | 170 ms
42,988 KB |
testcase_30 | AC | 154 ms
42,476 KB |
testcase_31 | AC | 499 ms
49,208 KB |
testcase_32 | AC | 345 ms
47,996 KB |
testcase_33 | AC | 957 ms
55,508 KB |
testcase_34 | AC | 1,484 ms
60,728 KB |
testcase_35 | AC | 1,957 ms
70,216 KB |
testcase_36 | AC | 1,874 ms
71,272 KB |
testcase_37 | AC | 1,886 ms
68,052 KB |
testcase_38 | AC | 1,700 ms
67,308 KB |
testcase_39 | AC | 772 ms
50,528 KB |
testcase_40 | AC | 665 ms
50,368 KB |
testcase_41 | AC | 447 ms
48,876 KB |
testcase_42 | TLE | - |
testcase_43 | AC | 1,826 ms
69,376 KB |
testcase_44 | AC | 1,684 ms
67,260 KB |
testcase_45 | AC | 1,998 ms
65,740 KB |
testcase_46 | AC | 306 ms
47,560 KB |
testcase_47 | AC | 1,435 ms
59,504 KB |
testcase_48 | AC | 729 ms
53,268 KB |
testcase_49 | AC | 1,009 ms
60,744 KB |
testcase_50 | TLE | - |
testcase_51 | TLE | - |
testcase_52 | TLE | - |
testcase_53 | TLE | - |
testcase_54 | TLE | - |
testcase_55 | TLE | - |
testcase_56 | AC | 190 ms
42,424 KB |
testcase_57 | AC | 182 ms
42,740 KB |
testcase_58 | AC | 1,658 ms
66,356 KB |
testcase_59 | AC | 1,734 ms
68,088 KB |
testcase_60 | AC | 1,131 ms
61,912 KB |
testcase_61 | AC | 1,695 ms
65,412 KB |
testcase_62 | AC | 1,543 ms
65,900 KB |
testcase_63 | AC | 308 ms
48,580 KB |
testcase_64 | AC | 1,014 ms
56,240 KB |
testcase_65 | AC | 982 ms
60,916 KB |
testcase_66 | AC | 937 ms
56,408 KB |
testcase_67 | AC | 1,302 ms
58,060 KB |
testcase_68 | AC | 1,146 ms
61,624 KB |
testcase_69 | AC | 664 ms
49,588 KB |
testcase_70 | AC | 721 ms
50,324 KB |
testcase_71 | AC | 741 ms
51,752 KB |
testcase_72 | AC | 1,325 ms
63,520 KB |
testcase_73 | AC | 1,731 ms
68,872 KB |
ソースコード
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(); PriorityQueue<Order> leftQueue = new PriorityQueue<Order>(new Comparator<Order>() { public int compare(Order o1, Order o2) { return o1.left - o2.left; } }); PriorityQueue<Order> rightQueue = new PriorityQueue<Order>(new Comparator<Order>() { public int compare(Order o1, Order o2) { return o1.right - o2.right; } }); for (int i = 0; i < m; i++) { Order or = new Order(i, sc.nextInt(), sc.nextInt(), sc.next().charAt(0)); leftQueue.add(or); rightQueue.add(or); } TreeSet<Order> set = new TreeSet<Order>(new Comparator<Order>() { public int compare(Order o1, Order o2) { return o1.idx - o2.idx; } }); int[] counts = new int[3]; for (int i = 1; i <= n; i++) { while (leftQueue.size() > 0 && leftQueue.peek().left == i) { set.add(leftQueue.poll()); } if (set.size() == 0) { continue; } counts[set.first().type]++; while (rightQueue.size() > 0 && rightQueue.peek().right == i) { set.remove(rightQueue.poll()); } } System.out.print(counts[0] + " " + counts[1] + " " + counts[2]); } static class Order { int idx; int left; int right; int type; public Order (int idx, int left, int right, char typeC) { this.idx = idx; this.left = left; this.right = right; if (typeC == 'Y') { type = 0; } else if (typeC == 'K') { type = 1; } else { type = 2; } } public int hashCode() { return idx; } public boolean equals(Object o) { Order or = (Order) o; return idx == or.idx; } } }