結果
問題 |
No.182 新規性の虜
|
ユーザー |
![]() |
提出日時 | 2016-07-30 09:17:51 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 823 bytes |
コンパイル時間 | 312 ms |
コンパイル使用メモリ | 35,372 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-06 20:20:00 |
合計ジャッジ時間 | 1,902 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 13 |
ソースコード
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,total=0 integer,allocatable::s(:),a(:) read *,N allocate(a(0:N+1),s(N)) read *,a(1:N) s = qsort(a(1:N)) a(0) = 0 a(N+1) = 0 do i=1,N if(a(i).ne.a(i-1).and.a(i).ne.a(i+1))then total = total + 1 end if end do print '(i0)', total end program main