Submission #947285

# Submission time Handle Problem Language Result Execution time Memory
947285 2024-03-15T20:55:25 Z Zena_Hossam Vudu (COCI15_vudu) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

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 ll long long
//#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()
int main()
{
    //freopen("stdin.in","r",stdin);freopen("stdout.out","w",stdout);
    ll T=1;
    fi
    //cin>>T;ll oo=0;
    while(T--)
    {
        ll n;
        cin>>n;
        ll arr[n];
        for(ll i=0; i<n; i++)
        {
            cin>>arr[i];
        }
        ll x;
        cin>>x;
        ll a[n]= {};
        ordered_set s,v;
        ll c=0;
        for(ll 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+=(v.order_of_key(k+1));
            }if(a[i]>=0)
            {
                s.insert(a[i]);
            }
            else v.insert(a[i]);
           // cout<<c<<"\n";
        }
        cout<<c;
    }
}

Compilation message

vudu.cpp:8:14: error: 'll' was not declared in this scope
    8 | typedef tree<ll,
      |              ^~
vudu.cpp:8:14: note: the macro 'll' had not yet been defined
vudu.cpp:17: note: it was later defined here
   17 | #define ll long long
      | 
vudu.cpp:10:20: error: 'll' was not declared in this scope
   10 |         less_equal<ll>,
      |                    ^~
vudu.cpp:10:20: note: the macro 'll' had not yet been defined
vudu.cpp:17: note: it was later defined here
   17 | #define ll long long
      | 
vudu.cpp:10:22: error: template argument 1 is invalid
   10 |         less_equal<ll>,
      |                      ^
vudu.cpp:12:42: error: template argument 1 is invalid
   12 |         tree_order_statistics_node_update> ordered_set;
      |                                          ^
vudu.cpp:12:42: error: template argument 3 is invalid
vudu.cpp: In function 'int main()':
vudu.cpp:53:28: error: request for member 'size' in 's', which is of non-class type '__gnu_pbds::ordered_set' {aka 'int'}
   53 |                 c+=(i+1-(s.size()-s.order_of_key(k+1)));
      |                            ^~~~
vudu.cpp:53:37: error: request for member 'order_of_key' in 's', which is of non-class type '__gnu_pbds::ordered_set' {aka 'int'}
   53 |                 c+=(i+1-(s.size()-s.order_of_key(k+1)));
      |                                     ^~~~~~~~~~~~
vudu.cpp:57:23: error: request for member 'order_of_key' in 'v', which is of non-class type '__gnu_pbds::ordered_set' {aka 'int'}
   57 |                 c+=(v.order_of_key(k+1));
      |                       ^~~~~~~~~~~~
vudu.cpp:60:19: error: request for member 'insert' in 's', which is of non-class type '__gnu_pbds::ordered_set' {aka 'int'}
   60 |                 s.insert(a[i]);
      |                   ^~~~~~
vudu.cpp:62:20: error: request for member 'insert' in 'v', which is of non-class type '__gnu_pbds::ordered_set' {aka 'int'}
   62 |             else v.insert(a[i]);
      |                    ^~~~~~