Submission #9718789
Source Code Expand
#include <iostream> #include <algorithm> using namespace std; const int N=200000+10; int n,a[N],b[N]; int main() { scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%d",&a[i]),b[i]=a[i]; sort(b+1,b+1+n); for(int i=1;i<=n;i++){ if(a[i]<=b[n/2]) printf("%d\n", b[n/2+1]); else printf("%d\n", b[n/2]); } }
Submission Info
Submission Time | |
---|---|
Task | C - Many Medians |
User | RUSH_D_CAT |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 345 Byte |
Status | AC |
Exec Time | 55 ms |
Memory | 3712 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:7:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.cpp:8:53: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] for(int i=1;i<=n;i++)scanf("%d",&a[i]),b[i]=a[i]; ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 52 ms | 3584 KB |
11.txt | AC | 44 ms | 3328 KB |
12.txt | AC | 32 ms | 2816 KB |
2.txt | AC | 27 ms | 1920 KB |
3.txt | AC | 54 ms | 3584 KB |
4.txt | AC | 52 ms | 3584 KB |
5.txt | AC | 55 ms | 3712 KB |
6.txt | AC | 52 ms | 3584 KB |
7.txt | AC | 42 ms | 2816 KB |
8.txt | AC | 52 ms | 3584 KB |
9.txt | AC | 55 ms | 3712 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |