Submission #2840306
Source Code Expand
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); long n; cin >> n; long x[n]; long x_copy[n]; for (long i = 0; i < n; i++) { cin >> x[i]; x_copy[i] = x[i]; } sort(x_copy, x_copy + n); long small_mean = x_copy[n / 2 - 1]; long large_mean = x_copy[n / 2 ]; for (long i = 0; i < n; i ++) { if (x[i] <= small_mean) { cout << large_mean << "\n"; } else { cout << small_mean << "\n"; } } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Many Medians |
User | gaudi08 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 610 Byte |
Status | AC |
Exec Time | 51 ms |
Memory | 5376 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 | 48 ms | 4992 KB |
11.txt | AC | 40 ms | 4864 KB |
12.txt | AC | 29 ms | 3840 KB |
2.txt | AC | 25 ms | 2688 KB |
3.txt | AC | 50 ms | 5120 KB |
4.txt | AC | 50 ms | 4992 KB |
5.txt | AC | 50 ms | 5248 KB |
6.txt | AC | 48 ms | 4992 KB |
7.txt | AC | 39 ms | 4096 KB |
8.txt | AC | 48 ms | 4992 KB |
9.txt | AC | 51 ms | 5376 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |