Submission #2865620


Source Code Expand

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] X = new long[N];
        long[] s = new long[N];
        for(int i=0;i<N;i++) {
            long cur = sc.nextLong();
            X[i]=cur;
            s[i]=cur;
        }
        Arrays.sort(s);
        long smaller = s[N/2-1];
        long bigger = s[N/2];
        for(int i=0;i<N;i++){
            long ans;
            if(X[i]<=smaller) ans=bigger;
            else ans = smaller;
            System.out.println(ans);
        }

    }
}

Submission Info

Submission Time
Task C - Many Medians
User AlbertZ
Language Java8 (OpenJDK 1.8.0)
Score 300
Code Size 672 Byte
Status AC
Exec Time 1608 ms
Memory 93564 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 117 ms 19412 KB
10.txt AC 1457 ms 75212 KB
11.txt AC 1449 ms 87592 KB
12.txt AC 1171 ms 68972 KB
2.txt AC 1005 ms 63820 KB
3.txt AC 1465 ms 83972 KB
4.txt AC 1447 ms 93564 KB
5.txt AC 1504 ms 90920 KB
6.txt AC 1476 ms 91556 KB
7.txt AC 1361 ms 83224 KB
8.txt AC 1455 ms 80648 KB
9.txt AC 1608 ms 89584 KB
sample1.txt AC 93 ms 21716 KB
sample2.txt AC 92 ms 20820 KB
sample3.txt AC 93 ms 21716 KB