結果
問題 | No.998 Four Integers |
ユーザー |
![]() |
提出日時 | 2020-03-08 22:49:41 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,039 bytes |
コンパイル時間 | 720 ms |
コンパイル使用メモリ | 32,512 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 23:20:58 |
合計ジャッジ時間 | 1,536 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
program speedrun implicit none integer(16)::A(4) logical::check integer i read*,A call heapsort(4_16,A) check=.true. do i=1,3 if(A(i+1)/=A(i)+1)check=.false. end do print"(A)",trim(merge("Yes","No ",check)) contains subroutine heapsort(n,array) implicit none !ここの入力は状況に応じて変更すること integer(16),intent(in) :: n integer(16),intent(inout) :: array(1:n) integer(16)::i,k,j,l integer(16):: t l=n/2+1 k=n do while(k /= 1) if(l > 1)then l=l-1 t=array(L) else t=array(k) array(k)=array(1) k=k-1 if(k == 1) then array(1)=t exit endif endif i=l j=l+l do while(j<=k) if(j < k)then if(array(j) < array(j+1))j=j+1 endif if (t < array(j))then array(i)=array(j) i=j j=j+j else j=k+1 endif enddo array(i)=t enddo return end subroutine heapsort end program speedrun