Submission #859779

# Submission time Handle Problem Language Result Execution time Memory
859779 2023-10-10T15:45:04 Z activedeltorre Peru (RMI20_peru) C++14
Compilation error
0 ms 0 KB
include <iostream>
#include <queue>
#include <stack>
#include "peru.h"
using namespace std;
long long lazy[8300005];
long long va[8300005];
int vec[5000005];
//ifstream cin("a.in");
//ofstream cout("a.out");
stack<pair<long long,int> >st;
void push_lazy(int node,int st,int dr)
{
    va[node]+=lazy[node];
    if(st!=dr)
    {
        lazy[node*2]+=lazy[node];
        lazy[node*2+1]+=lazy[node];
    }
    lazy[node]=0;
}
void update(int node,int st,int dr,int qst,int qdr,long long val)
{
    push_lazy(node,st,dr);
    if(st>dr || st>qdr || qst>dr || qst>qdr)
        return ;
    if(qst<=st && dr<=qdr)
    {
        lazy[node]=val;
        push_lazy(node,st,dr);
        return ;
    }
    int mij=(st+dr)/2;
    update(node*2,st,mij,qst,qdr,val);
    update(node*2+1,mij+1,dr,qst,qdr,val);
    va[node]=min(va[node*2],va[node*2+1]);
}
long long querry(int node,int st,int dr,int qst,int qdr)
{
    push_lazy(node,st,dr);
    if(st>dr || st>qdr || qst>dr || qst>qdr)
        return 1e18;
    if(qst<=st && dr<=qdr)
        return va[node];
    int mij=(st+dr)/2;
    return min(querry(node*2,st,mij,qst,qdr),querry(node*2+1,mij+1,dr,qst,qdr));
}
long long dp[2500005];
int solve(int n, int k, int* v)
{
    int a,b,i,poz;
    long long val;
    for(i=1;i<=n;i++)
    {
        vec[i]=v[i-1];
    }
    st.push({1e18,-1});
    for(i=1;i<=n;i++)
    {
        a=vec[i];
        while(a>st.top().first)
        {
            val=st.top().first;
            poz=st.top().second;
            st.pop();
            update(1,0,n,st.top().second,poz-1,-val);
        }
        update(1,0,n,st.top().second,i-1,a);
        st.push({a,i});
        dp[i]=querry(1,0,n,max(0,i-k),i-1);
        update(1,0,n,i,i,dp[i]);
    }
    int maxim=0;
    dp[n+1]=1e18;
    for(i=n;i>=n-k+1;i--)
    {
        dp[n+1]=min(dp[n+1],dp[i]+maxim);
        maxim=max(maxim,vec[i]);
    }
    dp[n+2]=1e18;
    for(i=n;i>=1;i--)
    {
        dp[i]=min(dp[i],dp[i+1]);
    }
    long long suma=0,mod=1000000007;
    for(i=1;i<=n;i++)
    {
        suma=(suma*23+dp[i])%mod;
     //   cout<<dp[i]<<" ";
    }
    return suma;
}
/*
//#include "peru.h"
using namespace std;
 
static int s[2500005];
static int n, k;
signed main(){
    cin>> n >> k;
    for(int i = 0; i < n; i++){
        cin>> s[i];
    }
    int ans = solve(n, k, s);
    cout<< ans <<"\n";
    return 0;
}*/

Compilation message

peru.cpp:1:1: error: 'include' does not name a type
    1 | include <iostream>
      | ^~~~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:62,
                 from /usr/include/c++/10/deque:60,
                 from /usr/include/c++/10/queue:60,
                 from peru.cpp:2:
/usr/include/c++/10/ext/type_traits.h:162:35: error: 'bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
  162 |   __is_null_pointer(std::nullptr_t)
      |                                   ^
/usr/include/c++/10/ext/type_traits.h:157:5: note: previous declaration 'template<class _Type> bool __gnu_cxx::__is_null_pointer(_Type)'
  157 |     __is_null_pointer(_Type)
      |     ^~~~~~~~~~~~~~~~~
/usr/include/c++/10/ext/type_traits.h:162:26: error: 'nullptr_t' is not a member of 'std'
  162 |   __is_null_pointer(std::nullptr_t)
      |                          ^~~~~~~~~
