Algorithm/csp-awarding/main.cc

25 lines
447 B
C++
Raw Normal View History

#include <iostream>
#include <algorithm>
using namespace std;
int bkt[1005];
int main() {
int n, w;
cin >> n >> w;
for (int i = 0; i < n; i++) {
int ele;
cin >> ele;
bkt[ele]++;
int tot = 0;
for (int j = 600; j >= 0; j--) {
tot += bkt[j];
if (tot >= max(1, (i + 1) * w / 100)) {
printf("%d ", j);
break;
}
}
}
}