Submission #948737

#TimeUsernameProblemLanguageResultExecution timeMemory
948737phoenix0423Art Exhibition (JOI18_art)C++17
100 / 100
153 ms20824 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; #define fastio ios::sync_with_stdio(false), cin.tie(0) #define pb push_back #define eb emplace_back #define f first #define s second #define int long long #define lowbit(x) x&-x const int maxn = 2e5 + 5; signed main(void){ fastio; int n; cin>>n; vector<pll> a(n); for(int i = 0; i < n; i++) cin>>a[i].f>>a[i].s; sort(a.begin(), a.end()); int mn = 0, ttl = 0, ans = 0; for(int i = 0; i < n; i++){ mn = min(mn, ttl - a[i].f); ttl += a[i].s; ans = max(ans, ttl - a[i].f - mn); } cout<<ans<<"\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...