Submission #2715068


Source Code Expand

program main
  implicit none
  integer(8) :: n, i, x, y
  integer(8), allocatable :: a(:), t(:)
  read(*, *) n
  allocate(a(n), t(n))
  do i = 1, n
    read(*, *) t(i), a(i)
  end do
  x = 1
  y = 1
  do i = 1, n
    call update(x, y, t(i), a(i))
  end do
  write(*, "(i0)") x + y
  deallocate(a, t)

  contains

  subroutine update(x, y, t, a)
    implicit none
    integer(8), intent(inout) :: x, y
    integer(8), intent(in) :: t, a
    integer(8) :: ma, mb, mult
    ma = x / t
    if (mod(x, t) > 0) ma = ma + 1
    mb = y / a
    if (mod(y, a) > 0) mb = mb + 1
    mult = max(ma, mb)
    x = t * mult
    y = a * mult
  end subroutine update
end

Submission Info

Submission Time
Task C - AtCoDeer and Election Report
User sen_7
Language Fortran (gfortran v4.8.4)
Score 300
Code Size 652 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 15
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 1 ms 256 KB
0_001.txt AC 1 ms 256 KB
0_002.txt AC 1 ms 256 KB
1_003.txt AC 1 ms 256 KB
1_004.txt AC 1 ms 256 KB
1_005.txt AC 1 ms 256 KB
1_006.txt AC 1 ms 256 KB
1_007.txt AC 1 ms 256 KB
1_008.txt AC 1 ms 256 KB
1_009.txt AC 1 ms 256 KB
1_010.txt AC 1 ms 256 KB
1_011.txt AC 1 ms 256 KB
1_012.txt AC 1 ms 256 KB
1_013.txt AC 1 ms 256 KB
1_014.txt AC 1 ms 256 KB