結果
| 問題 |
No.1615 Double Down
|
| ユーザー |
qwewe
|
| 提出日時 | 2025-04-24 12:20:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 984 bytes |
| コンパイル時間 | 466 ms |
| コンパイル使用メモリ | 82,636 KB |
| 実行使用メモリ | 78,236 KB |
| 最終ジャッジ日時 | 2025-04-24 12:22:30 |
| 合計ジャッジ時間 | 6,886 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 45 |
ソースコード
def main():
import sys
input = sys.stdin.read().split()
idx = 0
N = int(input[idx]); idx +=1
M = int(input[idx]); idx +=1
K = int(input[idx]); idx +=1
L = int(input[idx]); idx +=1
edges = []
for _ in range(L):
X = int(input[idx]); idx +=1
Y = int(input[idx]); idx +=1
Z = int(input[idx]); idx +=1
weight = 1 << Z # 2^Z
edges.append((-weight, -Y, -X)) # Negative for descending sort
# Sort by weight descending, then Y descending, then X descending
edges.sort()
buyer_used = [False] * (N + 1)
item_used = [False] * (M + 1)
total = 0
for edge in edges:
weight_neg, y_neg, x_neg = edge
weight = -weight_neg
Y = -y_neg
X = -x_neg
if not buyer_used[X] and not item_used[Y]:
total += weight
buyer_used[X] = True
item_used[Y] = True
print(total)
if __name__ == '__main__':
main()
qwewe