Submission #284642

#TimeUsernameProblemLanguageResultExecution timeMemory
284642triplem5dsArt Exhibition (JOI18_art)C++14
50 / 100
1085 ms20856 KiB
#pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #include "bits/stdc++.h" using namespace std; #define pb push_back #define F first #define S second #define f(i,a,b) for(int i = a; i < b; i++) #define endl '\n' using ll = long long; using db = long double; using ii = pair<int, int>; const int N = 2e5 + 5, LG = 19, MOD = 1e9 + 7; const int SQ =225; const long double EPS = 1e-7; int32_t main(){ #ifdef ONLINE_JUDGE ios_base::sync_with_stdio(0); cin.tie(0); #endif int n; cin >> n; vector<pair<ll, ll>> v(n); for(auto & x : v) cin >> x.F >> x.S; sort(v.begin(),v.end()); ll mx = v[0].S, cur = v[0].S; f(i,1,n){ cur += v[i].S; cur -= v[i].F - v[i-1].F; cur = max(cur, v[i].S); mx = max(mx, cur); } cout << mx << 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...