Submission #67728190
Source Code Expand
Copy
n, m = map(int, input().split())a = [0] * mb = [0] * mfor i in range(m):a[i], b[i] = map(int, input().split())full = nemp = 0answer = 0C = sorted(zip(a, b), key=lambda x: (x[1] // x[0], x[1] - x[0]), reverse=True)while True:emp += fullfull = 0c = Falsefor A, B in C:if emp >= A:emp -= Afull += Banswer += 1c = Truebreakif not c:
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
for i in range(m):
a[i], b[i] = map(int, input().split())
full = n
emp = 0
answer = 0
C = sorted(zip(a, b), key=lambda x: (x[1] // x[0], x[1] - x[0]), reverse=True)
while True:
emp += full
full = 0
c = False
for A, B in C:
if emp >= A:
emp -= A
full += B
answer += 1
c = True
break
if not c:
break
print(answer)
Submission Info
| Submission Time | |
|---|---|
| Task | D - Get Many Stickers |
| User | practicejoi |
| Language | Python (PyPy 3.10-v7.3.12) |
| Score | 0 |
| Code Size | 490 Byte |
| Status | TLE |
| Exec Time | 2212 ms |
| Memory | 115652 KiB |
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 400 | ||||||
| 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_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 02_random2_09.txt, 02_random2_10.txt, 02_random2_11.txt, 03_random3_00.txt, 03_random3_01.txt, 03_random3_02.txt, 03_random3_03.txt, 03_random3_04.txt, 04_handmade_00.txt, 04_handmade_01.txt, 04_handmade_02.txt, 04_handmade_03.txt, 04_handmade_04.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 58 ms | 76456 KiB |
| 00_sample_01.txt | AC | 57 ms | 76464 KiB |
| 00_sample_02.txt | AC | 57 ms | 76376 KiB |
| 01_random_00.txt | AC | 287 ms | 98292 KiB |
| 01_random_01.txt | AC | 428 ms | 104872 KiB |
| 01_random_02.txt | AC | 466 ms | 108836 KiB |
| 01_random_03.txt | TLE | 2212 ms | 115532 KiB |
| 01_random_04.txt | TLE | 2212 ms | 115548 KiB |
| 01_random_05.txt | TLE | 2212 ms | 115652 KiB |
| 02_random2_00.txt | TLE | 2212 ms | 106400 KiB |
| 02_random2_01.txt | TLE | 2212 ms | 106924 KiB |
| 02_random2_02.txt | TLE | 2212 ms | 106580 KiB |
| 02_random2_03.txt | TLE | 2212 ms | 106600 KiB |
| 02_random2_04.txt | TLE | 2212 ms | 106652 KiB |
| 02_random2_05.txt | TLE | 2212 ms | 106496 KiB |
| 02_random2_06.txt | TLE | 2212 ms | 115296 KiB |
| 02_random2_07.txt | TLE | 2212 ms | 115488 KiB |
| 02_random2_08.txt | TLE | 2212 ms | 115368 KiB |
| 02_random2_09.txt | TLE | 2212 ms | 114660 KiB |
| 02_random2_10.txt | TLE | 2212 ms | 114764 KiB |
| 02_random2_11.txt | TLE | 2212 ms | 114756 KiB |
| 03_random3_00.txt | TLE | 2212 ms | 114704 KiB |
| 03_random3_01.txt | TLE | 2212 ms | 114440 KiB |
| 03_random3_02.txt | TLE | 2212 ms | 114392 KiB |
| 03_random3_03.txt | TLE | 2212 ms | 114740 KiB |
| 03_random3_04.txt | TLE | 2212 ms | 114776 KiB |
| 04_handmade_00.txt | AC | 154 ms | 115076 KiB |
| 04_handmade_01.txt | TLE | 2212 ms | 115524 KiB |
| 04_handmade_02.txt | AC | 57 ms | 76436 KiB |
| 04_handmade_03.txt | AC | 57 ms | 76536 KiB |
| 04_handmade_04.txt | AC | 195 ms | 115560 KiB |