P7072 [CSP-J2020] 直播获奖
#include<cstdio> #include<algorithm> #include<vector> #include<cmath> #include<functional> using namespace std; vector <int> a; int n,w,p; int main() { scanf("%d %d",&n,&w); for (int i=1;i<=n;i++) { int x; scanf("%d",&x); if (a.empty()) { a.push_back(x); } else { vector<int>::iterator wz; wz=upper_bound(a.begin(),a.end(),x,greater<int>()); a.insert(wz,x); /* for(int j=0;j<a.size();j++) { printf("%d ",a[j]); } printf("\n"); */ } p=max(1,i*w/100); printf("%d ",a[p-1]); } }