Files
python/TangDou/CSP-J/J2_2020/2_Vector_STL.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

19 lines
559 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}