제출 #459603

#제출 시각아이디문제언어결과실행 시간메모리
459603Blobo2_Blobo2Vudu (COCI15_vudu)C++14
0 / 140
191 ms25504 KiB
/* 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 timeMemoryGrader output
Fetching results...