제출 #1127223

#제출 시각아이디문제언어결과실행 시간메모리
1127223tsengangArt Exhibition (JOI18_art)C++20
100 / 100
155 ms8260 KiB
#include <bits/stdc++.h> #define ll long long #define ff first #define ss second #define pb push_back #define all(x) x.begin(),x.end() #define vodka void #define ertunt return using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n; cin >> n; pair<ll,ll> a[n]; for(ll i = 0; i < n; i++)cin >> a[i].ff >> a[i].ss; sort(a,a+n); ll cur = 0,ans = 0; for(ll i = 0; i < n; i++){ cur+=a[i].ss; cur = max(cur,a[i].ff+a[i].ss); ans = max(ans,cur-a[i].ff); } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...