結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー roiti46
提出日時 2016-10-14 22:59:50
言語 Python2
(2.7.18)
結果
AC  
実行時間 896 ms / 4,000 ms
コード長 516 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 6,948 KB
実行使用メモリ 45,060 KB
最終ジャッジ日時 2024-11-22 08:57:03
合計ジャッジ時間 31,808 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 48
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll
import heapq

N, K = map(int, raw_input().split())
SPU = [map(int, raw_input().split()) for i in xrange(N)]
SPU = [[S, P, U, i] for i, (S, P, U) in enumerate(SPU)]
SPU.sort(key = lambda x: x[1])
SPU.sort(key = lambda x: -x[0])

C = [0]*100005
ans = []
for S, P, U, i in SPU:
    ans.append([10**18*(S + 1) - C[U]*10**8 + 10**7 - P, i])
    C[U] += 1
ans.sort(reverse = True)

for _, i in ans[:K]:
    print i
0