Contest Duration: - (local time) (100 minutes) Back to Home

Submission #19303929

Source Code Expand

Copy
```//void __(){
//    _(int,n);
//    _(vi,a,n);
//    vpii sorted;
//    rep(i,n)
//        sorted.pb({a[i],i});
//    sort(all(sorted));
//    int lo = sorted[n/2-1].X;
//    int hi = sorted[n/2].X;
//    vi ans(n);
//    rep(i,n)
//        ans[sorted[i].Y] = sorted[i].X >= hi ? lo : hi;
//    print_vn ans;
//}
//
#include <iomanip>
#include <algorithm>
#include <vector>
#include <utility>
#include <iostream>
#include <string>
#define pb push_back
#define REP_ZERO_INT(i,r) for(int i = 0; i < (r); ++i)
#define GET_REP_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define rep(...) GET_REP_MACRO(__VA_ARGS__,REP_ANY,REP_INT,REP_ZERO_INT)(__VA_ARGS__)
#define all(v) (v).begin(), (v).end()
#define sz(v) ll(v.size())
#define X first
#define Y second
#define T1 template<typename T> static
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

T1 ostream& operator<<(ostream& stream, const vector<T>& t);
T1 istream& read(T, T, istream& = cin);
T1 istream& operator>>(istream& stream, vector<T>& t){
}
T1 istream& read(T b, T e, istream& stream){
for(T it = b; it != e; ++it)
stream >> *it;
return stream;
}
struct _print {
string sep,end;
bool space;
ostream &stream;
_print(string _sep=" ",string _end="\n",
ostream &_stream = cout)
: sep(_sep),end(_end),space(false),
stream(_stream) {}
~_print() { stream << end; }

template <typename T>
_print &operator , (const T &t) {
if (space) stream << sep;
space = true;
stream << t;
return *this;
}
};
struct _print2{
string s1,s2,end;
bool space;
ostream &stream;
_print2(string _s1 = " ", string _s2 = " ", string _end="\n", ostream &_stream = cout)
:s1(_s1),s2(_s2),end(_end),space(false),
stream(_stream) {}
~_print2() { stream << end; }

template <typename T>
_print2 &operator , (const T &t) {
for(auto _ : t){
if (space) stream << s1;
space = true;
_print p(s2,"",stream);
p,_;
}
return *this;
}
};
#define print_vn _print2("\n"," ","\n"),
#define INPUT_WITHOUT_INIT(type,name) type name; cin >> name
#define _IWI(type,name,...) type name(__VA_ARGS__); cin >> name
#define GET_INPUT_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define _(...) GET_INPUT_MACRO(__VA_ARGS__,_IWI,_IWI,_IWI,_IWI,_IWI,_IWI,INPUT_WITHOUT_INIT)(__VA_ARGS__)
void __(){
_(int,n);
_(vi,a,n);
vpii sorted;
rep(i,n)
sorted.pb({a[i],i});
sort(all(sorted));
int lo = sorted[n/2-1].X;
int hi = sorted[n/2].X;
vi ans(n);
rep(i,n)
ans[sorted[i].Y] = sorted[i].X >= hi ? lo : hi;
print_vn ans;
}

int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
__();
}

```

#### Submission Info

Submission Time 2021-01-10 14:44:28+0900 C - Many Medians Andres_Unt C++ (GCC 9.2.1) 300 3097 Byte AC 70 ms 6356 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
 AC × 3
 AC × 18
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 7 ms 3516 KB
10.txt AC 62 ms 5836 KB
11.txt AC 66 ms 6176 KB
12.txt AC 49 ms 5840 KB
2.txt AC 40 ms 4592 KB
3.txt AC 64 ms 6164 KB
4.txt AC 65 ms 6000 KB
5.txt AC 65 ms 6356 KB
6.txt AC 66 ms 6320 KB
7.txt AC 50 ms 5876 KB
8.txt AC 66 ms 6212 KB
9.txt AC 70 ms 6136 KB
sample1.txt AC 9 ms 3616 KB
sample2.txt AC 5 ms 3600 KB
sample3.txt AC 2 ms 3616 KB