50982023-04-16 22:00:49tomi7Bájital (80 pont)cpp11Time limit exceeded 0/80289ms6012 KiB
#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);
	vector<int> aa(n);
	int valasz=a[0]+a[1];
	int es=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i]==x){
			aa[i]++;
			es++;
		}
	}
	int kis=0, nagy=1;
	for(int i=0;kis!=n-1;i++){
		if(valasz>x){
			valasz-=a[kis];
			kis++;
		}else if(valasz==x){
			cout<<"Itt veszek el";
			for(int i=kis;i<=nagy;i++){
				aa[i]++;
			}
			es++;
		}else if(valasz<x){
			if(nagy<n-1){
				nagy++;
				valasz+=a[nagy];
			}else{
				break;
			}
		}
	}
    int vvalasz=0;
	for(int i=0;i<n;i++){
		vvalasz+=es-aa[i];
	}
	cout<<vvalasz<<'\n';
}
SubtaskSumTestVerdictTimeMemory
base0/80
1Time limit exceeded0/0289ms1204 KiB
2Wrong answer0/03ms2016 KiB
3Wrong answer0/23ms2220 KiB
4Wrong answer0/23ms2424 KiB
5Wrong answer0/23ms2520 KiB
6Wrong answer0/23ms2756 KiB
7Wrong answer0/43ms3124 KiB
8Wrong answer0/43ms3228 KiB
9Time limit exceeded0/2211ms3464 KiB
10Wrong answer0/239ms4412 KiB
11Time limit exceeded0/2210ms3316 KiB
12Wrong answer0/237ms4844 KiB
13Wrong answer0/239ms4948 KiB
14Wrong answer0/237ms4936 KiB
15Wrong answer0/239ms5088 KiB
16Time limit exceeded0/2287ms3924 KiB
17Wrong answer0/239ms5236 KiB
18Wrong answer0/239ms5236 KiB
19Wrong answer0/239ms5232 KiB
20Time limit exceeded0/2286ms4296 KiB
21Wrong answer0/237ms5448 KiB
22Wrong answer0/239ms5676 KiB
23Wrong answer0/43ms4220 KiB
24Wrong answer0/43ms4244 KiB
25Wrong answer0/43ms4220 KiB
26Time limit exceeded0/4250ms4284 KiB
27Wrong answer0/439ms5700 KiB
28Time limit exceeded0/4254ms4728 KiB
29Wrong answer0/437ms5992 KiB
30Time limit exceeded0/2231ms4668 KiB
31Wrong answer0/239ms6012 KiB
32Time limit exceeded0/2215ms4860 KiB
33Time limit exceeded0/2229ms4896 KiB