結果

問題 No.945 YKC饅頭
ユーザー maspymaspy
提出日時 2020-03-07 03:31:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,272 ms / 2,000 ms
コード長 695 bytes
コンパイル時間 367 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 55,424 KB
最終ジャッジ日時 2024-04-22 11:47:30
合計ジャッジ時間 26,233 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 30 ms
10,624 KB
testcase_02 AC 31 ms
10,624 KB
testcase_03 AC 32 ms
10,880 KB
testcase_04 AC 30 ms
10,624 KB
testcase_05 AC 31 ms
10,752 KB
testcase_06 AC 33 ms
11,008 KB
testcase_07 AC 31 ms
10,752 KB
testcase_08 AC 31 ms
10,752 KB
testcase_09 AC 31 ms
11,008 KB
testcase_10 AC 32 ms
10,880 KB
testcase_11 AC 31 ms
10,880 KB
testcase_12 AC 32 ms
11,008 KB
testcase_13 AC 32 ms
11,008 KB
testcase_14 AC 33 ms
10,880 KB
testcase_15 AC 30 ms
10,752 KB
testcase_16 AC 30 ms
10,880 KB
testcase_17 AC 32 ms
10,880 KB
testcase_18 AC 32 ms
11,008 KB
testcase_19 AC 31 ms
10,880 KB
testcase_20 AC 31 ms
10,752 KB
testcase_21 AC 31 ms
10,624 KB
testcase_22 AC 34 ms
11,008 KB
testcase_23 AC 35 ms
11,008 KB
testcase_24 AC 34 ms
11,008 KB
testcase_25 AC 34 ms
11,008 KB
testcase_26 AC 34 ms
11,136 KB
testcase_27 AC 31 ms
10,880 KB
testcase_28 AC 31 ms
10,752 KB
testcase_29 AC 30 ms
10,752 KB
testcase_30 AC 30 ms
10,752 KB
testcase_31 AC 87 ms
14,592 KB
testcase_32 AC 134 ms
19,712 KB
testcase_33 AC 282 ms
26,752 KB
testcase_34 AC 440 ms
33,792 KB
testcase_35 AC 1,031 ms
48,640 KB
testcase_36 AC 503 ms
35,072 KB
testcase_37 AC 431 ms
32,896 KB
testcase_38 AC 430 ms
31,744 KB
testcase_39 AC 192 ms
20,736 KB
testcase_40 AC 219 ms
24,192 KB
testcase_41 AC 133 ms
18,816 KB
testcase_42 AC 650 ms
41,600 KB
testcase_43 AC 414 ms
32,512 KB
testcase_44 AC 625 ms
40,960 KB
testcase_45 AC 642 ms
43,264 KB
testcase_46 AC 85 ms
15,872 KB
testcase_47 AC 451 ms
34,176 KB
testcase_48 AC 115 ms
15,744 KB
testcase_49 AC 280 ms
24,576 KB
testcase_50 AC 672 ms
45,312 KB
testcase_51 AC 1,145 ms
55,296 KB
testcase_52 AC 1,272 ms
55,296 KB
testcase_53 AC 995 ms
55,296 KB
testcase_54 AC 923 ms
55,296 KB
testcase_55 AC 1,257 ms
55,424 KB
testcase_56 AC 182 ms
24,832 KB
testcase_57 AC 151 ms
24,832 KB
testcase_58 AC 656 ms
44,544 KB
testcase_59 AC 759 ms
49,024 KB
testcase_60 AC 372 ms
33,664 KB
testcase_61 AC 691 ms
45,952 KB
testcase_62 AC 660 ms
45,184 KB
testcase_63 AC 150 ms
25,088 KB
testcase_64 AC 383 ms
34,560 KB
testcase_65 AC 334 ms
32,384 KB
testcase_66 AC 328 ms
31,872 KB
testcase_67 AC 523 ms
39,552 KB
testcase_68 AC 396 ms
33,792 KB
testcase_69 AC 223 ms
27,648 KB
testcase_70 AC 239 ms
28,416 KB
testcase_71 AC 243 ms
28,544 KB
testcase_72 AC 455 ms
36,608 KB
testcase_73 AC 740 ms
47,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heappop, heappush

# %%
N, M = map(int, readline().split())
L_to_IRT = [[] for _ in range(N+1)]
for i in range(M):
    L, R, T = readline().decode().split()
    L = int(L)
    R = int(R)
    L_to_IRT[L].append((i,R,T))


# %%
q = []
Y = 0
K = 0
C = 0
for L, IRT in enumerate(L_to_IRT):
    for x in IRT:
        heappush(q, x)
    while q and q[0][1] < L:
        heappop(q)
    if not q:
        continue
    x = q[0][2]
    if x == 'Y':
        Y += 1
    elif x == 'K':
        K += 1
    else:
        C += 1


# %%
print(Y,K,C)
0