Submission #36838808
Source Code Expand
import sys
input = lambda: sys.stdin.readline().rstrip()
N = int(input())
X = []
Y = []
min_X = 10 ** 10
best_X = (-1, -1)
min_Y = 10 ** 10
best_Y = (-1, -1)
for _ in range(N):
a, b, c = map(int, input().split())
a /= c
b /= c
if a >= b:
X.append((a, b))
if a + b < min_X:
min_X = a + b
best_X = (a, b)
else:
Y.append((a, b))
if a + b < min_Y:
min_Y = a + b
best_Y = (a, b)
ans = 0
for a, b in X + Y:
ans = max(ans, 1 / max(a, b))
if X and Y:
a, b = best_X
for aa, bb in Y:
ans = max(ans, ((aa - bb) - (a - b)) / (aa * b - a * bb))
a, b = best_Y
for aa, bb in X:
ans = max(ans, ((aa - bb) - (a - b)) / (aa * b - a * bb))
print(ans)
Submission Info
| Submission Time | |
|---|---|
| Task | G - Infinite Knapsack |
| User | Kiri8128 |
| Language | PyPy3 (7.3.0) |
| Score | 600 |
| Code Size | 804 Byte |
| Status | AC |
| Exec Time | 189 ms |
| Memory | 90996 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 600 / 600 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_01.txt, 00_sample_02.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, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt, 02_handmade_05.txt, 02_handmade_06.txt, 02_handmade_07.txt, 02_handmade_08.txt, 02_handmade_09.txt, 03_hack_01.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_01.txt | AC | 73 ms | 61744 KiB |
| 00_sample_02.txt | AC | 47 ms | 62004 KiB |
| 01_test_01.txt | AC | 183 ms | 88332 KiB |
| 01_test_02.txt | AC | 181 ms | 88292 KiB |
| 01_test_03.txt | AC | 182 ms | 90572 KiB |
| 01_test_04.txt | AC | 182 ms | 90364 KiB |
| 01_test_05.txt | AC | 182 ms | 90464 KiB |
| 01_test_06.txt | AC | 183 ms | 90564 KiB |
| 01_test_07.txt | AC | 186 ms | 90264 KiB |
| 01_test_08.txt | AC | 183 ms | 90280 KiB |
| 01_test_09.txt | AC | 185 ms | 90996 KiB |
| 01_test_10.txt | AC | 180 ms | 90636 KiB |
| 01_test_11.txt | AC | 181 ms | 90448 KiB |
| 01_test_12.txt | AC | 177 ms | 90544 KiB |
| 01_test_13.txt | AC | 183 ms | 90476 KiB |
| 01_test_14.txt | AC | 184 ms | 90604 KiB |
| 01_test_15.txt | AC | 180 ms | 90840 KiB |
| 01_test_16.txt | AC | 176 ms | 90468 KiB |
| 01_test_17.txt | AC | 189 ms | 90604 KiB |
| 01_test_18.txt | AC | 181 ms | 90976 KiB |
| 02_handmade_01.txt | AC | 46 ms | 61824 KiB |
| 02_handmade_02.txt | AC | 161 ms | 89716 KiB |
| 02_handmade_03.txt | AC | 169 ms | 89560 KiB |
| 02_handmade_04.txt | AC | 167 ms | 89696 KiB |
| 02_handmade_05.txt | AC | 169 ms | 89816 KiB |
| 02_handmade_06.txt | AC | 171 ms | 89716 KiB |
| 02_handmade_07.txt | AC | 169 ms | 89820 KiB |
| 02_handmade_08.txt | AC | 185 ms | 90504 KiB |
| 02_handmade_09.txt | AC | 182 ms | 90448 KiB |
| 03_hack_01.txt | AC | 115 ms | 79188 KiB |