87672024-01-29 16:45:56999Bájital (80 pont)cpp17Wrong answer 44/80300ms17840 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, x; cin>>n>>x;
	vector<int> v(n);
	int sum1=0,sum2=0;
	for(int i = 0;i<n;i++){
		cin>>v[i];
		sum2+=v[i]%x;
		sum1+=v[i]/x;
	}
	int ans=0;
	for(int i = 0;i<=sum1;i++){
		ans=max(ans,min(sum1-i,sum2+x*i));
	}
	cout<<ans<<endl;
}
SubtaskSumTestVerdictTimeMemory
base44/80
1Accepted0/03ms1964 KiB
2Accepted0/03ms2016 KiB
3Accepted2/220ms2228 KiB
4Accepted2/217ms2320 KiB
5Accepted2/24ms2448 KiB
6Accepted2/218ms2632 KiB
7Accepted4/435ms2600 KiB
8Accepted4/4141ms2628 KiB
9Wrong answer0/241ms3984 KiB
10Time limit exceeded0/2250ms3656 KiB
11Wrong answer0/241ms5632 KiB
12Time limit exceeded0/2300ms5288 KiB
13Time limit exceeded0/2268ms5980 KiB
14Wrong answer0/241ms7768 KiB
15Wrong answer0/241ms8712 KiB
16Time limit exceeded0/2250ms8184 KiB
17Time limit exceeded0/2284ms8976 KiB
18Time limit exceeded0/2252ms9596 KiB
19Wrong answer0/241ms11392 KiB
20Time limit exceeded0/2300ms10892 KiB
21Time limit exceeded0/2248ms11688 KiB
22Time limit exceeded0/2268ms12624 KiB
23Accepted4/43ms13064 KiB
24Accepted4/43ms13044 KiB
25Accepted4/43ms13060 KiB
26Accepted4/425ms14092 KiB
27Time limit exceeded0/4241ms13656 KiB
28Accepted4/4136ms15436 KiB
29Accepted4/489ms16112 KiB
30Accepted2/264ms16856 KiB
31Accepted2/246ms17468 KiB
32Time limit exceeded0/2244ms17104 KiB
33Time limit exceeded0/2273ms17840 KiB