結果
| 問題 | No.182 新規性の虜 |
| コンテスト | |
| ユーザー |
jj
|
| 提出日時 | 2016-07-30 09:21:08 |
| 言語 | Fortran (gFortran 14.2.0) |
| 結果 |
AC
|
| 実行時間 | 70 ms / 5,000 ms |
| コード長 | 823 bytes |
| 記録 | |
| コンパイル時間 | 2,114 ms |
| コンパイル使用メモリ | 35,232 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-27 07:21:19 |
| 合計ジャッジ時間 | 3,634 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
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(N),s(0:N+1))
read *,a(1:N)
s(1:N) = qsort(a)
s(0) = 0
s(N+1) = 0
do i=1,N
if(s(i).ne.s(i-1).and.s(i).ne.s(i+1))then
total = total + 1
end if
end do
print '(i0)', total
end program main
jj