結果
問題 | No.945 YKC饅頭 |
ユーザー | 👑 rin204 |
提出日時 | 2022-02-11 21:11:28 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 901 ms / 2,000 ms |
コード長 | 1,773 bytes |
コンパイル時間 | 189 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 133,968 KB |
最終ジャッジ日時 | 2024-06-27 16:23:39 |
合計ジャッジ時間 | 28,229 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 42 ms
52,864 KB |
testcase_01 | AC | 41 ms
53,248 KB |
testcase_02 | AC | 51 ms
61,056 KB |
testcase_03 | AC | 91 ms
76,056 KB |
testcase_04 | AC | 48 ms
59,904 KB |
testcase_05 | AC | 55 ms
62,300 KB |
testcase_06 | AC | 69 ms
67,968 KB |
testcase_07 | AC | 62 ms
65,920 KB |
testcase_08 | AC | 44 ms
54,272 KB |
testcase_09 | AC | 62 ms
65,536 KB |
testcase_10 | AC | 67 ms
67,072 KB |
testcase_11 | AC | 58 ms
64,000 KB |
testcase_12 | AC | 59 ms
64,896 KB |
testcase_13 | AC | 78 ms
72,448 KB |
testcase_14 | AC | 79 ms
72,704 KB |
testcase_15 | AC | 62 ms
65,792 KB |
testcase_16 | AC | 51 ms
61,056 KB |
testcase_17 | AC | 87 ms
75,964 KB |
testcase_18 | AC | 68 ms
67,968 KB |
testcase_19 | AC | 44 ms
54,144 KB |
testcase_20 | AC | 51 ms
60,800 KB |
testcase_21 | AC | 55 ms
62,336 KB |
testcase_22 | AC | 94 ms
76,288 KB |
testcase_23 | AC | 93 ms
76,524 KB |
testcase_24 | AC | 88 ms
76,288 KB |
testcase_25 | AC | 94 ms
76,280 KB |
testcase_26 | AC | 90 ms
75,956 KB |
testcase_27 | AC | 44 ms
53,504 KB |
testcase_28 | AC | 44 ms
53,632 KB |
testcase_29 | AC | 42 ms
52,480 KB |
testcase_30 | AC | 42 ms
52,480 KB |
testcase_31 | AC | 189 ms
82,044 KB |
testcase_32 | AC | 144 ms
86,528 KB |
testcase_33 | AC | 342 ms
97,096 KB |
testcase_34 | AC | 491 ms
103,760 KB |
testcase_35 | AC | 765 ms
126,276 KB |
testcase_36 | AC | 530 ms
102,696 KB |
testcase_37 | AC | 496 ms
100,196 KB |
testcase_38 | AC | 487 ms
100,112 KB |
testcase_39 | AC | 277 ms
89,484 KB |
testcase_40 | AC | 254 ms
92,160 KB |
testcase_41 | AC | 164 ms
85,376 KB |
testcase_42 | AC | 701 ms
113,744 KB |
testcase_43 | AC | 462 ms
100,500 KB |
testcase_44 | AC | 601 ms
113,028 KB |
testcase_45 | AC | 720 ms
116,140 KB |
testcase_46 | AC | 130 ms
82,392 KB |
testcase_47 | AC | 495 ms
106,080 KB |
testcase_48 | AC | 232 ms
83,068 KB |
testcase_49 | AC | 332 ms
94,328 KB |
testcase_50 | AC | 752 ms
118,604 KB |
testcase_51 | AC | 866 ms
133,020 KB |
testcase_52 | AC | 858 ms
133,056 KB |
testcase_53 | AC | 856 ms
133,268 KB |
testcase_54 | AC | 894 ms
133,096 KB |
testcase_55 | AC | 886 ms
133,968 KB |
testcase_56 | AC | 89 ms
89,856 KB |
testcase_57 | AC | 66 ms
76,416 KB |
testcase_58 | AC | 812 ms
113,708 KB |
testcase_59 | AC | 880 ms
115,916 KB |
testcase_60 | AC | 537 ms
103,556 KB |
testcase_61 | AC | 775 ms
113,684 KB |
testcase_62 | AC | 901 ms
114,304 KB |
testcase_63 | AC | 120 ms
91,008 KB |
testcase_64 | AC | 699 ms
105,456 KB |
testcase_65 | AC | 550 ms
102,444 KB |
testcase_66 | AC | 526 ms
101,720 KB |
testcase_67 | AC | 651 ms
108,316 KB |
testcase_68 | AC | 722 ms
105,356 KB |
testcase_69 | AC | 280 ms
95,564 KB |
testcase_70 | AC | 352 ms
96,800 KB |
testcase_71 | AC | 333 ms
97,376 KB |
testcase_72 | AC | 755 ms
107,664 KB |
testcase_73 | AC | 863 ms
116,040 KB |
ソースコード
import heapq class Heapq: def __init__(self, lst = [], reverse = False): if reverse: self.pm = -1 self.hq = [-l for l in lst] else: self.pm = 1 self.hq = lst.copy() heapq.heapify(self.hq) self.tot = sum(lst) self.rm = [] self.length = len(lst) def __bool__(self): return self.length > 0 def __len__(self): return self.length def __getitem__(self, i): if i == 0: return self.top() else: assert False def push(self, x): self.length += 1 heapq.heappush(self.hq, x * self.pm) self.tot += x def pop(self): self.length -= 1 ret = heapq.heappop(self.hq) self.tot -= self.pm * ret self.delete() return self.pm * ret def top(self): return self.pm * self.hq[0] def remove(self, x): # 存在しないものを消そうとするとバグる self.length -= 1 self.tot -= x heapq.heappush(self.rm, self.pm * x) self.delete() def delete(self): while self.rm and self.rm[0] == self.hq[0]: heapq.heappop(self.rm) heapq.heappop(self.hq) n, m = map(int, input().split()) add = [[] for _ in range(n)] rem = [[] for _ in range(n)] T = [""] * m for i in range(m): l, r, t = input().split() T[i] = t add[int(l) - 1].append(i) rem[int(r) - 1].append(i) ans = {"Y":0, "K":0, "C":0} hq = Heapq() for i in range(n): for j in add[i]: hq.push(j) if hq: t = T[hq[0]] ans[t] += 1 for j in rem[i]: hq.remove(j) print(ans["Y"], ans["K"], ans["C"])