65TLE,求调,悬关
查看原帖
65TLE,求调,悬关
1500355
kkksc78楼主2024/10/22 13:27
#include<iostream> 
#include<cmath> 
#include<string> 
#include<stdio.h>
#include<algorithm>
#include<iomanip>
using namespace std;
int a[100001], top = 0;
bool cmp(int x, int y) {
	if (x == y) return 0;
	return x > y;
}
int main() {
	int n, w, k;
	cin >> n >> w;
	while (n--) {
		cin >> k;
		a[++top] = k;
		if (top != 1)
			sort(a + 1, a + top + 1, cmp);
		if (top == 1)
			cout << k << ' ';
		else cout << a[max(1, top * w / 100)] << ' ';
	}
	return 0;
}
2024/10/22 13:27
加载中...