Submission #234288

# Submission time Handle Problem Language Result Execution time Memory
234288 2020-05-23T19:09:50 Z Toirov_Sadi Art Exhibition (JOI18_art) C++17
0 / 100
5 ms 384 KB
#include<bits/stdc++.h>

using namespace std;

int n;
vector<long long> p;
vector<pair<long long, int>> a;
int main()
{
    cin >> n;
    for(int i = 1; i <= n; i ++){
        int y;
        long long x;
        cin >> x >> y;
        a.push_back({x, y});
    }
    sort(a.begin(), a.end());

    p.resize(n, 0ll);
    for(int i = 0; i < n; i ++){
        if(i > 0) p[i] = p[i - 1];
        p[i] += a[i].second;
    }

    long long mx = 0ll;
    for(int i = 0; i < n; i ++){
        mx = max(mx, p[i] - (a[i].first - a[0].first));
    }
    cout << mx << "\n";
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -