結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 353 ms
95,036 KB
testcase_01 AC 332 ms
94,736 KB
testcase_02 AC 150 ms
82,752 KB
testcase_03 AC 148 ms
82,772 KB
testcase_04 AC 141 ms
82,756 KB
testcase_05 AC 124 ms
82,880 KB
testcase_06 AC 162 ms
82,768 KB
testcase_07 AC 139 ms
82,752 KB
testcase_08 AC 108 ms
82,772 KB
testcase_09 AC 122 ms
83,004 KB
testcase_10 AC 123 ms
83,004 KB
testcase_11 AC 136 ms
82,756 KB
testcase_12 AC 351 ms
94,152 KB
testcase_13 AC 376 ms
94,564 KB
testcase_14 AC 351 ms
94,312 KB
testcase_15 AC 410 ms
95,348 KB
testcase_16 AC 364 ms
95,144 KB
testcase_17 AC 316 ms
94,244 KB
testcase_18 AC 400 ms
94,564 KB
testcase_19 AC 360 ms
94,420 KB
testcase_20 AC 345 ms
94,556 KB
testcase_21 AC 401 ms
94,244 KB
testcase_22 WA -
testcase_23 AC 135 ms
82,756 KB
testcase_24 AC 120 ms
82,884 KB
testcase_25 AC 123 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=100000
ans=2**60
while SA<100000:
    #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