In file included from /usr/include/c++/10/bits/move.h:57,
                 from /usr/include/c++/10/bits/stl_pair.h:59,
                 from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/deque:60,
                 from /usr/include/c++/10/queue:60,
                 from peru.cpp:2:
/usr/include/c++/10/type_traits:200:27: error: 'size_t' has not been declared
  200 |   template <typename _Tp, size_t = sizeof(_Tp)>
      |                           ^~~~~~
/usr/include/c++/10/type_traits:402:31: error: 'std::size_t' has not been declared
  402 |   template<typename _Tp, std::size_t _Size>
      |                               ^~~~~~
/usr/include/c++/10/type_traits:403:25: error: '_Size' was not declared in this scope
  403 |     struct is_array<_Tp[_Size]>
      |                         ^~~~~
/usr/include/c++/10/type_traits:403:31: error: template argument 1 is invalid
  403 |     struct is_array<_Tp[_Size]>
      |                               ^
/usr/include/c++/10/type_traits:508:42: error: 'nullptr_t' is not a member of 'std'
  508 |     struct __is_null_pointer_helper<std::nullptr_t>
      |                                          ^~~~~~~~~
/usr/include/c++/10/type_traits:508:42: error: 'nullptr_t' is not a member of 'std'
/usr/include/c++/10/type_traits:508:51: error: template argument 1 is invalid
  508 |     struct __is_null_pointer_helper<std::nullptr_t>
      |                                                   ^
/usr/include/c++/10/type_traits:984:26: error: 'size_t' has not been declared
  984 |   template<typename _Tp, size_t _Num>
      |                          ^~~~~~
/usr/include/c++/10/type_traits:985:49: error: '_Num' was not declared in this scope
  985 |     struct __is_nt_constructible_impl<true, _Tp[_Num]>
      |                                                 ^~~~
/usr/include/c++/10/type_traits:985:54: error: template argument 2 is invalid
  985 |     struct __is_nt_constructible_impl<true, _Tp[_Num]>
      |                                                      ^
/usr/include/c++/10/type_traits:1351:37: error: 'size_t' is not a member of 'std'
 1351 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                     ^~~~~~
/usr/include/c++/10/type_traits:1351:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/10/type_traits:1351:57: error: template argument 1 is invalid
 1351 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                                         ^
/usr/include/c++/10/type_traits:1351:57: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1360:37: error: 'size_t' is not a member of 'std'
 1360 |     : public integral_constant<std::size_t, 0> { };
      |                                     ^~~~~~
/usr/include/c++/10/type_traits:1360:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/10/type_traits:1360:46: error: template argument 1 is invalid
 1360 |     : public integral_constant<std::size_t, 0> { };
      |                                              ^
/usr/include/c++/10/type_traits:1360:46: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1362:31: error: 'std::size_t' has not been declared
 1362 |   template<typename _Tp, std::size_t _Size>
      |                               ^~~~~~
/usr/include/c++/10/type_traits:1363:21: error: '_Size' was not declared in this scope
 1363 |     struct rank<_Tp[_Size]>
      |                     ^~~~~
/usr/include/c++/10/type_traits:1363:27: error: template argument 1 is invalid
 1363 |     struct rank<_Tp[_Size]>
      |                           ^
/usr/include/c++/10/type_traits:1364:37: error: 'size_t' is not a member of 'std'
 1364 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                     ^~~~~~
/usr/include/c++/10/type_traits:1364:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/10/type_traits:1364:65: error: template argument 1 is invalid
 1364 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                                                 ^
/usr/include/c++/10/type_traits:1364:65: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1368:37: error: 'size_t' is not a member of 'std'
 1368 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                     ^~~~~~
/usr/include/c++/10/type_traits:1368:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/10/type_traits:1368:65: error: template argument 1 is invalid
 1368 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                                                 ^
/usr/include/c++/10/type_traits:1368:65: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1373:37: error: 'size_t' is not a member of 'std'
 1373 |     : public integral_constant<std::size_t, 0> { };
      |                                     ^~~~~~
/usr/include/c++/10/type_traits:1373:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/10/type_traits:1373:46: error: template argument 1 is invalid
 1373 |     : public integral_constant<std::size_t, 0> { };
      |                                              ^
