Submission #1049802

# Submission time Handle Problem Language Result Execution time Memory
1049802 2024-08-09T05:19:00 Z vjudge1 Art Exhibition (JOI18_art) C++17
0 / 100
1 ms 344 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;
    } vector <ll> dp(n + 1);
    dp[0] = 0;
    int s = 0;
    ll max1 = 0,min1 = LLONG_MAX;
    for (ll i = 1; i <= n; i++) {
        if (dp[i - 1] > (s + b[i - 1].s) - (max(b[i - 1].first,max1) - min(b[i - 1].first,min1))) {
            dp[i] = dp[i - 1];
        } else {
          dp[i] = (s + b[i - 1].s) - (max(b[i - 1].first,max1) - min(b[i - 1].first,min1));
          s += b[i - 1].s;
          max1 = max(b[i - 1].first,max1);
          min1 = min(b[i - 1].first,min1);
        }
    } cout << dp[n];
}
int main()
{
    solve();
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -