Submission #461184

#TimeUsernameProblemLanguageResultExecution timeMemory
461184hhhhauraArt Exhibition (JOI18_art)C++14
100 / 100
231 ms9420 KiB
#define wiwihorz #pragma GCC optimize("Ofast") #pragma loop-opt(on) #include <bits/stdc++.h> #define rep(i, a, b) for(int i = a; i <= b; i ++) #define rrep(i, a, b) for(int i = b; i >= a; i--) #define all(x) x.begin(), x.end() #define INF 9000000000000000000 #define MOD 1000000007 #define eps (1e-9) using namespace std; #define int long long int #define pii pair<int, int> namespace solver { int n; vector<pii> a; void init_(int _n) { n = _n; a.assign(n + 1, {0, 0}); } int solve() { int cur = 0, mn = INF, ans = 0; sort(a.begin() + 1, a.end()); rep(i, 1, n) { mn = min(mn, cur - a[i].first); cur += a[i].second; ans = max(ans, cur - a[i].first - mn); } return ans; } }; using namespace solver; signed main() { ios::sync_with_stdio(false), cin.tie(0); int n; cin >> n; init_(n); rep(i, 1, n) cin >> a[i].first >> a[i].second; cout << solve() << "\n"; return 0; }

Compilation message (stderr)

art.cpp:3: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
    3 | #pragma loop-opt(on)
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...