Submission #248918

# Submission time Handle Problem Language Result Execution time Memory
248918 2020-07-13T18:15:19 Z rocks03 Art Exhibition (JOI18_art) C++14
0 / 100
1 ms 384 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<ll,ll>
#define ff first
#define ss second
#define pb push_back
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    vector<pii> v(N);
    for(int i = 0; i < N; i++) cin >> v[i].ff >> v[i].ss;
    sort(v.begin(), v.end());
    ll ans = v[0].ss;
    set<ll> s;
    s.insert(v[0].ff + v[0].ss);
    for(int i = 1; i < N; i++){
        ll best = *s.rbegin();
        ans = max(ans, best - v[i].ff + v[i].ss);
        s.insert(v[i].ff+v[i].ss);
        s.insert(best+v[i].ss);
    }
    cout << ans;
}

Compilation message

art.cpp:10:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -