結果

問題 No.1708 Quality of Contest
ユーザー gma712gma712
提出日時 2021-11-08 21:02:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 743 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 90,464 KB
最終ジャッジ日時 2024-04-28 07:24:37
合計ジャッジ時間 6,285 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
17,572 KB
testcase_01 AC 27 ms
10,752 KB
testcase_02 AC 30 ms
10,624 KB
testcase_03 AC 121 ms
11,904 KB
testcase_04 AC 100 ms
12,032 KB
testcase_05 AC 134 ms
11,904 KB
testcase_06 AC 96 ms
11,776 KB
testcase_07 AC 86 ms
11,776 KB
testcase_08 AC 28 ms
10,752 KB
testcase_09 TLE -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N, M, X = map(int, input().split(' '))
    ABs = [tuple(map(int, input().split(' '))) for _ in range(N)]
    K = int(input())
    Cs = list(map(int, input().split(' ')))

    genre_qualities = dict()
    for AB in ABs:
        if AB[1] in genre_qualities:
            genre_qualities[AB[1]] += [AB[0]]
        else:
            genre_qualities[AB[1]] = [AB[0]]

    values = []
    for k in genre_qualities.keys():
        genre_qualities[k] = sorted(genre_qualities[k], reverse=True)
        genre_qualities[k][0] += X
        values += genre_qualities[k]

    maximized = sorted(values, reverse=True)
    satisfactions = [sum(maximized[:C]) for C in Cs]

    print(sum(satisfactions))

if __name__ == '__main__':
    main()
0