結果
| 問題 | 
                            No.945 YKC饅頭
                             | 
                    
| コンテスト | |
| ユーザー | 
                             mkawa2
                         | 
                    
| 提出日時 | 2019-12-12 09:44:57 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1,123 ms / 2,000 ms | 
| コード長 | 810 bytes | 
| コンパイル時間 | 719 ms | 
| コンパイル使用メモリ | 82,560 KB | 
| 実行使用メモリ | 136,576 KB | 
| 最終ジャッジ日時 | 2024-06-24 19:32:10 | 
| 合計ジャッジ時間 | 21,607 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 74 | 
ソースコード
from heapq import *
from collections import defaultdict
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def main():
    n, m = MI()
    to = defaultdict(list)
    ttomark = {"Y": 0, "K": 1, "C": 2}
    for p in range(m):
        l, r, t = input().split()
        l, r = int(l) - 1, int(r) - 1
        to[l].append([p, r, ttomark[t]])
    hp = []
    ans = [0] * 3
    for i in range(n):
        for prm in to[i]:
            heappush(hp, prm)
        while hp and hp[0][1] < i: heappop(hp)
        if not hp:continue
        ans[hp[0][2]] += 1
    print(*ans)
main()
            
            
            
        
            
mkawa2