You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
559 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
int n, w;
const int N = 610;
vector<int> f;
int main() {
cin >> n >> w;
for (int i = 1; i <= n; i++) {
int cnt = max(1, i * w / 100); //目前的获奖人数
int x;
cin >> x;
// 用途:在一个用序的数组中, 插入一个新数,最终还要是一个有序的数组
// 办法vector插入排序 = 二分查找+vector插入
f.insert(upper_bound(f.begin(), f.end(), x), x);
printf("%d ", f[i - cnt]);
}
return 0;
}