Submission #63311

# Submission time Handle Problem Language Result Execution time Memory
63311 2018-08-01T10:39:38 Z chunghan Art Exhibition (JOI18_art) C++14
0 / 100
3 ms 376 KB
#include<iostream>
#include<memory.h>
#include<utility>
#include<algorithm>
#include<vector>

using namespace std;

long long int n, s[500001] = {0, }, a, b, tmp;
vector<pair<long long int, long long int>> art;

int main() {
    ios::sync_with_stdio(0); 
    cin.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> a >> b;
        art.push_back(pair<int, int>(a, b));
    }
    sort(art.begin(), art.end());
    for(int i = 0; i < n; i++) {
        s[i] = s[i-1] + get<1>(art[i]);
    }
    long long int tmp = 0;
    for(int i = 0; i < n; i++) {
        for(int j = 1; j <= n; j++) {
            if(i < j)
                tmp = max(tmp, s[j]-s[i-1]+get<0>(art[i])-get<0>(art[j]));
        }
    }
    cout << tmp;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -