Submission #541667

# Submission time Handle Problem Language Result Execution time Memory
541667 2022-03-24T06:03:22 Z pokmui9909 Art Exhibition (JOI18_art) C++17
0 / 100
1 ms 340 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define x first
#define y second
pair<ll, ll> A[500005];
ll S[500005];
ll N;

int main(){
    cin.tie(0) -> sync_with_stdio(false);

    cin >> N;
    for(int i = 1; i <= N; i++){
        cin >> A[i].x >> A[i].y;
    }
    sort(A + 1, A + N + 1);
    for(int i = 1; i <= N; i++){
        S[i] = S[i - 1] + A[i].y;
    }
    ll ans = 0;
    for(int i = 1; i <= N; i++){
        for(int j = i + 1; j <= N; j++){
            ans = max(ans, S[j] - S[i - 1] - A[j].x + A[i].x);
        }
    }
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -