Submission #45660

# Submission time Handle Problem Language Result Execution time Memory
45660 2018-04-15T20:12:15 Z reality Art Exhibition (JOI18_art) C++17
0 / 100
2 ms 248 KB
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void) {
    int n;
    cin>>n;
    vector < pair < ll , ll > > s(n);
    for (auto & it : s)
        cin>>it.fi>>it.se;
    sort(all(s));
    vl ss;
    for (int i = 1;i < n;++i)
        s[i].se += s[i - 1].se;
    ll mn = -s[0].fi;
    ll ans = -1e18;
    for (int i = 1;i < n;++i) {
        smax(ans,s[i].se - s[i].fi - mn);
        smin(mn,s[i - 1].se - s[i].fi);
    }
    cout << ans << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -