# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
926129 | 2024-02-12T15:16:37 Z | haru09 | Art Exhibition (JOI18_art) | C++17 | 0 ms | 344 KB |
#include<bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define task "code" const int ar=5e5+5; const ll mod=1e9+7; int n; pair<ll,int> a[ar]; ll ans=-1e18; int main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); if (fopen(task".inp","r")) { freopen(task".inp","r",stdin); freopen(task".out","w",stdout); } cin>>n; for (int i=1;i<=n;i++) { cin>>a[i].fi>>a[i].se; } sort(a+1,a+n+1); ll ma=0; for (int i=1;i<=n;i++) { if (i==1) { ma+=a[i].fi; ma+=a[i].se; } else { ma+=a[i].se; } ans=max(ans,ma-a[i].fi); } cout<<ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |