Submission #1124015

#TimeUsernameProblemLanguageResultExecution timeMemory
1124015AverageAmogusEnjoyerArt Exhibition (JOI18_art)C++20
100 / 100
141 ms12120 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> using namespace std; using ll = long long; template<class T> bool cmin(T &i, T j) { return i > j ? i=j,true:false; } template<class T> bool cmax(T &i, T j) { return i < j ? i=j,true:false; } mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int> ui(0, 1 << 30); int rng() { return ui(mrand); } void solve() { } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<pair<ll,ll>> v(n); for (auto &[x,y]: v) cin >> x >> y; sort(v.begin(),v.end()); vector<ll> dp(n); dp[0]=v[0].second; for (int i=1;i<n;i++) { dp[i]=max(v[i].second,dp[i-1]+v[i-1].first-v[i].first+v[i].second); } cout << *max_element(dp.begin(),dp.end()) << 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...