# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
947299 |
2024-03-15T21:13:50 Z |
Zena_Hossam |
Vudu (COCI15_vudu) |
C++14 |
|
829 ms |
65536 KB |
#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 int
#define F first
#define S second
#define sz size()
#define all(s) s.begin(),s.end()
#define all1(s) s.rbegin(),s.rend()
ll1 a[1000006];
ll1 arr[1000006];
int main()
{
//freopen("stdin.in","r",stdin);freopen("stdout.out","w",stdout);
ll T=1;
fi
//cin>>T;ll oo=0;
while(T--)
{
ll1 n;
cin>>n;
for(ll i=0; i<n; i++)
{
cin>>arr[i];
}
ll1 x;
cin>>x;
ordered_set s;
ll c=0;
for(ll1 i=0; i<n; i++)
{
a[i]+=(arr[i]-x);
if(i)a[i]+=a[i-1];
// cout<<c<<" ";
ll k=a[i];
if(k>=0)
{
c+=(i+1-(s.size()-s.order_of_key(k+1)));
}
if(k<0)
{
c+=(s.order_of_key(k+1));
}
s.insert(a[i]);
// cout<<c<<"\n";
}
cout<<c;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
868 KB |
Output is correct |
2 |
Correct |
2 ms |
860 KB |
Output is correct |
3 |
Correct |
2 ms |
860 KB |
Output is correct |
4 |
Runtime error |
804 ms |
65536 KB |
Execution killed with signal 9 |
5 |
Incorrect |
444 ms |
38812 KB |
Output isn't correct |
6 |
Incorrect |
812 ms |
61108 KB |
Output isn't correct |
7 |
Incorrect |
796 ms |
63488 KB |
Output isn't correct |
8 |
Incorrect |
679 ms |
55700 KB |
Output isn't correct |
9 |
Runtime error |
812 ms |
65536 KB |
Execution killed with signal 9 |
10 |
Incorrect |
829 ms |
62268 KB |
Output isn't correct |