結果
| 問題 | No.568 じゃんじゃん 落とす 委員会 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-01-16 02:43:23 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 286 ms / 1,000 ms |
| コード長 | 725 bytes |
| 記録 | |
| コンパイル時間 | 221 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 100,872 KB |
| 最終ジャッジ日時 | 2026-05-29 02:30:53 |
| 合計ジャッジ時間 | 8,288 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
ソースコード
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)