Submission #928287


Source Code Expand

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7

def f():
    n = int(input())
    a,b = 0,0
    t = 0
    for _ in range(n):
        l,r = list(map(int, input().split()))
        k = l+r
        c = t//k + k
        ll = c//k * l
        rr = c//k * r
        if ll < a:
            s = a - ll
            ss = (s // l)
            if ss * l + ll < a:
                ss += 1
            ll += l*ss
            rr += r*ss
        if rr < b:
            s = b - rr
            ss = (s // r)
            if ss * r + r < b:
                ss += 1
            ll += l*ss
            rr += r*ss
        a = ll
        b = rr
        t = ll + rr
    return t

print(f())

Submission Info

Submission Time
Task C - AtCoDeer and Election Report
User iehn
Language Python (3.4.3)
Score 0
Code Size 803 Byte
Status WA
Exec Time 89 ms
Memory 7556 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 6
WA × 9
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 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 AC 89 ms 7556 KB
0_001.txt AC 52 ms 5400 KB
0_002.txt AC 53 ms 5392 KB
1_003.txt AC 52 ms 5396 KB
1_004.txt AC 56 ms 5524 KB
1_005.txt WA 53 ms 5520 KB
1_006.txt WA 54 ms 5528 KB
1_007.txt WA 53 ms 5392 KB
1_008.txt WA 52 ms 5396 KB
1_009.txt WA 53 ms 5396 KB
1_010.txt WA 52 ms 5392 KB
1_011.txt WA 52 ms 5392 KB
1_012.txt WA 53 ms 5392 KB
1_013.txt WA 58 ms 5520 KB
1_014.txt AC 57 ms 5528 KB