結果

問題 No.1268 Fruit Rush 2
ユーザー hanyuhanyu
提出日時 2020-05-31 17:22:25
言語 Fortran
(gFortran 14.2.0)
結果
RE  
実行時間 -
コード長 471 bytes
コンパイル時間 1,773 ms
コンパイル使用メモリ 32,384 KB
実行使用メモリ 13,764 KB
最終ジャッジ日時 2024-06-22 07:42:35
合計ジャッジ時間 5,954 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 RE * 4 TLE * 1 -- * 19
権限があれば一括ダウンロードができます

ソースコード

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