119452024-11-21 18:51:02tomi7Kövek (100 pont)cpp17Wrong answer 0/10024ms812 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;cin>>n;
	vector<int> a(n);
	int osszeg=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		osszeg+=a[i];
	}
	if(osszeg%n!=0){
		cout<<-1<<'\n';
		return 0;
	}
	int abcd=osszeg/n;
	int kkk=0;
	int ans=0;
	for(int i=0;i<n;i++){
		kkk+=a[i];
		if(kkk==abcd*(i+1)){
			kkk=0;
			ans++;
		}
	}
	ans++;
	cout<<n-ans<<'\n';
}
SubtaskSumTestVerdictTimeMemory
base0/100
1Accepted0/01ms320 KiB
2Wrong answer0/024ms568 KiB
3Wrong answer0/51ms320 KiB
4Wrong answer0/51ms320 KiB
5Wrong answer0/51ms320 KiB
6Wrong answer0/51ms320 KiB
7Wrong answer0/51ms320 KiB
8Wrong answer0/51ms320 KiB
9Wrong answer0/71ms324 KiB
10Wrong answer0/71ms320 KiB
11Wrong answer0/81ms320 KiB
12Wrong answer0/81ms500 KiB
13Wrong answer0/82ms508 KiB
14Wrong answer0/83ms320 KiB
15Wrong answer0/88ms564 KiB
16Wrong answer0/820ms568 KiB
17Wrong answer0/824ms812 KiB