Submission #2384411
Source Code Expand
// Many Medians #define NODEBUG #include<iostream> #include<vector> #include<algorithm> #include<iterator> #include<cassert> using namespace std; using X_type = int32_t; int main(){ size_t N; cin >> N; assert(N%2==0); vector<X_type> X; X.reserve(N); copy_n(istream_iterator<X_type>{cin}, N, back_inserter(X)); auto mid = X.begin()+(N/2)-1; X_type max_cand = (nth_element(X.begin(), mid, X.end()), *mid); mid = X.begin()+(N/2)-2; X_type min_cand = (nth_element(X.begin(), mid, X.end()), *mid); for (size_t i = 0; i < N; ++i){ cout << (X[i]<max_cand ? max_cand : min_cand) << '\n'; } cout.flush(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Many Medians |
User | donald9016 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 780 Byte |
Status | WA |
Exec Time | 104 ms |
Memory | 2944 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | WA | 1 ms | 256 KB |
10.txt | WA | 94 ms | 2816 KB |
11.txt | AC | 93 ms | 2560 KB |
12.txt | AC | 72 ms | 2176 KB |
2.txt | WA | 49 ms | 1536 KB |
3.txt | WA | 97 ms | 2944 KB |
4.txt | WA | 94 ms | 2816 KB |
5.txt | WA | 104 ms | 2944 KB |
6.txt | WA | 94 ms | 2816 KB |
7.txt | WA | 75 ms | 2304 KB |
8.txt | WA | 95 ms | 2816 KB |
9.txt | WA | 101 ms | 2944 KB |
sample1.txt | WA | 1 ms | 256 KB |
sample2.txt | WA | 1 ms | 256 KB |
sample3.txt | WA | 1 ms | 256 KB |