結果
問題 | No.1708 Quality of Contest |
ユーザー | FromBooska |
提出日時 | 2023-03-17 15:13:14 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 633 ms / 2,000 ms |
コード長 | 996 bytes |
コンパイル時間 | 164 ms |
コンパイル使用メモリ | 81,680 KB |
実行使用メモリ | 150,172 KB |
最終ジャッジ日時 | 2023-10-18 13:40:48 |
合計ジャッジ時間 | 14,005 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
53,520 KB |
testcase_01 | AC | 38 ms
53,520 KB |
testcase_02 | AC | 37 ms
53,520 KB |
testcase_03 | AC | 77 ms
74,472 KB |
testcase_04 | AC | 81 ms
76,608 KB |
testcase_05 | AC | 83 ms
76,668 KB |
testcase_06 | AC | 75 ms
73,656 KB |
testcase_07 | AC | 75 ms
73,676 KB |
testcase_08 | AC | 37 ms
53,520 KB |
testcase_09 | AC | 313 ms
150,172 KB |
testcase_10 | AC | 561 ms
136,948 KB |
testcase_11 | AC | 599 ms
136,960 KB |
testcase_12 | AC | 591 ms
137,676 KB |
testcase_13 | AC | 592 ms
137,228 KB |
testcase_14 | AC | 596 ms
139,060 KB |
testcase_15 | AC | 605 ms
144,320 KB |
testcase_16 | AC | 613 ms
144,736 KB |
testcase_17 | AC | 600 ms
138,336 KB |
testcase_18 | AC | 603 ms
139,296 KB |
testcase_19 | AC | 618 ms
141,412 KB |
testcase_20 | AC | 604 ms
138,432 KB |
testcase_21 | AC | 620 ms
140,564 KB |
testcase_22 | AC | 620 ms
139,812 KB |
testcase_23 | AC | 633 ms
144,104 KB |
testcase_24 | AC | 583 ms
137,872 KB |
testcase_25 | AC | 570 ms
137,880 KB |
ソースコード
# ナップザックの変形かと思ったが違うみたい # ABC116D Various Sushiのようにもできない # なんらかの貪欲法で並べることが必要 # 与えられたABリストを、初めてのグループであれば+X点として新リスト作成 # ソート、カウント累積和で高速化で総和計算 N, M, X = map(int, input().split()) AB = [] for i in range(N): a, b = map(int, input().split()) AB.append([a, b]) K = int(input()) C = list(map(int, input().split())) AB.sort(key = lambda x:x[0], reverse = True) #print(AB) genre = set() AB_adjusted = [] for a, b in AB: if b not in genre: genre.add(b) AB_adjusted.append(a+X) else: AB_adjusted.append(a) AB_adjusted.sort(reverse = True) count = [0]*(N+2) for c in C: count[1] += 1 count[c+1] -= 1 for i in range(1, N+2): count[i] += count[i-1] #print(AB_adjusted) #print(count) ans = 0 for i in range(N): ans += AB_adjusted[i]*count[i+1] print(ans)