結果
| 問題 |
No.275 中央値を求めよ
|
| ユーザー |
|
| 提出日時 | 2021-06-09 23:27:11 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 439 bytes |
| コンパイル時間 | 156 ms |
| コンパイル使用メモリ | 82,012 KB |
| 実行使用メモリ | 60,800 KB |
| 最終ジャッジ日時 | 2024-11-29 01:01:09 |
| 合計ジャッジ時間 | 3,324 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 WA * 2 |
ソースコード
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)