Created
August 12, 2018 08:30
-
-
Save ateruimashin/027dc9b044b56c7f16619a4c849fa065 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <algorithm> | |
using namespace std; | |
int main(int argc, char const *argv[]) { | |
int n; | |
cin>>n; | |
int a[n],b[n]; | |
for(int i=0;i<n;i++){ | |
int tmp; | |
cin>>tmp; | |
a[i]=tmp; | |
b[i]=tmp; | |
} | |
sort(b,b+n); | |
int med1=b[n/2-1],med2=b[n/2]; | |
for(int i=0;i<n;i++){ | |
cout<<((a[i]<med2)?med2:med1)<<endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment