제출 #1126987

#제출 시각아이디문제언어결과실행 시간메모리
1126987tsengangArt Exhibition (JOI18_art)C++20
50 / 100
1096 ms12068 KiB
#include <bits/stdc++.h> #define ll long long #define ff first #define ss second #define all(x) x.begin(), x.end() #define pb push_back #define ertunt return #define vodka void using namespace std; int main(){ ll n; cin >> n; pair<ll,ll> a[n+4]; for(ll i = 1; i <= n; i++)cin >> a[i].ff >> a[i].ss; sort(a+1,a+n+1); ll b[n+4] = {0}; for(ll i = 1; i <= n; i++){ b[i] = b[i-1]+a[i].ss; } ll ans = 0; for(ll i = 1; i <= n; i++){ for(ll j = i; j <= n; j++){ ans=max(ans,b[j] - b[i-1] - a[j].ff + 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...