結果
問題 |
No.79 過小評価ダメ・ゼッタイ
|
ユーザー |
![]() |
提出日時 | 2017-03-20 05:21:13 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
AC
|
実行時間 | 20 ms / 5,000 ms |
コード長 | 736 bytes |
コンパイル時間 | 1,722 ms |
コンパイル使用メモリ | 34,912 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 08:10:27 |
合計ジャッジ時間 | 1,241 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
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