/usr/include/c++/10/type_traits:1373:46: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1375:47: error: 'std::size_t' has not been declared
 1375 |   template<typename _Tp, unsigned _Uint, std::size_t _Size>
      |                                               ^~~~~~
/usr/include/c++/10/type_traits:1376:23: error: '_Size' was not declared in this scope
 1376 |     struct extent<_Tp[_Size], _Uint>
      |                       ^~~~~
/usr/include/c++/10/type_traits:1376:36: error: template argument 1 is invalid
 1376 |     struct extent<_Tp[_Size], _Uint>
      |                                    ^
/usr/include/c++/10/type_traits:1377:37: error: 'size_t' is not a member of 'std'
 1377 |     : public integral_constant<std::size_t,
      |                                     ^~~~~~
/usr/include/c++/10/type_traits:1377:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/10/type_traits:1378:24: error: '_Size' was not declared in this scope
 1378 |           _Uint == 0 ? _Size : extent<_Tp,
      |                        ^~~~~
/usr/include/c++/10/type_traits:1379:28: error: template argument 1 is invalid
 1379 |           _Uint - 1>::value>
      |                            ^
/usr/include/c++/10/type_traits:1379:28: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1384:37: error: 'size_t' is not a member of 'std'
 1384 |     : public integral_constant<std::size_t,
      |                                     ^~~~~~
/usr/include/c++/10/type_traits:1384:37: error: 'size_t' is not a member of 'std'
/usr/include/c++/10/type_traits:1386:31: error: template argument 1 is invalid
 1386 |              _Uint - 1>::value>
      |                               ^
/usr/include/c++/10/type_traits:1386:31: note: invalid template non-type parameter
/usr/include/c++/10/type_traits:1753:26: error: 'size_t' does not name a type
 1753 |       { static constexpr size_t __size = sizeof(_Tp); };
      |                          ^~~~~~
In file included from /usr/include/c++/10/bits/move.h:57,
                 from /usr/include/c++/10/bits/stl_pair.h:59,
                 from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/deque:60,
                 from /usr/include/c++/10/queue:60,
                 from peru.cpp:2:
/usr/include/c++/10/type_traits:1:1: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
  +++ |+#include <cstddef>
    1 | // C++11 <type_traits> -*- C++ -*-
In file included from /usr/include/c++/10/bits/move.h:57,
                 from /usr/include/c++/10/bits/stl_pair.h:59,
                 from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/deque:60,
                 from /usr/include/c++/10/queue:60,
                 from peru.cpp:2:
/usr/include/c++/10/type_traits:1755:14: error: 'size_t' has not been declared
 1755 |     template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
      |              ^~~~~~
/usr/include/c++/10/type_traits:1755:48: error: '_Sz' was not declared in this scope
 1755 |     template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
      |                                                ^~~
/usr/include/c++/10/type_traits:1756:14: error: no default argument for '_Tp'
 1756 |       struct __select;
      |              ^~~~~~~~
/usr/include/c++/10/type_traits:1758:14: error: 'size_t' has not been declared
 1758 |     template<size_t _Sz, typename _Uint, typename... _UInts>
      |              ^~~~~~
/usr/include/c++/10/type_traits:1759:23: error: '_Sz' was not declared in this scope
 1759 |       struct __select<_Sz, _List<_Uint, _UInts...>, true>
      |                       ^~~
/usr/include/c++/10/type_traits:1759:57: error: template argument 1 is invalid
 1759 |       struct __select<_Sz, _List<_Uint, _UInts...>, true>
      |                                                         ^
/usr/include/c++/10/type_traits:1762:14: error: 'size_t' has not been declared
 1762 |     template<size_t _Sz, typename _Uint, typename... _UInts>
      |              ^~~~~~
/usr/include/c++/10/type_traits:1763:23: error: '_Sz' was not declared in this scope
 1763 |       struct __select<_Sz, _List<_Uint, _UInts...>, false>
      |                       ^~~
/usr/include/c++/10/type_traits:1763:58: error: template argument 1 is invalid
 1763 |       struct __select<_Sz, _List<_Uint, _UInts...>, false>
      |                                                          ^
/usr/include/c++/10/type_traits:1764:18: error: '_Sz' was not declared in this scope
 1764 |       : __select<_Sz, _List<_UInts...>>
      |                  ^~~
