Submission #947989

# Submission time Handle Problem Language Result Execution time Memory
947989 2024-03-17T11:20:41 Z Zena_Hossam Vudu (COCI15_vudu) C++14
0 / 140
620 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()
ll a[1000006];
int arr[1000006];
int main()
{
    //freopen("stdin.in","r",stdin);freopen("stdout.out","w",stdout);
    int T=1;
    //cin>>T;ll oo=0;
    while(T--)
    {
        int n;
        cin>>n;
        for(int i=0; i<n; i++)
        {
            cin>>arr[i];
        }
        int x;
        cin>>x;
        ordered_set s;
        ll c=0;
        for(int i=0; i<n; i++)
        {
            a[i]+=(arr[i]-x);
            if(i)a[i]+=a[i-1];
           // cout<<c<<" ";
 
            ll k=a[i];
            c+=(s.order_of_key(k+1));
            s.insert(a[i]);
           // cout<<c<<"\n";
        }
        cout<<c;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 856 KB Output isn't correct
2 Incorrect 3 ms 860 KB Output isn't correct
3 Incorrect 3 ms 828 KB Output isn't correct
4 Runtime error 620 ms 65536 KB Execution killed with signal 9
5 Incorrect 362 ms 41024 KB Output isn't correct
6 Incorrect 603 ms 64512 KB Output isn't correct
7 Runtime error 560 ms 65536 KB Execution killed with signal 9
8 Incorrect 504 ms 58640 KB Output isn't correct
9 Runtime error 547 ms 65536 KB Execution killed with signal 9
10 Incorrect 582 ms 65404 KB Output isn't correct