Contest Duration: - (local time) (100 minutes) Back to Home

Submission #6569075

Source Code Expand

Copy
```program city_savers
implicit none
integer :: n, i
integer(8) :: a(100001) = 0_8, b(100000) = 0_8, c(100001) = 0_8, m1 = 0_8, m2 = 0_8
c(1:n+1) = a(1:n+1)
do i = 1, n
if (b(i) <= c(i)) then
m1 = m1+b(i)
cycle
end if
if (b(i) <= c(i)+c(i+1)) then
m1 = m1+b(i)
c(i+1) = c(i)+c(i+1)-b(i)
cycle
end if
m1 = m1+c(i)+c(i+1)
c(i+1) = 0_8
end do
c(1:n+1) = a(1:n+1)
do i = n, 1, -1
if (b(i) <= c(i+1)) then
m2 = m2+b(i)
cycle
end if
if (b(i) <= c(i)+c(i+1)) then
m2 = m2+b(i)
c(i) = c(i)+c(i+1)-b(i)
cycle
end if
m2 = m2+c(i)+c(i+1)
c(i) = 0_8
end do
write(*,'(i0)') max(m1,m2)
stop
end program city_savers```

#### Submission Info

Submission Time 2019-07-27 21:17:37+0900 C - City Savers ue1221 Fortran (gfortran v4.8.4) 300 818 Byte AC 69 ms 3200 KB

#### Judge Result

Set Name All Sample
Score / Max Score 300 / 300 0 / 0
Status
 AC × 17
 AC × 3
Set Name Test Cases
All sample_01, sample_02, sample_03, testcase_01, testcase_02, testcase_03, testcase_04, testcase_05, testcase_06, testcase_07, testcase_08, testcase_09, testcase_10, testcase_11, testcase_12, testcase_13, testcase_14
Sample sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
sample_01 AC 1 ms 256 KB
sample_02 AC 1 ms 256 KB
sample_03 AC 1 ms 256 KB
testcase_01 AC 40 ms 2176 KB
testcase_02 AC 36 ms 2048 KB
testcase_03 AC 66 ms 3200 KB
testcase_04 AC 66 ms 3200 KB
testcase_05 AC 14 ms 1024 KB
testcase_06 AC 30 ms 1920 KB
testcase_07 AC 53 ms 3200 KB
testcase_08 AC 65 ms 3200 KB
testcase_09 AC 52 ms 2688 KB
testcase_10 AC 65 ms 3200 KB
testcase_11 AC 55 ms 2816 KB
testcase_12 AC 2 ms 256 KB
testcase_13 AC 69 ms 3200 KB
testcase_14 AC 1 ms 256 KB