結果

問題 No.2851 Make Pairs
ユーザー osada-yum
提出日時 2024-09-02 15:47:00
言語 Fortran
(gFortran 14.2.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 32,384 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-02 15:47:02
合計ジャッジ時間 1,252 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

program hi
  use, intrinsic :: iso_fortran_env
  implicit none
  integer(int32) :: n
  integer(int32), allocatable :: arr(:), cnts(:)
  integer(int32) :: i
  read(input_unit, *) n
  allocate(arr(n))
  read(input_unit, *) arr(:)
  allocate(cnts(n), source = 0)
  do i = 1, n
    cnts(arr(i)) = cnts(arr(i)) + 1
  end do
  block
    integer(int32) :: ans
    ans = 0
    do i = 1, n
      ans = ans + cnts(i) / 2
    end do
    write(output_unit, '(i0)') ans
  end block
end program
0