結果

問題 No.79 過小評価ダメ・ゼッタイ
コンテスト
ユーザー jj
提出日時 2017-03-20 05:21:13
言語 Fortran
(gFortran 15.2.0)
コンパイル:
gfortran _filename_ -O2 -o ./a.out
実行:
./a.out
結果
AC  
実行時間 13 ms / 5,000 ms
コード長 736 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 285 ms
コンパイル使用メモリ 42,940 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-13 00:05:49
合計ジャッジ時間 1,217 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

program main
  implicit none
  integer::N,i
  integer,allocatable::L(:),S(:)
  integer::indx(6),max
  read *,N
  allocate(L(N),S(N))
  read *,L
  S = qsort(L)
  do i=1,6
     indx(i) = COUNT(S.eq.i)
  end do
  max = MAXVAL(indx)
  do i=6,1,-1
     if(indx(i).eq.max) then
        print '(i0)', i
        return
     end if
  end do
contains
  recursive function qsort(x) result(y)
    integer,intent(in) ::x(:)
    integer,allocatable::y(:)
    integer::pivot,total
    total = size(x)
    if (total <=1) then
       y = x
    else
       pivot = x(total/2)
       y = [qsort(pack(x, x .lt. pivot)), &
            pack(x, x .eq. pivot),        &
            qsort(pack(x, x .gt. pivot))]
    endif
  end function qsort

end program main
0