結果
問題 |
No.568 じゃんじゃん 落とす 委員会
|
ユーザー |
![]() |
提出日時 | 2020-03-22 06:21:16 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,115 bytes |
コンパイル時間 | 107 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 44,444 KB |
最終ジャッジ日時 | 2024-12-24 16:38:07 |
合計ジャッジ時間 | 12,684 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 RE * 2 |
ソースコード
#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, M = map(int, readline().split()) m = map(int, read().split()) X, A, B = zip(*zip(m, m, m)) X = list(X) U = 10 ** 5 + 1 A_to_I = [[] for _ in range(U)] B_to_I = [[] for _ in range(U)] for i, a in enumerate(A): A_to_I[a].append(i) for i, b in enumerate(B): B_to_I[b].append(i) A = 10 ** 5 + 1 B = 10 ** 5 + 1 counts = [0, 0, 0, 0, 0, 0] for x in X: counts[x] += 1 while sum(counts[2:]) < M: A -= 1 for i in A_to_I[A]: counts[X[i]] -= 1 X[i] += 1 counts[X[i]] += 1 answer = sum(counts[3:]) while True: if A == U: break for i in A_to_I[A]: counts[X[i]] -= 1 X[i] -= 1 counts[X[i]] += 1 A += 1 while B > 0 and sum(counts[2:]) < M: B -= 1 for i in B_to_I[B]: counts[X[i]] -= 1 X[i] += 1 counts[X[i]] += 1 if sum(counts[2:]) < M: break if answer > sum(counts[3:]): answer = sum(counts[3:]) print(answer)