Submission #19369709


Source Code Expand

Copy
import sys
input = sys.stdin.buffer.readline

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

B = []
for i, a in enumerate(A):
    B.append((a, i))

B.sort()


a1 = B[N//2-1][0]
a2 = B[N//2][0]

ans = [-1]*N
for a, i in B[:N//2]:
    ans[i] = a2

for a, i in B[N//2:]:
    ans[i] = a1

print(*ans, sep="\n")

Submission Info

Submission Time
Task C - Many Medians
User wattaihei
Language Python (3.8.2)
Score 300
Code Size 345 Byte
Status AC
Exec Time 379 ms
Memory 43560 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 18
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All sample1.txt, sample2.txt, sample3.txt, 1.txt, 10.txt, 11.txt, 12.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
1.txt AC 18 ms 9156 KB
10.txt AC 359 ms 41612 KB
11.txt AC 225 ms 41692 KB
12.txt AC 169 ms 33712 KB
2.txt AC 163 ms 24704 KB
3.txt AC 367 ms 40808 KB
4.txt AC 338 ms 41308 KB
5.txt AC 379 ms 41600 KB
6.txt AC 369 ms 41396 KB
7.txt AC 262 ms 34932 KB
8.txt AC 358 ms 41600 KB
9.txt AC 378 ms 43560 KB
sample1.txt AC 18 ms 9008 KB
sample2.txt AC 18 ms 9060 KB
sample3.txt AC 21 ms 8904 KB