結果
問題 | No.370 道路の掃除 |
ユーザー |
![]() |
提出日時 | 2016-09-11 16:39:01 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 826 bytes |
コンパイル時間 | 336 ms |
コンパイル使用メモリ | 35,156 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 03:27:58 |
合計ジャッジ時間 | 1,524 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 WA * 4 |
ソースコード
program mainimplicit noneinteger::N,M,minimum,i,jinteger,allocatable::D(:),DD(:)read *,N,Mallocate(D(M),DD(M))read *,DDD = qsort(D)minimum = 30000do i=1,M-N+1j = i+N-1if(D(i)*D(j).ge.0) thenminimum = MIN(minimum, MAX(ABS(D(i)),ABS(D(j))))elseminimum = MIN(minimum, ABS(D(i))+ABS(D(j)) + MIN(ABS(D(i)),ABS(D(j))))end ifend doprint '(i0)',minimumcontainsrecursive function qsort(x) result(y)integer,intent(in) ::x(:)integer,allocatable::y(:)integer::pivot,totaltotal = size(x)if (total <=1) theny = xelsepivot = x(total/2)y = [qsort(pack(x, x .lt. pivot)), &pack(x, x .eq. pivot), &qsort(pack(x, x .gt. pivot))]endifend function qsortend program main