結果
問題 | No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい |
ユーザー | ichibanshibori |
提出日時 | 2016-10-14 23:39:00 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,474 bytes |
コンパイル時間 | 233 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 34,432 KB |
最終ジャッジ日時 | 2024-05-01 23:00:40 |
合計ジャッジ時間 | 11,138 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | -- | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
ソースコード
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