Submission #699583

#TimeUsernameProblemLanguageResultExecution timeMemory
699583MohammadAbduljalilArt Exhibition (JOI18_art)C++17
50 / 100
1085 ms8148 KiB
#include <bits/stdc++.h> #define fast_input_output() ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr) typedef long long ll; using namespace std; int main() { fast_input_output(); ll n, ans = LLONG_MIN; cin >> n; vector<pair<ll, ll>> v(n); for (int i = 0; i < n; i++) cin >> v[i].first >> v[i].second; sort(v.begin(), v.end()); for (int i = 0; i < n; i++) { ll s = v[i].second; ans = max(ans, s); for (int j = i + 1; j < n; j++) { s += v[j].second; ans = max(ans, s - (v[j].first - v[i].first)); } } cout << ans; 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...