Submission #9706922
Source Code Expand
#include "bits/stdc++.h" using namespace std; int main() { int n; cin >> n; pair<int, int> arr[n]; for (int i=0; i<n; i++) { cin >> arr[i].first; arr[i].second = i; } sort(arr, arr+n); int res[n]; for (int i=0; i<n; i++) { if (i < (n/2)) { res[arr[i].second] = arr[n/2].first; } else { res[arr[i].second] = arr[n/2-1].first; } } for (int i=0; i<n; i++) cout << res[i] << endl; }
Submission Info
Submission Time | |
---|---|
Task | C - Many Medians |
User | socho |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 454 Byte |
Status | AC |
Exec Time | 424 ms |
Memory | 4480 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 | 399 ms | 4224 KB |
11.txt | AC | 408 ms | 4096 KB |
12.txt | AC | 299 ms | 3328 KB |
2.txt | AC | 205 ms | 2304 KB |
3.txt | AC | 406 ms | 4352 KB |
4.txt | AC | 394 ms | 4224 KB |
5.txt | AC | 412 ms | 4480 KB |
6.txt | AC | 399 ms | 4224 KB |
7.txt | AC | 313 ms | 3456 KB |
8.txt | AC | 395 ms | 4224 KB |
9.txt | AC | 424 ms | 4480 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |