Submission #2347378


Source Code Expand

Copy
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 200005;

int n;
int a[N];
int b[N];

int main(){
	n=get();
	fo(i,1,n)a[i]=b[i]=get();
	sort(b+1,b+1+n);
	int v1=b[n/2],v2=b[n/2+1];
	fo(i,1,n){
		if (a[i]<=v1)printf("%d\n",v2);
		else printf("%d\n",v1);
	}
	return 0;
}

Submission Info

Submission Time
Task C - Many Medians
User samjia2000
Language C++14 (GCC 5.4.1)
Score 300
Code Size 805 Byte
Status AC
Exec Time 49 ms
Memory 3712 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 1 ms 256 KB
10.txt AC 46 ms 3584 KB
11.txt AC 37 ms 3328 KB
12.txt AC 28 ms 2688 KB
2.txt AC 24 ms 1920 KB
3.txt AC 47 ms 3584 KB
4.txt AC 46 ms 3584 KB
5.txt AC 49 ms 3712 KB
6.txt AC 46 ms 3584 KB
7.txt AC 37 ms 2816 KB
8.txt AC 46 ms 3584 KB
9.txt AC 49 ms 3712 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB
sample3.txt AC 1 ms 256 KB