Submission #63334

# Submission time Handle Problem Language Result Execution time Memory
63334 2018-08-01T13:08:23 Z leejseo Art Exhibition (JOI18_art) C++17
0 / 100
2 ms 376 KB
#include<iostream>
#include<memory.h>
#include<utility>
#include<algorithm>
#include<vector>
 
using namespace std;
 
typedef long long lld;
 
lld n, s[500001] = {0LL, }, a, b, tmp;
vector<pair<lld, lld>> art;
 
int main() {
    ios::sync_with_stdio(0); 
    cin.tie(0);
    cin >> n;
    art.push_back(pair<int, int>(0, 0));
    for(int i = 0; i < n; i++) {
        cin >> a >> b;
        art.push_back(pair<int, int>(a, b));
    }
    sort(art.begin(), art.end());
    for(int i = 1; i <= n; i++) {
        s[i] = s[i-1] + art[i].second;
    }
    lld tmp = 0;
    for(int i = 1; i <= n; i++) {
        for(int j = i; j <= n; j++) {
            tmp = max(tmp, s[j] - s[i-1] - (art[j].first - art[i].first));
        }
    }
    cout << tmp << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -