結果

問題 No.1268 Fruit Rush 2
ユーザー hanyu
提出日時 2020-05-31 17:24:34
言語 Fortran
(gFortran 14.2.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 474 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 32,384 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-22 07:43:06
合計ジャッジ時間 1,924 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 RE * 12
権限があれば一括ダウンロードができます

ソースコード

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(i)) = 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