87682024-01-29 16:48:06999Bájital (80 pont)cpp17Time limit exceeded 44/80300ms5896 KiB
// Source: https://usaco.guide/general/io

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

signed 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/03ms1816 KiB
2Accepted0/03ms2060 KiB
3Accepted2/220ms2304 KiB
4Accepted2/217ms2512 KiB
5Accepted2/24ms2704 KiB
6Accepted2/218ms2728 KiB
7Accepted4/435ms2852 KiB
8Accepted4/4141ms2868 KiB
9Time limit exceeded0/2286ms3028 KiB
10Time limit exceeded0/2273ms3208 KiB
11Time limit exceeded0/2277ms3140 KiB
12Time limit exceeded0/2261ms3428 KiB
13Time limit exceeded0/2270ms3352 KiB
14Time limit exceeded0/2261ms3636 KiB
15Time limit exceeded0/2241ms3564 KiB
16Time limit exceeded0/2222ms3844 KiB
17Time limit exceeded0/2266ms3828 KiB
18Time limit exceeded0/2266ms3932 KiB
19Time limit exceeded0/2270ms4176 KiB
20Time limit exceeded0/2256ms4252 KiB
21Time limit exceeded0/2246ms4076 KiB
22Time limit exceeded0/2264ms4208 KiB
23Accepted4/43ms4192 KiB
24Accepted4/43ms4096 KiB
25Accepted4/43ms4340 KiB
26Accepted4/424ms5820 KiB
27Time limit exceeded0/4300ms4328 KiB
28Accepted4/4134ms5692 KiB
29Accepted4/486ms5792 KiB
30Accepted2/261ms5692 KiB
31Accepted2/245ms5896 KiB
32Time limit exceeded0/2264ms4464 KiB
33Time limit exceeded0/2270ms4440 KiB