53392023-04-26 02:27:19tomi7Bájital (80 pont)cpp11Time limit exceeded 56/80300ms5640 KiB
// Source: https://usaco.guide/general/io

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

/*long long lko(unsigned long long n, unsigned long long m){
	if(n%m==0 || m%n==0){
		return min(n, m);
	}
	if(n>m){
		return lko(n%m, m);
	}else{
		return lko(m%n, n);
	}
}*/

int main() {
	int n;
	int x;
	cin>>n>>x;
	vector<int> a(n);
	unsigned long long valasz=0;
	unsigned long long es=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		valasz+=a[i]/x;
		es+=a[i]%x;
	}
	if(es>=valasz){
		cout<<valasz<<'\n';
	}else{
		for(int i=0;1;i++){
			if(es+x>=valasz-1){
				valasz--;
				break;
			}else{
				es+=x;
				valasz--;
			}
		}
		cout<<valasz<<'\n';
	}
}
SubtaskSumTestVerdictTimeMemory
base56/80
1Accepted0/03ms1808 KiB
2Accepted0/03ms2056 KiB
3Accepted2/24ms2272 KiB
4Accepted2/23ms2480 KiB
5Accepted2/23ms2520 KiB
6Accepted2/23ms2648 KiB
7Accepted4/44ms2864 KiB
8Accepted4/412ms2968 KiB
9Time limit exceeded0/2300ms2724 KiB
10Time limit exceeded0/2254ms2960 KiB
11Time limit exceeded0/2270ms3064 KiB
12Time limit exceeded0/2282ms3108 KiB
13Time limit exceeded0/2259ms3208 KiB
14Time limit exceeded0/2272ms3476 KiB
15Time limit exceeded0/2244ms3584 KiB
16Time limit exceeded0/2247ms3732 KiB
17Time limit exceeded0/2270ms3904 KiB
18Time limit exceeded0/2254ms4960 KiB
19Accepted2/293ms4932 KiB
20Accepted2/264ms4932 KiB
21Accepted2/252ms4936 KiB
22Accepted2/246ms4936 KiB
23Accepted4/43ms4440 KiB
24Accepted4/43ms4584 KiB
25Accepted4/43ms4668 KiB
26Accepted4/423ms5344 KiB
27Accepted4/439ms5344 KiB
28Accepted4/437ms5444 KiB
29Accepted4/437ms5576 KiB
30Accepted2/237ms5556 KiB
31Accepted2/237ms5640 KiB
32Time limit exceeded0/2231ms4444 KiB
33Time limit exceeded0/2284ms4572 KiB