結果

問題 No.568 じゃんじゃん 落とす 委員会
ユーザー Ryoma IshiiRyoma Ishii
提出日時 2024-01-16 02:43:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 392 ms / 1,000 ms
コード長 725 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 95,324 KB
最終ジャッジ日時 2024-01-16 02:43:33
合計ジャッジ時間 8,697 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 345 ms
94,712 KB
testcase_01 AC 341 ms
94,708 KB
testcase_02 AC 136 ms
82,756 KB
testcase_03 AC 137 ms
82,776 KB
testcase_04 AC 151 ms
82,760 KB
testcase_05 AC 125 ms
82,880 KB
testcase_06 AC 158 ms
82,768 KB
testcase_07 AC 140 ms
82,756 KB
testcase_08 AC 109 ms
82,776 KB
testcase_09 AC 124 ms
83,004 KB
testcase_10 AC 122 ms
83,004 KB
testcase_11 AC 145 ms
82,760 KB
testcase_12 AC 339 ms
94,152 KB
testcase_13 AC 387 ms
94,592 KB
testcase_14 AC 389 ms
94,252 KB
testcase_15 AC 392 ms
95,324 KB
testcase_16 AC 369 ms
95,080 KB
testcase_17 AC 351 ms
94,248 KB
testcase_18 AC 363 ms
94,532 KB
testcase_19 AC 369 ms
94,416 KB
testcase_20 AC 383 ms
94,552 KB
testcase_21 AC 371 ms
94,248 KB
testcase_22 AC 331 ms
94,856 KB
testcase_23 AC 141 ms
82,760 KB
testcase_24 AC 131 ms
82,884 KB
testcase_25 AC 126 ms
82,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
W=10**5+10
C=[0,0,0,0,0,0]
A=[[] for i in range(W)]
B=[[] for i in range(W)]
Student=[]

for i in range(N):
    x,a,b=map(int,input().split())
    Student.append(x+1)
    A[a].append(i)
    B[b].append(i)
    C[x+1]+=1
#print(C)   
SA=0
SB=W
ans=W
while True:
    if SA>=W:
        break
    #print(SA,SB,C)
    if sum(C[2:])>=M and sum(C[3:])<ans:
        ans=sum(C[3:])
    
    for ids in A[SA]:
        C[Student[ids]]-=1
        Student[ids]-=1
        C[Student[ids]]+=1
    SA+=1
    
    while SB>0 and sum(C[2:])<M:
        #print(C,sum(C[2:]),M)
        SB-=1
        for ids in B[SB]:
            C[Student[ids]]-=1
            Student[ids]+=1
            C[Student[ids]]+=1
print(ans)
0