Submission #5732824


Source Code Expand

Copy
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
cards = [list(map(int, input().split())) for i in range(M)]

for card in cards:
    A += [card[1]]*card[0]
A.sort(reverse=True)

print(sum(A[:N]))

Submission Info

Submission Time
Task D - Integer Cards
User upura
Language PyPy3 (2.4.0)
Score 0
Code Size 231 Byte
Status
Exec Time 2111 ms
Memory 918072 KB

Test Cases

Set Name Score / Max Score Test Cases
All 0 / 400 sample_01, sample_02, sample_03, sample_04, 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
Sample 0 / 0 sample_01, sample_02, sample_03, sample_04
Case Name Status Exec Time Memory
sample_01 162 ms 38384 KB
sample_02 163 ms 38256 KB
sample_03 162 ms 38256 KB
sample_04 161 ms 38256 KB
testcase_01 731 ms 144772 KB
testcase_02 2109 ms 716940 KB
testcase_03 2110 ms 691376 KB
testcase_04 585 ms 65752 KB
testcase_05 161 ms 38256 KB
testcase_06 631 ms 93904 KB
testcase_07 681 ms 99224 KB
testcase_08 2110 ms 771860 KB
testcase_09 2110 ms 766568 KB
testcase_10 798 ms 194756 KB
testcase_11 2110 ms 736736 KB
testcase_12 2110 ms 918072 KB
testcase_13 2109 ms 717964 KB
testcase_14 2110 ms 691892 KB
testcase_15 2110 ms 722496 KB
testcase_16 381 ms 55900 KB
testcase_17 514 ms 78532 KB
testcase_18 523 ms 78532 KB
testcase_19 2111 ms 759120 KB
testcase_20 2111 ms 759248 KB