#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
signed main(){
ios_base::sync_with_stdio();
cin.tie(0);cout.tie(0);
int n,p;
cin>>n;
vector <int> a(n);
for(int i=0;i<n;i++){
cin>>a[i];
}
cin>>p;
int res=0;
for(int i=0;i<n;i++){
int sum=0;
for(int j=i;j<n;j++){
sum+=a[j];
if(sum>=p*(j-i+1))res++;
}
}
cout<<res<<"\n";
}
/*
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
344 KB |
Output is correct |
2 |
Correct |
17 ms |
348 KB |
Output is correct |
3 |
Correct |
13 ms |
348 KB |
Output is correct |
4 |
Execution timed out |
1014 ms |
12892 KB |
Time limit exceeded |
5 |
Execution timed out |
1092 ms |
7572 KB |
Time limit exceeded |
6 |
Execution timed out |
1071 ms |
11520 KB |
Time limit exceeded |
7 |
Execution timed out |
1050 ms |
11860 KB |
Time limit exceeded |
8 |
Execution timed out |
1041 ms |
10612 KB |
Time limit exceeded |
9 |
Execution timed out |
1081 ms |
13472 KB |
Time limit exceeded |
10 |
Execution timed out |
1045 ms |
11760 KB |
Time limit exceeded |