結果

問題 No.182 新規性の虜
ユーザー jjjj
提出日時 2016-07-30 09:17:51
言語 Fortran
(gFortran 13.2.0)
結果
WA  
実行時間 -
コード長 823 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 35,328 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-24 12:27:31
合計ジャッジ時間 1,895 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 35 ms
6,944 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
6,940 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 1 ms
6,944 KB
testcase_24 AC 48 ms
6,944 KB
testcase_25 AC 13 ms
6,940 KB
testcase_26 AC 8 ms
6,940 KB
testcase_27 AC 1 ms
6,940 KB
evil01.txt AC 53 ms
6,944 KB
evil02.txt AC 50 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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
0