結果

問題 No.568 じゃんじゃん 落とす 委員会
ユーザー vwxyzvwxyz
提出日時 2022-05-18 00:21:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,048 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 10,976 KB
実行使用メモリ 46,252 KB
最終ジャッジ日時 2023-10-14 03:45:58
合計ジャッジ時間 18,118 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 762 ms
45,776 KB
testcase_01 AC 763 ms
45,840 KB
testcase_02 AC 302 ms
31,468 KB
testcase_03 AC 301 ms
31,272 KB
testcase_04 AC 301 ms
31,228 KB
testcase_05 AC 242 ms
31,352 KB
testcase_06 AC 300 ms
31,300 KB
testcase_07 AC 301 ms
31,396 KB
testcase_08 AC 220 ms
31,164 KB
testcase_09 AC 253 ms
31,096 KB
testcase_10 AC 246 ms
31,280 KB
testcase_11 AC 310 ms
31,308 KB
testcase_12 AC 743 ms
45,892 KB
testcase_13 AC 980 ms
46,252 KB
testcase_14 AC 905 ms
45,688 KB
testcase_15 TLE -
testcase_16 AC 849 ms
44,960 KB
testcase_17 AC 738 ms
44,916 KB
testcase_18 AC 897 ms
44,976 KB
testcase_19 AC 935 ms
45,860 KB
testcase_20 AC 764 ms
45,488 KB
testcase_21 TLE -
testcase_22 AC 774 ms
45,556 KB
testcase_23 AC 304 ms
31,400 KB
testcase_24 AC 252 ms
31,452 KB
testcase_25 AC 254 ms
31,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline

N,M=map(int,readline().split())
X,A,B=[],[],[]
idx=[set() 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)
    idx[a].add(i)
    idx[b].add(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