제출 #390062

#제출 시각아이디문제언어결과실행 시간메모리
390062ioiArt Exhibition (JOI18_art)C++14
0 / 100
1 ms204 KiB
#include<bits/stdc++.h> using namespace std; int main() { int n ; cin >> n ; vector<pair<int , int > > v(n); for(auto &it : v)cin >> it.first >> it.second ; sort(v.begin() , v.end()); int ans = 0 ; int sum = 0 ; int past = 0 ; for(int i = n - 1 ; i >= 0 ; i --){ if(i != n - 1)sum += v[i].second - (past - v[i].first); sum = max(sum , v[i].second); past = v[i].first ; ans = max(ans , sum); } 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...