結果

問題 No.568 じゃんじゃん 落とす 委員会
ユーザー Yuki IwatakeYuki Iwatake
提出日時 2021-04-25 16:07:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 630 bytes
コンパイル時間 68 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 30,248 KB
最終ジャッジ日時 2023-09-17 14:06:59
合計ジャッジ時間 11,868 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 646 ms
30,124 KB
testcase_01 AC 642 ms
30,128 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 182 ms
22,512 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 183 ms
22,484 KB
testcase_10 AC 181 ms
22,360 KB
testcase_11 RE -
testcase_12 AC 642 ms
30,036 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 AC 619 ms
29,724 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 WA -
testcase_23 RE -
testcase_24 AC 182 ms
22,416 KB
testcase_25 AC 184 ms
22,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
W = 10**5+1
X = []
C = [0,0,0,0,0]
A = [[] for _ in range(W)]
B = [[] for _ in range(W)]
for n in range(N):
    x,a,b = map(int,input().split())
    X.append(x+1)
    C[x+1] += 1
    A[a].append(n)
    B[b].append(n)
SA = 0; SB = W
ans = W
while True:
    if SA >= W:
        break
    if sum(C[2:])>=M and sum(C[3:])<ans:
        ans = sum(C[3:])
    for a in A[SA]:
        C[X[a]] -= 1
        X[a] -= 1
        C[X[a]] += 1
    SA += 1
    while SB > 0 and sum(C[2:]) < M:
        SB -= 1
        for b in B[SB]:
            C[X[b]] -= 1
            X[b] += 1
            C[X[b]] += 1
print(ans)
0