87692024-01-29 16:55:41999Bájital (80 pont)cpp17Time limit exceeded 44/80280ms6184 KiB
// Source: https://usaco.guide/general/io
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#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/03ms1812 KiB
2Accepted0/03ms2056 KiB
3Accepted2/217ms2212 KiB
4Accepted2/213ms2464 KiB
5Accepted2/24ms2788 KiB
6Accepted2/214ms2936 KiB
7Accepted4/428ms3156 KiB
8Accepted4/4108ms3168 KiB
9Time limit exceeded0/2250ms3472 KiB
10Time limit exceeded0/2261ms3644 KiB
11Time limit exceeded0/2264ms3864 KiB
12Time limit exceeded0/2268ms3816 KiB
13Time limit exceeded0/2268ms3988 KiB
14Time limit exceeded0/2273ms4164 KiB
15Time limit exceeded0/2273ms4360 KiB
16Time limit exceeded0/2270ms4388 KiB
17Time limit exceeded0/2280ms4672 KiB
18Time limit exceeded0/2266ms4624 KiB
19Time limit exceeded0/2248ms4672 KiB
20Time limit exceeded0/2280ms4648 KiB
21Time limit exceeded0/2273ms4672 KiB
22Time limit exceeded0/2280ms4708 KiB
23Accepted4/43ms4832 KiB
24Accepted4/42ms4708 KiB
25Accepted4/43ms4824 KiB
26Accepted4/426ms6184 KiB
27Time limit exceeded0/4250ms4724 KiB
28Accepted4/4115ms6184 KiB
29Accepted4/479ms6092 KiB
30Accepted2/261ms6096 KiB
31Accepted2/246ms6096 KiB
32Time limit exceeded0/2259ms4844 KiB
33Time limit exceeded0/2224ms4820 KiB