Submission #66353335
Source Code Expand
Copy
T = int(input())for i in range(T):A, B, C, D = map(int, input().split(' '))ln, ld, rn, rd = 0, 1, 1, 0while True:mn, md = ln + rn, ld + rdif mn * B <= md * A:ln, ld = mn, mdelif mn * D >= md * C:rn, rd = mn, mdelse:print(md)break
T = int(input())
for i in range(T):
A, B, C, D = map(int, input().split(' '))
ln, ld, rn, rd = 0, 1, 1, 0
while True:
mn, md = ln + rn, ld + rd
if mn * B <= md * A:
ln, ld = mn, md
elif mn * D >= md * C:
rn, rd = mn, md
else:
print(md)
break
Submission Info
| Submission Time | |
|---|---|
| Task | G - A/B < p/q < C/D |
| User | lX57 |
| Language | Python (PyPy 3.10-v7.3.12) |
| Score | 0 |
| Code Size | 353 Byte |
| Status | TLE |
| Exec Time | 2216 ms |
| Memory | 86436 KiB |
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 625 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt |
| All | 00_sample_00.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 01_handmade_08.txt, 01_handmade_09.txt, 01_handmade_10.txt, 01_handmade_11.txt, 01_handmade_12.txt, 01_handmade_13.txt, 01_handmade_14.txt, 01_handmade_15.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 61 ms | 76508 KiB |
| 01_handmade_00.txt | AC | 217 ms | 84848 KiB |
| 01_handmade_01.txt | AC | 73 ms | 81296 KiB |
| 01_handmade_02.txt | AC | 1362 ms | 84564 KiB |
| 01_handmade_03.txt | TLE | 2216 ms | 85876 KiB |
| 01_handmade_04.txt | TLE | 2213 ms | 85996 KiB |
| 01_handmade_05.txt | AC | 511 ms | 83000 KiB |
| 01_handmade_06.txt | TLE | 2212 ms | 80484 KiB |
| 01_handmade_07.txt | TLE | 2212 ms | 84976 KiB |
| 01_handmade_08.txt | TLE | 2212 ms | 85320 KiB |
| 01_handmade_09.txt | TLE | 2211 ms | 81572 KiB |
| 01_handmade_10.txt | TLE | 2211 ms | 81724 KiB |
| 01_handmade_11.txt | TLE | 2211 ms | 81460 KiB |
| 01_handmade_12.txt | TLE | 2211 ms | 81688 KiB |
| 01_handmade_13.txt | TLE | 2211 ms | 81824 KiB |
| 01_handmade_14.txt | TLE | 2211 ms | 80520 KiB |
| 01_handmade_15.txt | TLE | 2211 ms | 80436 KiB |
| 02_random_00.txt | AC | 1834 ms | 85796 KiB |
| 02_random_01.txt | AC | 1597 ms | 85088 KiB |
| 02_random_02.txt | TLE | 2210 ms | 85832 KiB |
| 02_random_03.txt | TLE | 2214 ms | 86168 KiB |
| 02_random_04.txt | AC | 1753 ms | 85472 KiB |
| 02_random_05.txt | AC | 1660 ms | 84944 KiB |
| 02_random_06.txt | TLE | 2135 ms | 86364 KiB |
| 02_random_07.txt | TLE | 2184 ms | 85932 KiB |
| 02_random_08.txt | TLE | 2166 ms | 86436 KiB |
| 02_random_09.txt | TLE | 2203 ms | 86404 KiB |
| 02_random_10.txt | AC | 1990 ms | 85964 KiB |
| 02_random_11.txt | AC | 1973 ms | 85992 KiB |
| 02_random_12.txt | TLE | 2033 ms | 85980 KiB |
| 02_random_13.txt | AC | 1996 ms | 86240 KiB |
| 02_random_14.txt | TLE | 2206 ms | 86260 KiB |
| 02_random_15.txt | AC | 1981 ms | 86028 KiB |
| 02_random_16.txt | AC | 465 ms | 84796 KiB |
| 02_random_17.txt | AC | 465 ms | 86036 KiB |