Submission #1033935

# Submission time Handle Problem Language Result Execution time Memory
1033935 2024-07-25T07:53:57 Z vjudge1 Art Exhibition (JOI18_art) C++17
0 / 100
0 ms 348 KB
#include<bits/stdc++.h>
using namespace std;
const int N = 5e5;
pair<long long,long long> p[N+5];
int n;
int main(){
    cin >> n;
    for(int i = 0; i < n; i++)cin >> p[i].first >> p[i].second;
    sort(p,p+n);
    long long tong = 0;
    int a = 0;
    tong = p[0].second;
    long long res = tong;
    for(int i = 1; i < n; i++){
        tong+= p[i].second;
        if(tong <= p[i].first - p[a].first){
            tong = 0;
            a = i+1;
        } else {
            res = max(res, tong - p[i].first + p[a].first);
        }
    }
    cout << res;
}

# 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 -