Submission #9728810
Source Code Expand
#include <bits/stdc++.h> #define ALL(A) (A).begin(), (A).end() #define ll long long #define rep(i, n) for (int i = 0; i < (n); i++) const ll mod = 1e9 + 7; const ll INF = -1 * ((1LL << 63) + 1); const int inf = -1 * ((1 << 31) + 1); using namespace std; int main(void){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); int N; cin >> N; vector<ll> X(N),t; rep(i,N) cin >> X[i]; t = X; sort(ALL(t)); ll ans = t[(N/2) - 1]; rep(i,N){ // i 番目の数を除いた数列の中央値 if(X[i]>ans)cout << ans << endl; else cout << t[(N/2)] << endl; } }
Submission Info
Submission Time | |
---|---|
Task | C - Many Medians |
User | GOI |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 675 Byte |
Status | AC |
Exec Time | 331 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 | 322 ms | 4992 KB |
11.txt | AC | 316 ms | 4864 KB |
12.txt | AC | 234 ms | 3840 KB |
2.txt | AC | 160 ms | 2688 KB |
3.txt | AC | 320 ms | 5120 KB |
4.txt | AC | 308 ms | 4992 KB |
5.txt | AC | 325 ms | 5248 KB |
6.txt | AC | 312 ms | 4992 KB |
7.txt | AC | 251 ms | 4096 KB |
8.txt | AC | 314 ms | 4992 KB |
9.txt | AC | 331 ms | 5376 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |