結果

問題 No.275 中央値を求めよ
コンテスト
ユーザー ABKZ
提出日時 2021-06-09 23:27:11
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 439 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 217 ms
コンパイル使用メモリ 85,376 KB
実行使用メモリ 60,416 KB
最終ジャッジ日時 2026-05-22 22:51:27
合計ジャッジ時間 3,454 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
A = list(map(int, input().split()))

lower = -1000
upper = 1000

for i in range(N):
  if lower >= A[i] or upper <= A[i]:
    continue
  less = 0
  more = 0
  for j in range(N):
    if A[i] > A[j]:
      less += 1
    elif A[i] < A[j]:
      more += 1
  if less < N / 2 and more < N / 2:
    lower = A[i]
    upper = A[i]
    break
  elif less >= N / 2:
    upper = A[i]
  else:
    lower = A[i]

print((lower + upper) / 2)
0