제출 #747472

#제출 시각아이디문제언어결과실행 시간메모리
747472Can_I_Put_ma_ballzArt Exhibition (JOI18_art)C++14
100 / 100
561 ms8892 KiB
#include <iomanip> #include <iostream> #include <vector> #include <algorithm> #include <string> #include <cmath> #include <map> #include <climits> #include <limits> #define endl '\n' typedef unsigned long long int u64; typedef long long int i64; typedef unsigned int u32; typedef int i32; typedef unsigned short u16; typedef short i16; using namespace std; int main() { i32 n; cin>> n; vector<pair<long long, int>> arr(n); for (auto& i: arr) { cin>>i.first>>i.second; } sort(arr.begin(), arr.end()); i64 ans = 0, accumulate = 0, low = 0; for (int i = 0; i < n; ++i) { low = min(low, accumulate - arr[i].first); accumulate += arr[i].second; ans = max(ans, accumulate - arr[i].first - low); } cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...