#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
using namespace std;
namespace __gnu_pbds
{
typedef tree<ll,
null_type,
less_equal<ll>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
}
using namespace __gnu_pbds;
#define fi ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define ll double
#define ll1 long long
#define F first
#define S second
#define sz size()
#define all(s) s.begin(),s.end()
#define all1(s) s.rbegin(),s.rend()
int arr[1000006];
int main()
{
//freopen("stdin.in","r",stdin);freopen("stdout.out","w",stdout);
//cin>>T;ll oo=0; int n;
cin>>n;
for(int i=0; i<n; i++)
{
cin>>arr[i];
}
int x;
cin>>x;
ordered_set s;
ll c=0,ss=0;
for(int i=0; i<n; i++)
{
if(i)a[i]+=a[i-1];
a[i]+=(arr[i]-x);
// cout<<c<<" ";
ll k=a[i];
c+=(s.order_of_key(k+1));
if(k>=0)c++;
s.insert(a[i]);
// cout<<c<<"\n";
}
cout<<c;
}
Compilation message
vudu.cpp: In function 'int main()':
vudu.cpp:29:14: error: 'n' was not declared in this scope; did you mean 'yn'?
29 | cin>>n;
| ^
| yn
vudu.cpp:40:18: error: 'a' was not declared in this scope
40 | if(i)a[i]+=a[i-1];
| ^
vudu.cpp:41:13: error: 'a' was not declared in this scope
41 | a[i]+=(arr[i]-x);
| ^
vudu.cpp:37:16: warning: unused variable 'ss' [-Wunused-variable]
37 | ll c=0,ss=0;
| ^~