Files
python/TangDou/CSP-J/MKX_B/3205.cpp

25 lines
807 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#include <bits/stdc++.h>
using namespace std;
int n, w;
const int N = 610;
vector<int> f;
int main() {
//配置从文本文件读入数据
freopen("live.in","r", stdin);
freopen("live.out","w", stdout);
//加快读入
ios::sync_with_stdio(false), cin.tie(0);
cin >> n >> w;
for (int i = 1; i <= n; i++) {
int cnt = max(1, i * w / 100); //目前的获奖人数,10 100
int x;
cin >> x;
// 用途:在一个用序的数组中, 插入一个新数,最终还要是一个有序的数组
// 办法:vector插入排序 = 二分查找+vector插入
//f.insert(upper_bound(f.begin(), f.end(), x), x);
f.insert(lower_bound(f.begin(), f.end(), x), x);
printf("%d ", f[i - cnt]);
}
return 0;
}