Submission #2384417
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); X_type max_cand = (nth_element(X.begin(), mid, X.end()), *mid); mid = X.begin()+(N/2)-1; X_type min_cand = (nth_element(X.begin(), mid, X.end()), *mid); for (size_t i = 0; i < N; ++i){ cout << (X[i]<=min_cand ? max_cand : min_cand) << '\n'; } cout.flush(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Cats and Dogs |
User | donald9016 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 779 Byte |
Status | RE |
Exec Time | 104 ms |
Memory | 384 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 100 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | sample1.txt, sample2.txt, sample3.txt, 1.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, sample1.txt, sample2.txt, sample3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
1.txt | WA | 1 ms | 256 KB |
2.txt | WA | 1 ms | 256 KB |
3.txt | WA | 1 ms | 256 KB |
4.txt | RE | 104 ms | 384 KB |
5.txt | RE | 97 ms | 256 KB |
6.txt | WA | 1 ms | 256 KB |
7.txt | WA | 1 ms | 256 KB |
sample1.txt | RE | 98 ms | 256 KB |
sample2.txt | WA | 1 ms | 256 KB |
sample3.txt | RE | 96 ms | 256 KB |