Submission #433038

#TimeUsernameProblemLanguageResultExecution timeMemory
433038chirathnirodhaArt Exhibition (JOI18_art)C++17
Compilation error
0 ms0 KiB
//Coded by Chirath Nirodha
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define P push
#define I insert
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
using namespace std;
const ll mod=1e9+7;
inline void io(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}
void solve(){
    int n;cin>>n;
    vector<pair<ll,ll> > v;
    for(int i=0;i<n;i++){
        ll a,b;cin>>a>>b;
        v.PB(MP(a,b));
    }
    sort(v.begin(),v.end());
    ll cur=0,ans=0;
    for(int i=0;i<n;i++){
        ans=max(ans,cur+v[i].S-v[i].F);
        ans=max(ans,v[i].S);
        cur=max(cur+v[i].S,v[i].F+v[i].S);
    }
    cout<<ans<<endl;
}
int main(){
    io();
	solve();
	//int t;cin>>t;for(int i=0;i<t;i++)solve();
    return 0;
}

Compilation message (stderr)

art.cpp:14:28: error: 'less' was not declared in this scope; did you mean 'std::less'?
   14 | typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
      |                            ^~~~
      |                            std::less
In file included from /usr/include/c++/10/string:48,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from art.cpp:2:
/usr/include/c++/10/bits/stl_function.h:340:12: note: 'std::less' declared here
  340 |     struct less;
      |            ^~~~
art.cpp:14:36: error: template argument 3 is invalid
   14 | typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
      |                                    ^
art.cpp:14:37: error: expected unqualified-id before ',' token
   14 | typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
      |                                     ^
art.cpp:14:83: error: expected initializer before '>' token
   14 | typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
      |                                                                                   ^