Submission #1049851

# Submission time Handle Problem Language Result Execution time Memory
1049851 2024-08-09T05:46:13 Z vjudge1 Art Exhibition (JOI18_art) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
#define s second
#define ll long long
#define MAX 60 * 10000
void solve() {
    ll  n;
    cin >> n;
    vector <pair<ll,ll>> b(n);
    for (ll i = 0; i < n; i++) {
        cin >> b[i].first >> b[i].second;
    }  sort (b.begin(),b.end());
    vector <ll> pref(n + 1);
    pref[0] = 0;
    for (ll i = 1; i <= n; i++) {
        pref[i] = pref[i - 1] + b[i - 1].second;
    }
    ll max1 = INT_MIN;
    for (ll l = 0; l < n; l++) {
        for (ll r = l + 1; r < n; r++) {
            max1 = max(max1,(pref[r + 1] - pref[l]) - (b[r].first - b[l].first));
        }
    } cout << max1;
    
}
int main()
{
    solve();
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -