結果

問題 No.135 とりあえず1次元の問題
ユーザー jjjj
提出日時 2016-07-28 17:09:05
言語 Fortran
(gFortran 13.2.0)
結果
WA  
実行時間 -
コード長 655 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 27,136 KB
実行使用メモリ 7,212 KB
最終ジャッジ日時 2023-09-02 00:27:47
合計ジャッジ時間 1,376 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
5,648 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 4 ms
4,380 KB
testcase_13 AC 4 ms
4,376 KB
testcase_14 AC 5 ms
4,688 KB
testcase_15 AC 4 ms
4,376 KB
testcase_16 AC 5 ms
4,928 KB
testcase_17 AC 4 ms
4,812 KB
testcase_18 AC 4 ms
4,376 KB
testcase_19 AC 5 ms
4,668 KB
testcase_20 AC 4 ms
4,380 KB
testcase_21 AC 30 ms
4,376 KB
testcase_22 AC 31 ms
7,212 KB
evil01.txt AC 31 ms
7,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
  integer,parameter::limit=1000000
  integer::N,i,sum,prev,mindist=limit+1
  integer,allocatable::X(:)
  integer::Y(0:limit)=0
  read *,N
  allocate(X(N))
  read *,X

  do i=1,N
     Y(X(i))=Y(X(i))+1
  end do

  do i=0,limit
     if(Y(i).ne.0) then
        sum = Y(i)
        prev =i
        exit
     end if
  end do

  if(sum .eq. N) then
     print '(i0)', 0
  end if

  do i=prev+1, limit
     if(Y(i).ne.0) then
        mindist = MIN(mindist, i-prev)
        prev = i
        sum = sum + Y(i)
        if(sum.eq.N) exit
        continue
     end if
  end do

  if(mindist.eq.(limit+1)) mindist=0
  print '(i0)', mindist
end program main
0