結果

問題 No.406 鴨等間隔の法則
ユーザー jjjj
提出日時 2016-08-06 10:45:44
言語 Fortran
(gFortran 13.2.0)
結果
RE  
実行時間 -
コード長 746 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 33,152 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 20:07:39
合計ジャッジ時間 2,188 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 20 ms
5,376 KB
testcase_05 AC 9 ms
5,376 KB
testcase_06 AC 9 ms
5,376 KB
testcase_07 AC 9 ms
5,376 KB
testcase_08 AC 21 ms
5,376 KB
testcase_09 AC 22 ms
5,376 KB
testcase_10 AC 10 ms
5,376 KB
testcase_11 AC 18 ms
5,376 KB
testcase_12 AC 12 ms
5,376 KB
testcase_13 AC 11 ms
5,376 KB
testcase_14 AC 19 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 4 ms
5,376 KB
testcase_21 AC 4 ms
5,376 KB
testcase_22 AC 6 ms
5,376 KB
testcase_23 AC 13 ms
5,376 KB
testcase_24 AC 17 ms
5,376 KB
testcase_25 AC 22 ms
5,376 KB
testcase_26 AC 22 ms
5,376 KB
testcase_27 AC 21 ms
5,376 KB
testcase_28 AC 22 ms
5,376 KB
testcase_29 AC 22 ms
5,376 KB
testcase_30 AC 22 ms
5,376 KB
testcase_31 AC 21 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

  integer::N,i,kankaku,tmp
  integer,allocatable::x(:),memo(:)
  integer::min1,min2
  read *, N
  allocate(x(N),memo(N))
  read *, x

  min1 = MIN(x(1),x(2))
  min2 = MAX(x(1),x(2))
  if(min1.eq.min2) then
     print '(a)', "NO"
     return
  end if
  memo(1:2) = 0

  do i=3,N
     memo(i) = 0
     if(min1.gt.x(i)) then
        min2 = min1
        min1 = x(i)
     else if(min2.gt.x(i)) then
        min2 = x(i)
     end if
  end do

  kankaku = min2 - min1

  do i=1,N-1
     if(MOD((x(i)-min1),kankaku).ne.0) then
        print '(a)', "NO"
        return
     end if
     tmp = (x(i)-min1)/kankaku
     if(memo(tmp).eq.1) then
        print '(a)', "NO"
        return
     end if
     memo(tmp) = 1
  end do

  print '(a)', "YES"
end program
0