Submission #547431

#TimeUsernameProblemLanguageResultExecution timeMemory
547431srivatsav_kannanArt Exhibition (JOI18_art)C++14
50 / 100
1082 ms8624 KiB
#include <iostream> #include <fstream> #include <vector> #include <set> #include <queue> #include <cmath> #include <map> #include <algorithm> #include <numeric> #include <stack> #include <cstring> #include <bitset> #include <climits> #include <valarray> #include <list> #define int long long #define inf 1000000000 #define endl '\n' #define mod 1000000007 using namespace std; signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; pair<int,int> ar[n]; for (int i = 0; i < n; i++) cin >> ar[i].first >> ar[i].second; int mx = 0; sort(ar, ar+n); for (int i = 1; i < n; i++) ar[i].second += ar[i-1].second; for (int i = 0; i < n; i++){ for (int j = i; j < n; j++){ int cur; if (i == 0) cur = ar[j].second; else cur = ar[j].second-ar[i-1].second; mx = max(mx, cur-(ar[j].first-ar[i].first)); } } cout << mx << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...