Submission #947995

# Submission time Handle Problem Language Result Execution time Memory
947995 2024-03-17T11:30:33 Z Zena_Hossam Vudu (COCI15_vudu) C++14
126 / 140
722 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 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++)
        {

            ss+=(arr[i]-x);
           // cout<<c<<" ";

            ll k=ss;
            c+=(s.order_of_key(k+1));
            if(k>=0)c++;
            s.insert(ss);
           // cout<<c<<"\n";
        }
        cout<<c;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 860 KB Output is correct
2 Correct 3 ms 600 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 722 ms 64532 KB Output is correct
5 Correct 346 ms 36692 KB Output is correct
6 Correct 586 ms 57332 KB Output is correct
7 Correct 586 ms 59472 KB Output is correct
8 Correct 520 ms 51732 KB Output is correct
9 Runtime error 595 ms 65536 KB Execution killed with signal 9
10 Correct 652 ms 57948 KB Output is correct