/usr/include/c++/10/type_traits:1764:38: error: template argument 1 is invalid
 1764 |       : __select<_Sz, _List<_UInts...>>
      |                                      ^~
/usr/include/c++/10/type_traits:1755:60: error: '__size' is not a member of 'std::__make_unsigned_selector_base::_List<unsigned char, short unsigned int, unsigned int, long unsigned int, long long unsigned int>'
 1755 |     template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
      |                                                            ^~~~~~
/usr/include/c++/10/type_traits:1777:68: error: template argument 3 is invalid
 1777 |       using __unsigned_type = typename __select<sizeof(_Tp), _UInts>::__type;
      |                                                                    ^
/usr/include/c++/10/type_traits:1781:40: error: '__unsigned_type' was not declared in this scope
 1781 |  = typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
      |                                        ^~~~~~~~~~~~~~~
/usr/include/c++/10/type_traits:1781:55: error: template argument 2 is invalid
 1781 |  = typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
      |                                                       ^
/usr/include/c++/10/type_traits:1793:61: error: '__type' in 'class std::__make_unsigned_selector<wchar_t, false, true>' does not name a type
 1793 |  = typename __make_unsigned_selector<wchar_t, false, true>::__type;
      |                                                             ^~~~~~
/usr/include/c++/10/type_traits:1810:62: error: '__type' in 'class std::__make_unsigned_selector<char16_t, false, true>' does not name a type
 1810 |  = typename __make_unsigned_selector<char16_t, false, true>::__type;
      |                                                              ^~~~~~
/usr/include/c++/10/type_traits:1817:62: error: '__type' in 'class std::__make_unsigned_selector<char32_t, false, true>' does not name a type
 1817 |  = typename __make_unsigned_selector<char32_t, false, true>::__type;
      |                                                              ^~~~~~
/usr/include/c++/10/type_traits: In instantiation of 'class std::__make_unsigned_selector<wchar_t, true, false>':
/usr/include/c++/10/type_traits:1904:62:   required from 'class std::__make_signed_selector<wchar_t, false, true>'
/usr/include/c++/10/type_traits:1919:57:   required from here
/usr/include/c++/10/type_traits:1738:13: error: no type named '__type' in 'struct std::__make_unsigned<wchar_t>'
 1738 |       using __unsigned_type
      |             ^~~~~~~~~~~~~~~
/usr/include/c++/10/type_traits:1742:13: error: no type named '__type' in 'struct std::__make_unsigned<wchar_t>'
 1742 |       using __type
      |             ^~~~~~
/usr/include/c++/10/type_traits:1919:59: error: invalid combination of multiple type-specifiers
 1919 |  = typename __make_signed_selector<wchar_t, false, true>::__type;
      |                                                           ^~~~~~
/usr/include/c++/10/type_traits: In instantiation of 'class std::__make_unsigned_selector<char16_t, true, false>':
/usr/include/c++/10/type_traits:1904:62:   required from 'class std::__make_signed_selector<char16_t, false, true>'
/usr/include/c++/10/type_traits:1936:58:   required from here
/usr/include/c++/10/type_traits:1738:13: error: no type named '__type' in 'struct std::__make_unsigned<char16_t>'
 1738 |       using __unsigned_type
      |             ^~~~~~~~~~~~~~~
/usr/include/c++/10/type_traits:1742:13: error: no type named '__type' in 'struct std::__make_unsigned<char16_t>'
 1742 |       using __type
      |             ^~~~~~
/usr/include/c++/10/type_traits:1936:60: error: invalid combination of multiple type-specifiers
 1936 |  = typename __make_signed_selector<char16_t, false, true>::__type;
      |                                                            ^~~~~~
/usr/include/c++/10/type_traits: In instantiation of 'class std::__make_unsigned_selector<char32_t, true, false>':
/usr/include/c++/10/type_traits:1904:62:   required from 'class std::__make_signed_selector<char32_t, false, true>'
/usr/include/c++/10/type_traits:1943:58:   required from here
/usr/include/c++/10/type_traits:1738:13: error: no type named '__type' in 'struct std::__make_unsigned<char32_t>'
 1738 |       using __unsigned_type
      |             ^~~~~~~~~~~~~~~
