結果

問題 No.1268 Fruit Rush 2
ユーザー hanyuhanyu
提出日時 2020-05-31 17:22:25
言語 Fortran
(gFortran 13.2.0)
結果
RE  
実行時間 -
コード長 471 bytes
コンパイル時間 1,260 ms
コンパイル使用メモリ 26,832 KB
実行使用メモリ 5,168 KB
最終ジャッジ日時 2023-09-04 08:33:07
合計ジャッジ時間 7,089 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 RE -
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 RE -
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
  
  implicit none
  
  integer(8):: n, i, ans
  integer:: x(1:200000)
  integer, allocatable:: a(:)
  
  read (*, *) n
  allocate(a(n))
  read (*, *) a(1:n)
  
  do i = 1, n
    x(a) = 1
  end do
  
  do i = 199998, 1, -1
    if (x(i) > 0) then
      x(i) = x(i) + x(i + 2)
    end if
  end do
  
  ans = n
  do i = 2, 200000
    if (x(i - 1) > 0 .and. x(i) > 0) then
      ans = ans + x(i)
    end if
  end do
  
  write (*, '(i0)') ans
  
end program main
0