Submission #929506


Source Code Expand

Copy
import math

N = int(input())
X, Y = map(int, input().split())
for i in range(N - 1):
    T, A = map(int, input().split())
    if T >= X and A >= Y:
        X = T
        Y = A
    else:
        t = math.ceil(X / T)
        a = math.ceil(Y / A)
        X = T * max(a, t)
        Y = A * max(a, t)
print(X + Y)

Submission Info

Submission Time
Task C - AtCoDeer and Election Report
User poyodr
Language Python3 (3.4.3)
Score 0
Code Size 325 Byte
Status
Exec Time 27 ms
Memory 3064 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_000.txt, 0_001.txt, 0_002.txt
All 0 / 300 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt
Case Name Status Exec Time Memory
0_000.txt 22 ms 3064 KB
0_001.txt 22 ms 3064 KB
0_002.txt 22 ms 3064 KB
1_003.txt 22 ms 3064 KB
1_004.txt 25 ms 3064 KB
1_005.txt 23 ms 3064 KB
1_006.txt 24 ms 3064 KB
1_007.txt 23 ms 3064 KB
1_008.txt 23 ms 3064 KB
1_009.txt 22 ms 3064 KB
1_010.txt 22 ms 3064 KB
1_011.txt 22 ms 3064 KB
1_012.txt 23 ms 3064 KB
1_013.txt 27 ms 3064 KB
1_014.txt 27 ms 3064 KB