/usr/include/c++/10/type_traits:1742:13: error: no type named '__type' in 'struct std::__make_unsigned<char32_t>'
 1742 |       using __type
      |             ^~~~~~
/usr/include/c++/10/type_traits:1943:60: error: invalid combination of multiple type-specifiers
 1943 |  = typename __make_signed_selector<char32_t, false, true>::__type;
      |                                                            ^~~~~~
/usr/include/c++/10/type_traits:1975:31: error: 'std::size_t' has not been declared
 1975 |   template<typename _Tp, std::size_t _Size>
      |                               ^~~~~~
/usr/include/c++/10/type_traits:1976:30: error: '_Size' was not declared in this scope
 1976 |     struct remove_extent<_Tp[_Size]>
      |                              ^~~~~
/usr/include/c++/10/type_traits:1976:36: error: template argument 1 is invalid
 1976 |     struct remove_extent<_Tp[_Size]>
      |                                    ^
/usr/include/c++/10/type_traits:1988:31: error: 'std::size_t' has not been declared
 1988 |   template<typename _Tp, std::size_t _Size>
      |                               ^~~~~~
/usr/include/c++/10/type_traits:1989:35: error: '_Size' was not declared in this scope
 1989 |     struct remove_all_extents<_Tp[_Size]>
      |                                   ^~~~~
/usr/include/c++/10/type_traits:1989:41: error: template argument 1 is invalid
 1989 |     struct remove_all_extents<_Tp[_Size]>
      |                                         ^
/usr/include/c++/10/type_traits:2047:17: error: 'std::size_t' has not been declared
 2047 |   template<std::size_t _Len>
      |                 ^~~~~~
/usr/include/c++/10/type_traits:2052:23: error: '_Len' was not declared in this scope
 2052 |  unsigned char __data[_Len];
      |                       ^~~~
/usr/include/c++/10/type_traits:2067:17: error: 'std::size_t' has not been declared
 2067 |   template<std::size_t _Len, std::size_t _Align =
      |                 ^~~~~~
/usr/include/c++/10/type_traits:2067:35: error: 'std::size_t' has not been declared
 2067 |   template<std::size_t _Len, std::size_t _Align =
      |                                   ^~~~~~
/usr/include/c++/10/type_traits:2068:48: error: '_Len' was not declared in this scope
 2068 |     __alignof__(typename __aligned_storage_msa<_Len>::__type)>
      |                                                ^~~~
/usr/include/c++/10/type_traits:2068:52: error: template argument 1 is invalid
 2068 |     __alignof__(typename __aligned_storage_msa<_Len>::__type)>
      |                                                    ^
/usr/include/c++/10/type_traits:2073:23: error: '_Len' was not declared in this scope
 2073 |  unsigned char __data[_Len];
      |                       ^~~~
/usr/include/c++/10/type_traits:2074:37: error: '_Align' was not declared in this scope
 2074 |  struct __attribute__((__aligned__((_Align)))) { } __align;
      |                                     ^~~~~~
/usr/include/c++/10/type_traits:2081:20: error: 'size_t' does not name a type
 2081 |       static const size_t _S_alignment = 0;
      |                    ^~~~~~
/usr/include/c++/10/type_traits:2081:20: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
/usr/include/c++/10/type_traits:2082:20: error: 'size_t' does not name a type
 2082 |       static const size_t _S_size = 0;
      |                    ^~~~~~
/usr/include/c++/10/type_traits:2082:20: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
/usr/include/c++/10/type_traits:2088:20: error: 'size_t' does not name a type
 2088 |       static const size_t _S_alignment =
      |                    ^~~~~~
/usr/include/c++/10/type_traits:2088:20: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
/usr/include/c++/10/type_traits:2091:20: error: 'size_t' does not name a type
 2091 |       static const size_t _S_size =
      |                    ^~~~~~
/usr/include/c++/10/type_traits:2091:20: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
/usr/include/c++/10/type_traits:2106:13: error: 'size_t' has not been declared
 2106 |   template <size_t _Len, typename... _Types>
      |             ^~~~~~
/usr/include/c++/10/type_traits:2113:20: error: 'size_t' does not name a type
 2113 |       static const size_t _S_len = _Len > __strictest::_S_size
      |                    ^~~~~~
/usr/include/c++/10/type_traits:2113:20: note: 'size_t' is defined