# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
127261 | 2019-07-09T07:35:51 Z | shuvi_dola | Art Exhibition (JOI18_art) | C++14 | 2 ms | 376 KB |
#include <bits/stdc++.h> #define int long long #define fi first #define se second using namespace std; const int N = 1e5+3; int c[N], best[N], n, k; pair <int,int> pic[N]; signed main() { cin>>n; for(int i=1;i<=n;i++) { scanf("%lld %lld",&pic[i].fi,&pic[i].se); } sort(pic+1,pic+1+n); c[1] = pic[1].se; for(int i=2;i<=n;i++) { c[i] = pic[i].se - (pic[i].fi - pic[i-1].fi); } // for(int i=1;i<=n;i++) // { // cout<<c[i]<<' '; // } int ans = 0; for(int i=1;i<=n;i++) { best[i] = max(best[i-1] + c[i], c[i]); ans = max(ans, best[i]); } cout<<ans; }
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 | - |