# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
96241 | 2019-02-07T12:38:43 Z | pamaj | Art Exhibition (JOI18_art) | C++14 | 2 ms | 376 KB |
#include <bits/stdc++.h> using namespace std; typedef uint64_t ll; const int maxn = 5e5 + 10;; ll n, pref[maxn]; vector<pair<ll, ll>> v; int main() { ios::sync_with_stdio(false), cin.tie(nullptr); cin >> n; for(int i = 0; i < n; i++) { ll a, b; cin >> a >> b; v.push_back({a, b}); } sort(v.begin(), v.end()); // for(int i = 0; i < n; i++) // { // if(!i) pref[i] = v[i].second; // else // { // pref[i] = pref[i - 1] + v[i].second; // } // } ll ans = 0; for(int i = 0; i < n - 1; i++) { ll sum = v[i].second; for(int j = i + 1; j < n; j++) { sum += v[j].second; ans = max(ans, sum - (v[j].first- v[i].first)); } } cout << ans << "\n"; }
Compilation message
# | 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 | - |