結果
問題 | No.275 中央値を求めよ |
ユーザー |
|
提出日時 | 2021-06-10 00:02:52 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 51 ms / 1,000 ms |
コード長 | 458 bytes |
コンパイル時間 | 327 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 60,928 KB |
最終ジャッジ日時 | 2024-11-29 01:40:37 |
合計ジャッジ時間 | 3,604 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
N = int(input())A = list(map(int, input().split()))lower = -1000upper = 1000for i in range(N):if lower > A[i] or upper < A[i]: # 条件を修正continueless = 0more = 0for j in range(N):if A[i] > A[j]:less += 1elif A[i] < A[j]:more += 1if less < N / 2 and more < N / 2:lower = A[i]upper = A[i]breakelif less >= N / 2: #upper = A[i]else:lower = A[i]print((lower + upper) / 2 )