Submission #1118564

# Submission time Handle Problem Language Result Execution time Memory
1118564 2024-11-25T16:54:09 Z heey Art Exhibition (JOI18_art) C++14
0 / 100
1 ms 348 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;

    for(int i = 0; i < n; i++){
        int b, c; cin >> b >> c;
        a.emplace_back(b, c);
    }

    sort(a.begin(), a.end());
    int res = 0;
    int tsum = 0;
    int l = 0, r = 0;
    while(r < n){
        tsum += a[r].second;

        if(a[r].first - tsum - 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 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 -