Submission #2850833
Source Code Expand
#include<bits/stdc++.h> #define int64 long long int using namespace std; int main(void) { int n; cin >> n; vector<int> x(n); for (int i = 0; i < n; i++) { cin >> x[i]; } vector<int> xx(x); sort(xx.begin(), xx.end()); int m = xx[n/2]; for (int i = 0; i < n; i++) { if(x[i]<m){ cout << m << endl; } else { cout << xx[n/2-1] << endl; } } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Many Medians |
User | tako63 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 437 Byte |
Status | AC |
Exec Time | 404 ms |
Memory | 3712 KB |
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 | 371 ms | 3584 KB |
11.txt | AC | 374 ms | 3328 KB |
12.txt | AC | 284 ms | 2688 KB |
2.txt | AC | 192 ms | 1920 KB |
3.txt | AC | 382 ms | 3584 KB |
4.txt | AC | 373 ms | 3584 KB |
5.txt | AC | 393 ms | 3712 KB |
6.txt | AC | 373 ms | 3584 KB |
7.txt | AC | 297 ms | 2816 KB |
8.txt | AC | 377 ms | 3584 KB |
9.txt | AC | 404 ms | 3712 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |