제출 #840495

#제출 시각아이디문제언어결과실행 시간메모리
840495overwatch9Art Exhibition (JOI18_art)C++17
50 / 100
1078 ms20676 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; using ll = long long; vector <pair <ll, ll>> pnts; int main() { int n; cin >> n; pnts.resize(n); for (int i = 0; i < n; i++) cin >> pnts[i].first >> pnts[i].second; sort(pnts.begin(), pnts.end()); ll ans = 0; for (int i = 0; i < n; i++) { ll tot_val = 0; for (int j = i; j < n; j++) { tot_val += pnts[j].second; ans = max(ans, tot_val - (pnts[j].first - pnts[i].first)); } } 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...