# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1106754 | 2024-10-31T02:46:56 Z | vjudge1 | Art Exhibition (JOI18_art) | C++17 | 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 = 5e3+10; int n,s[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); for(int i = 1 ; i<=n;i++) s[i] = s[i-1] + a[i].se; int kq = a[1].se; for(int i =2;i<=n;i++) { for(int j = i-1;j>=1;j--) kq = max(kq,s[i] - s[j-1] - (a[i].fi - a[j].fi)); } 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 | - |