結果

問題 No.490 yukiソート
ユーザー jj
提出日時 2017-03-10 23:38:20
言語 Fortran
(gFortran 14.2.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 648 bytes
コンパイル時間 1,248 ms
コンパイル使用メモリ 33,152 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-24 10:27:15
合計ジャッジ時間 2,527 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.f90:28:30:

   28 |     write(cformat(5:9),'(i0)'),size(array)
      |                              1
Warning: Legacy Extension: Comma before i/o item list at (1)

ソースコード

diff #

program main
  implicit none
  integer::n,i,p,q,tmp
  integer,allocatable::a(:)

  read *,n
  allocate(a(0:n-1))
  read *,a(0:n-1)

  do i=1,2*n-4
     do p=0, n-1
        q = i-p
        if(q.lt.0.or.q.ge.n.or.p.ge.q) cycle
        if(a(p).gt.a(q)) then
           tmp  = a(p)
           a(p) = a(q)
           a(q) = tmp
        end if
!        print *,i,p,q
!        call aprinter(a)
     end do
  end do
  call aprinter(a)
contains
  subroutine aprinter(array)
    integer*4::array(:)
    character*32::cformat='(i0,     (1x,i0))'
    write(cformat(5:9),'(i0)'),size(array)
    write(*,cformat) array
  end subroutine aprinter
end program main
0