Submission #3623388
Source Code Expand
#include <bits/stdc++.h> #define F first #define S second #define PB push_back #define PF push_front #define MP make_pair using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; const int maxn = 2e5 + 4; int b[maxn]; pii a[maxn]; int main () { ios::sync_with_stdio(false); int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i].F; a[i].S = i; } sort (a + 1, a + n + 1); for (int i = 1; i <= n; i++) { if (i <= n / 2) { b[a[i].S] = a[n / 2 + 1].F; } else { b[a[i].S] = a[n / 2 + 0].F; } } for (int i = 1; i <= n; i++) cout << b[i] << " "; }
Submission Info
Submission Time | |
---|---|
Task | C - Many Medians |
User | Saboon |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 653 Byte |
Status | AC |
Exec Time | 57 ms |
Memory | 4608 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 | 52 ms | 4352 KB |
11.txt | AC | 52 ms | 4096 KB |
12.txt | AC | 38 ms | 3328 KB |
2.txt | AC | 28 ms | 2304 KB |
3.txt | AC | 52 ms | 4352 KB |
4.txt | AC | 51 ms | 4352 KB |
5.txt | AC | 53 ms | 4480 KB |
6.txt | AC | 51 ms | 4352 KB |
7.txt | AC | 41 ms | 3456 KB |
8.txt | AC | 57 ms | 4352 KB |
9.txt | AC | 55 ms | 4608 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |