結果

問題 No.275 中央値を求めよ
ユーザー wewewebweweweb
提出日時 2021-03-23 22:31:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 511 bytes
コンパイル時間 515 ms
コンパイル使用メモリ 10,636 KB
実行使用メモリ 8,296 KB
最終ジャッジ日時 2023-08-17 07:41:27
合計ジャッジ時間 2,634 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,868 KB
testcase_01 AC 16 ms
7,868 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 15 ms
7,784 KB
testcase_06 AC 16 ms
7,744 KB
testcase_07 AC 30 ms
7,740 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 16 ms
7,712 KB
testcase_11 AC 15 ms
7,784 KB
testcase_12 AC 15 ms
7,844 KB
testcase_13 AC 16 ms
7,808 KB
testcase_14 AC 16 ms
7,716 KB
testcase_15 WA -
testcase_16 AC 49 ms
8,296 KB
testcase_17 AC 48 ms
8,288 KB
testcase_18 AC 21 ms
7,848 KB
testcase_19 WA -
testcase_20 AC 40 ms
7,784 KB
testcase_21 WA -
testcase_22 AC 48 ms
7,816 KB
testcase_23 WA -
testcase_24 AC 18 ms
7,756 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 39 ms
7,820 KB
testcase_28 AC 15 ms
7,848 KB
testcase_29 AC 22 ms
7,716 KB
testcase_30 AC 15 ms
7,748 KB
testcase_31 AC 47 ms
7,784 KB
testcase_32 AC 18 ms
7,688 KB
testcase_33 WA -
testcase_34 AC 16 ms
7,832 KB
testcase_35 AC 36 ms
7,744 KB
testcase_36 WA -
testcase_37 AC 17 ms
7,812 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 63 ms
7,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
def arrange(n,list_x):
    for i in range(0, n-2):
        for j in range(0, n-2-i):
            x_j = list_x[j]
            if list_x[j] > list_x[j+1]:
                list_x[j] = list_x[j+1]
                list_x[j+1] = x_j
    arrange_x = list_x
    return arrange_x

arrange_A = arrange(N,A)
if N % 2 != 0:
    median = arrange_A[ int(( N + 1 ) / 2 - 1) ]
else:
    median = ( arrange_A[ int(N/2) - 1 ] + arrange_A[ int(N/2 + 1) - 1 ] ) / 2
print(median)
0