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

Submission #3079323

Source Code Expand

Copy
```#include <bits/stdc++.h>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;

int main()
{
cin.tie(0);
ios::sync_with_stdio(false);

ll n;
cin >> n;

ll a[n];
rep(i, n) cin >> a[i];

ll smn = n * (n+1) / 2;
ll tar = smn / 2;

vector<pll> b;
if(n % 2 == 0){
for(int i = 0; i <= n / 2 - 1; i++){
b.push_back((pll){a[i], 2 * i + 1});
}
for(int i = n / 2; i < n; i++){
b.push_back((pll){a[i], 2 * (n - i)});
}
}else{
for(int i = 0; i <= n / 2; i++){
b.push_back((pll){a[i], 2 * i + 1});
}
for(int i = n / 2+1; i < n; i++){
b.push_back((pll){a[i], 2 * (n - i)});
}
}

sort(b.begin(), b.end());
rep(i, n){
// cout << b[i].first << "," << b[i].second << endl;
}

ll tmp = 0;
rep(i, n){
tmp += b[i].second;
if(tmp >= tar){
cout << b[i].first << endl;
return 0;
}
}

}```

#### Submission Info

Submission Time 2018-08-25 22:37:44+0900 D - Median of Medians misora192 C++14 (GCC 5.4.1) 0 1079 Byte WA 24 ms 3188 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 700
Status
 AC × 2 WA × 1
 AC × 7 WA × 12
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt
Case Name Status Exec Time Memory
0_00.txt 1 ms 256 KB
0_01.txt 1 ms 256 KB
0_02.txt 1 ms 256 KB
1_00.txt 1 ms 256 KB
1_01.txt 1 ms 256 KB
1_02.txt 20 ms 3188 KB
1_03.txt 24 ms 3188 KB
1_04.txt 12 ms 3188 KB
1_05.txt 12 ms 3188 KB
1_06.txt 20 ms 3188 KB
1_07.txt 20 ms 3188 KB
1_08.txt 19 ms 3188 KB
1_09.txt 19 ms 3188 KB
1_10.txt 19 ms 3188 KB
1_11.txt 19 ms 3188 KB
1_12.txt 19 ms 3188 KB
1_13.txt 19 ms 3188 KB
1_14.txt 19 ms 3188 KB
1_15.txt 20 ms 3188 KB