# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1106757 | 2024-10-31T02:52:18 Z | vjudge1 | Art Exhibition (JOI18_art) | C++14 | 1 ms | 336 KB |
#include<bits/stdc++.h> #define forinc(i,a,b) for(int i=a;i<=b;i++) #define fordec(i,a,b) for(int i=a;i>=b;i--) #define int long long #define pii pair<int,int> #define fi first #define se second #define pb push_back using namespace std; const int N = 1e6+10; int n,sum[N]; pii a[N]; int32_t main() { #define task "task" if(fopen(task".inp","r")) { freopen(task".inp","r",stdin); freopen(task".out","w",stdout); } ios_base::sync_with_stdio(false); cin.tie(0); cin>>n; forinc(i,1,n) cin>>a[i].fi>>a[i].se; sort(a+1,a+n+1); int kq = a[1].se; int s = a[1].se; int mx = a[1].fi; forinc(i,2,n) { kq = max(kq , s + a[i].se - a[i].fi + mx); mx = max(mx , a[i].fi - s); s += a[i].se; } cout<<kq; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |