結果
問題 | No.390 最長の数列 |
ユーザー |
![]() |
提出日時 | 2016-08-10 23:46:00 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 947 bytes |
コンパイル時間 | 1,487 ms |
コンパイル使用メモリ | 34,928 KB |
実行使用メモリ | 11,840 KB |
最終ジャッジ日時 | 2024-11-07 10:37:12 |
合計ジャッジ時間 | 8,425 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 1 TLE * 1 -- * 13 |
ソースコード
recursive 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 qsortprogram maininterfacerecursive function qsort(x) result(y)integer,intent(in) ::x(:)integer,allocatable::y(:)end function qsortend interfaceinteger::N,i,j,max_len,tmp, tmp2integer,allocatable::x(:),y(:),dp(:)read *, Nallocate(x(N),y(N),dp(N))read *, xy = qsort(x)! max length of good series @ index numdp = 1do i=2, Nmax_len = 0do j=1,i-1if(MOD(y(i),y(j)).eq.0) thenmax_len = MAX(max_len, dp(j))end ifend dodp(i) = max_len + 1end doprint '(i0)', MAXVAL(dp)end program main