Submission #926622

# Submission time Handle Problem Language Result Execution time Memory
926622 2024-02-13T12:43:18 Z VMaksimoski008 Art Exhibition (JOI18_art) C++14
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
int main() {
    int n, i;
    cin >> n;
 
    array<ll, 2> v[n+1];
    for(i=1; i<=n; i++) cin >> v[i][0] >> v[i][1];
    sort(v, v+n+1);
 
    ll A = 0, M = -1e18, S = 0;
    for(i=1; i<=n; i++) {
        M = max(M, v[i][0] - S);
        S += v[i][1];
        A = max(A, S - v[i][0] + M);
    }
 
    cout << A << '\n';
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -