제출 #851007

#제출 시각아이디문제언어결과실행 시간메모리
851007NamPEArt Exhibition (JOI18_art)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(0); cout.tie(0); cin.tie(0); ll n; cin >> n; vector<pair<ll, ll>> v(n); for(auto& i : v) { cin >> i.first >> i.second; } sort(v.begin(), v.end()); ll ans = 0; for(ll i = 0; i < n; i++) { ll sum = v[i].second; for(ll j = i + 1; j < n; j++) { sum += v[j].second; ans = max(ans, sum - (v[j].first - v[i].first)); } } 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...