# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
459603 | Blobo2_Blobo2 | Vudu (COCI15_vudu) | C++14 | 191 ms | 25504 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
Editor: Abdelrahman Hossam
Nickname: Blobo2_Blobo2
IOI next year isA :)
*/
/*#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-funroll-all-loops,-fpeel-loops,-funswitch-loops")*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define all(v) v.begin(),v.end()
#define gen(arr,n,nxt) generate(arr,arr+n,nxt)
#define Blobo2_el_7akim_elly_3ayz_yro7_IOI_w_3ayz_yakol_jilaty ios_base::sync_with_stdio(false);cin.tie(0);
const int mo=1e9+7,INF=1e18;
int nxt(){int x;cin>>x;return x;}
signed main(){
Blobo2_el_7akim_elly_3ayz_yro7_IOI_w_3ayz_yakol_jilaty
int n=nxt();
int arr[n];gen(arr,n,nxt);
int p=nxt();
for(int i=0;i<n;i++)arr[i]-=p;
int cnt=0;
int pre[n+1];
pre[0]=0;
for(int i=0;i<n;i++)
pre[i+1]=pre[i]+arr[i];
for(int i=0;i<n;i++){
int s=0,e=i;
while(s<=e){
int mid=(s+e)/2;
int x = pre[i+1]-pre[mid];
if(x>=0)e=mid-1;
else s=mid+1;
}
if(s==i+1||s==-1)continue;
cnt+=i-s+1;
}
cout<<cnt<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |