結果
問題 | No.275 中央値を求めよ |
ユーザー |
![]() |
提出日時 | 2020-03-12 23:49:35 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 976 bytes |
コンパイル時間 | 1,980 ms |
コンパイル使用メモリ | 32,640 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-20 12:55:07 |
合計ジャッジ時間 | 3,672 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
program Wimplicit noneinteger::Nreal(8),allocatable,dimension(:)::Aread*,Nallocate(A(N))read*,Acall heapsort(N,A)print"(f0.14)",merge((A(N/2)+A(N/2+1))/2_8,A(N/2+1),mod(N,2)==0)containssubroutine heapsort(n,array)implicit none!ここの入力は状況に応じて変更することinteger,intent(in) :: nreal(8),intent(inout) :: array(1:n)integer(16)::i,k,j,lreal(8):: tl=n/2+1k=ndo while(k /= 1)if(l > 1)thenl=l-1t=array(L)elset=array(k)array(k)=array(1)k=k-1if(k == 1) thenarray(1)=texitendifendifi=lj=l+ldo while(j<=k)if(j < k)thenif(array(j) < array(j+1))j=j+1endifif (t < array(j))thenarray(i)=array(j)i=jj=j+jelsej=k+1endifenddoarray(i)=tenddoreturnend subroutine heapsortend program W