結果

問題 No.406 鴨等間隔の法則
ユーザー jjjj
提出日時 2016-08-06 10:46:29
言語 Fortran
(gFortran 13.2.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 748 bytes
コンパイル時間 1,327 ms
コンパイル使用メモリ 27,156 KB
実行使用メモリ 5,648 KB
最終ジャッジ日時 2023-09-21 17:54:36
合計ジャッジ時間 3,663 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

  integer::N,i,kankaku,tmp
  integer,allocatable::x(:),memo(:)
  integer::min1,min2
  read *, N
  allocate(x(N),memo(0: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