112502024-07-29 12:08:43bzyVásárlások inflációs hatása (75 pont)cpp14Wrong answer 3/753ms528 KiB
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int cn = n;
	int money = 0;
	vector<int>P;
	for(int i = 0;i<n;i++){
		int p;
		cin>>p;
		P.push_back(p);
	}
	sort(P.begin(),P.end());
	while(cn>0){
		money += P[n-cn];
		int inflation = P[n-cn];
		for(int i = n-cn+1;i<min(n-cn + k +1,n);i++){
			P[i] += inflation;
		}
		cn--;
	}
	cout<<money<<endl;
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base3/75
1Accepted0/03ms356 KiB
2Wrong answer0/03ms420 KiB
3Accepted1/13ms396 KiB
4Accepted1/13ms528 KiB
5Accepted1/13ms356 KiB
6Wrong answer0/13ms376 KiB
7Wrong answer0/13ms356 KiB
8Wrong answer0/13ms424 KiB
9Wrong answer0/13ms384 KiB
10Wrong answer0/12ms356 KiB
11Wrong answer0/22ms356 KiB
12Wrong answer0/53ms376 KiB
13Wrong answer0/53ms492 KiB
14Wrong answer0/53ms400 KiB
15Wrong answer0/53ms504 KiB
16Wrong answer0/53ms376 KiB
17Wrong answer0/53ms376 KiB
18Wrong answer0/53ms376 KiB
19Wrong answer0/53ms376 KiB
20Wrong answer0/53ms504 KiB
21Wrong answer0/53ms504 KiB
22Wrong answer0/53ms384 KiB
23Wrong answer0/53ms372 KiB
24Wrong answer0/53ms356 KiB