Submission #1118573

# Submission time Handle Problem Language Result Execution time Memory
1118573 2024-11-25T17:02:01 Z heey Art Exhibition (JOI18_art) C++14
0 / 100
1 ms 336 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin >> n;
    vector<pair<int, int>> a(n);
    for(int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
    sort(a.begin(), a.end());


    int res = 0;
    int tsum = 0;
    int sum = 0;
    int l = 0, r = 0;
    while(r < n){
        tsum += a[r].second;
        sum += a[r].second;
        if(a[r].first - sum - a[l].first > 0){
            l = r;
            tsum = a[r].second;
        }
        res = max(res, tsum - a[r].first + a[l].first);
        r++;
    }

    cout << res << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -