# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
48459 | 2018-05-13T16:49:50 Z | arman_ferdous | Art Exhibition (JOI18_art) | C++17 | 2 ms | 380 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 5e5+10; pair<ll,ll> arr[N]; int main() { int n; scanf("%d", &n); for(int i = 0; i < n; i++) scanf("%lld %lld", &arr[i].first, &arr[i].second); sort(arr,arr+n); ll ans = 0, sum = 0; for(int i = 0; i < n; i++) { sum += arr[i].second; ans = max(ans, sum - arr[i].first + arr[0].first); } for(int i = 0; i < n; i++) ans = max(ans, arr[i].second); printf("%lld", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Incorrect | 2 ms | 380 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Incorrect | 2 ms | 380 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Incorrect | 2 ms | 380 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Incorrect | 2 ms | 380 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |