Submission #699751

# Submission time Handle Problem Language Result Execution time Memory
699751 2023-02-17T22:13:38 Z rWAn_abdelsalam Art Exhibition (JOI18_art) C++17
0 / 100
0 ms 212 KB
#include <iostream>
#include <bits/stdc++.h>
#define rWAn ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define ll long long
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
#define pi 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
using namespace std;


int main()
{
    rWAn

    int n;
    cin>>n;
    vector<pair<ll,ll> >v;
    for(int i=0;i<n;i++){
        ll x,y;
        cin>>x>>y;
        v.push_back(make_pair(x,y));
    }
    sort(all(v));
    ll s=0,mx=-1,mn=1e15;
    ll maxi=-1;
    for(auto i:v){
        s+=i.second;
        mx=max(mx,i.first);
        mn=min(mn,i.first);
        maxi=max(maxi,s-(mx-mn));
    }
    cout<<maxi<<endl;




    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -