Submission #63521808
Source Code Expand
Copy
n, m = map(int, input().split())A = list(map(int, input().split()))B = list(map(int, input().split()))A.sort()B.sort()# print(A)# print(B)ans = 0ca = 0while A:v = A[-1]if 0 <= v:ans += vca += 1A.pop()else:break
n, m = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) A.sort() B.sort() # print(A) # print(B) ans = 0 ca = 0 while A: v = A[-1] if 0 <= v: ans += v ca += 1 A.pop() else: break cb = 0 for i in range(ca): if B: v = B[-1] if 0 <= v: ans += v cb += 1 B.pop() else: break ans2 = ans for i in range(ca-cb): if B: v = B.pop() if 0 <= v: ans2 += v while A and B: a = A.pop() b = B.pop() c = a+b if 0 <= c: ans2 += c else: break print(max(ans, ans2))
Submission Info
Submission Time | |
---|---|
Task | C - Buy Balls |
User | Koopa |
Language | Python (PyPy 3.10-v7.3.12) |
Score | 300 |
Code Size | 647 Byte |
Status | AC |
Exec Time | 157 ms |
Memory | 126232 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt, 01_test_31.txt, 01_test_32.txt, 01_test_33.txt, 01_test_34.txt, 01_test_35.txt, 01_test_36.txt, 01_test_37.txt, 01_test_38.txt, 01_test_39.txt, 01_test_40.txt, 01_test_41.txt, 01_test_42.txt, 01_test_43.txt, 01_test_44.txt, 01_test_45.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 53 ms | 76488 KB |
00_sample_01.txt | AC | 55 ms | 76680 KB |
00_sample_02.txt | AC | 54 ms | 76408 KB |
01_test_00.txt | AC | 54 ms | 76500 KB |
01_test_01.txt | AC | 54 ms | 76508 KB |
01_test_02.txt | AC | 54 ms | 76488 KB |
01_test_03.txt | AC | 110 ms | 115920 KB |
01_test_04.txt | AC | 92 ms | 102912 KB |
01_test_05.txt | AC | 88 ms | 99820 KB |
01_test_06.txt | AC | 156 ms | 122588 KB |
01_test_07.txt | AC | 155 ms | 123160 KB |
01_test_08.txt | AC | 155 ms | 122784 KB |
01_test_09.txt | AC | 155 ms | 122828 KB |
01_test_10.txt | AC | 156 ms | 122688 KB |
01_test_11.txt | AC | 157 ms | 123600 KB |
01_test_12.txt | AC | 155 ms | 122996 KB |
01_test_13.txt | AC | 155 ms | 122784 KB |
01_test_14.txt | AC | 156 ms | 122468 KB |
01_test_15.txt | AC | 143 ms | 116844 KB |
01_test_16.txt | AC | 155 ms | 121068 KB |
01_test_17.txt | AC | 140 ms | 116140 KB |
01_test_18.txt | AC | 155 ms | 121808 KB |
01_test_19.txt | AC | 145 ms | 116188 KB |
01_test_20.txt | AC | 156 ms | 123952 KB |
01_test_21.txt | AC | 141 ms | 116068 KB |
01_test_22.txt | AC | 155 ms | 123272 KB |
01_test_23.txt | AC | 137 ms | 114880 KB |
01_test_24.txt | AC | 155 ms | 121076 KB |
01_test_25.txt | AC | 135 ms | 112468 KB |
01_test_26.txt | AC | 156 ms | 123056 KB |
01_test_27.txt | AC | 144 ms | 118780 KB |
01_test_28.txt | AC | 155 ms | 123468 KB |
01_test_29.txt | AC | 136 ms | 113140 KB |
01_test_30.txt | AC | 154 ms | 120304 KB |
01_test_31.txt | AC | 128 ms | 114908 KB |
01_test_32.txt | AC | 156 ms | 122660 KB |
01_test_33.txt | AC | 134 ms | 115824 KB |
01_test_34.txt | AC | 153 ms | 122780 KB |
01_test_35.txt | AC | 134 ms | 115340 KB |
01_test_36.txt | AC | 152 ms | 122080 KB |
01_test_37.txt | AC | 120 ms | 114868 KB |
01_test_38.txt | AC | 155 ms | 123120 KB |
01_test_39.txt | AC | 127 ms | 114336 KB |
01_test_40.txt | AC | 153 ms | 126232 KB |
01_test_41.txt | AC | 128 ms | 112540 KB |
01_test_42.txt | AC | 153 ms | 119952 KB |
01_test_43.txt | AC | 56 ms | 76308 KB |
01_test_44.txt | AC | 109 ms | 115868 KB |
01_test_45.txt | AC | 111 ms | 116792 KB |