結果
問題 |
No.135 とりあえず1次元の問題
|
ユーザー |
![]() |
提出日時 | 2016-07-28 16:37:17 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 845 bytes |
コンパイル時間 | 2,012 ms |
コンパイル使用メモリ | 35,180 KB |
実行使用メモリ | 6,940 KB |
最終ジャッジ日時 | 2024-06-11 06:52:33 |
合計ジャッジ時間 | 3,888 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 WA * 1 |
ソースコード
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 program main interface recursive function qsort(x) result(y) integer,intent(in) ::x(:) integer,allocatable::y(:) end function qsort end interface integer::N,i,mindist=1000001 integer,allocatable::X(:) integer,allocatable::Y(:) read *,N allocate(X(N)) allocate(Y(N)) read *,X Y=qsort(X) do i=1,N-1 if(Y(i).eq.Y(i+1)) cycle mindist = MIN(mindist, Y(i+1)-Y(i)) if(mindist.eq.1) exit end do print '(i0)', mindist end program main