結果
問題 |
No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
|
ユーザー |
|
提出日時 | 2016-10-14 23:39:00 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,474 bytes |
コンパイル時間 | 242 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 43,584 KB |
最終ジャッジ日時 | 2024-11-22 06:47:00 |
合計ジャッジ時間 | 189,528 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 TLE * 34 |
ソースコード
def get_max_S(team_lst): max_S = 0 for team in team_lst: _, S, _, _ = team if S > max_S: max_S = S return max_S def get_min_U(team_lst, school_dic): min_U = -1 for team in team_lst: _, _, _, U = team if U not in school_dic: return 0 elif min_U == -1 or school_dic[U] < min_U: min_U = school_dic[U] return min_U def get_min_P(team_lst): min_P = -1 for team in team_lst: _, _, P, _ = team if min_P == -1 or P < min_P: min_P = P return min_P def sel_next(team_lst, school_dic): max_S = get_max_S(team_lst) r1_lst = [r for r in team_lst if r[1] == max_S] if len(r1_lst) == 1: return r1_lst[0] min_U = get_min_U(r1_lst, school_dic) r2_lst = [r for r in r1_lst if school_dic.get(r[3], 0) == min_U] if len(r2_lst) == 1: return r2_lst[0] min_P = get_min_P(r2_lst) r3_lst = [r for r in r2_lst if r[2] == min_P] return r3_lst[0] N, K = tuple(int(i) for i in input().split()) team_lst = [] school_dic = {} for i in range(N): sn, pn, un = tuple(int(i) for i in input().split()) team_lst += [(i, sn, pn, un)] for i in range(K): next_team = sel_next(team_lst, school_dic) idx, _, _, u = next_team print(idx) school_dic[u] = school_dic.get(u, 0) + 1 for r in range(len(team_lst)): if team_lst[r][0] == idx: del team_lst[r] break