Submission #269770

# Submission time Handle Problem Language Result Execution time Memory
269770 2020-08-17T10:04:54 Z mayhoubsaleh Vudu (COCI15_vudu) C++14
42 / 140
1000 ms 13944 KB
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define left 2*i+1
#define righ 2*i+2
#define mid (l+r)/2
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);


using namespace std;
const ll maxn=1e6+100;
const ll inf=1e9+10;
const ll mod=1e9+7;
const ll base=27;

int n;
int a[maxn];
int main()
{
    IOS
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    ll ans=0;
    ll p;
    cin>>p;
    for(int i=0;i<n;i++){
        ll sum=0;
        for(int j=i;j<n;j++){
            sum+=a[j];
            ans+=(sum>=p*(j-i+1));
        }
    }

    cout<<ans<<endl;
    return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 35 ms 384 KB Output is correct
2 Correct 20 ms 384 KB Output is correct
3 Correct 19 ms 384 KB Output is correct
4 Execution timed out 1050 ms 13432 KB Time limit exceeded
5 Execution timed out 1084 ms 7800 KB Time limit exceeded
6 Execution timed out 1094 ms 12024 KB Time limit exceeded
7 Execution timed out 1073 ms 12412 KB Time limit exceeded
8 Execution timed out 1092 ms 10872 KB Time limit exceeded
9 Execution timed out 1096 ms 13944 KB Time limit exceeded
10 Execution timed out 1046 ms 12152 KB Time limit exceeded