結果

問題 No.568 じゃんじゃん 落とす 委員会
ユーザー vwxyzvwxyz
提出日時 2022-05-18 00:22:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 984 ms / 1,000 ms
コード長 1,107 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 11,012 KB
実行使用メモリ 29,960 KB
最終ジャッジ日時 2023-10-14 03:46:58
合計ジャッジ時間 15,475 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 697 ms
29,884 KB
testcase_01 AC 686 ms
29,960 KB
testcase_02 AC 236 ms
15,488 KB
testcase_03 AC 230 ms
15,400 KB
testcase_04 AC 233 ms
15,404 KB
testcase_05 AC 181 ms
15,508 KB
testcase_06 AC 237 ms
15,484 KB
testcase_07 AC 238 ms
15,492 KB
testcase_08 AC 147 ms
15,480 KB
testcase_09 AC 179 ms
15,484 KB
testcase_10 AC 179 ms
15,548 KB
testcase_11 AC 234 ms
15,424 KB
testcase_12 AC 685 ms
29,552 KB
testcase_13 AC 901 ms
29,568 KB
testcase_14 AC 828 ms
29,404 KB
testcase_15 AC 984 ms
29,576 KB
testcase_16 AC 774 ms
29,012 KB
testcase_17 AC 652 ms
29,024 KB
testcase_18 AC 812 ms
28,916 KB
testcase_19 AC 866 ms
29,344 KB
testcase_20 AC 699 ms
29,236 KB
testcase_21 AC 914 ms
28,808 KB
testcase_22 AC 689 ms
29,956 KB
testcase_23 AC 227 ms
15,516 KB
testcase_24 AC 181 ms
15,440 KB
testcase_25 AC 179 ms
15,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline

N,M=map(int,readline().split())
X,A,B=[],[],[]
idx=[[] for i in range(10**5+1)]
for i in range(N):
    x,a,b=map(int,readline().split())
    X.append(x)
    A.append(a)
    B.append(b)
    if a==b:
        idx[a].append(i)
    else:
        idx[a].append(i)
        idx[b].append(i)
cnt=[0]*6
for x in X:
    cnt[x+1]+=1
b=10**5+1
ans=N
for a in range(10**5+2):
    if a:
        for i in idx[a-1]:
            x=X[i]
            if A[i]>=a-1:
                x+=1
            if B[i]>=b:
                x+=1
            cnt[x]-=1
            x=X[i]
            if A[i]>=a:
                x+=1
            if B[i]>=b:
                x+=1
            cnt[x]+=1
    while b and sum(cnt[2:])<M:
        for i in idx[b-1]:
            x=X[i]
            if A[i]>=a:
                x+=1
            if B[i]>=b:
                x+=1
            cnt[x]-=1
            x=X[i]
            if A[i]>=a:
                x+=1
            if B[i]>=b-1:
                x+=1
            cnt[x]+=1
        b-=1
    if sum(cnt[2:])>=M:
        ans=min(ans,sum(cnt[3:]))
print(ans)
0