Submission #1179725

#TimeUsernameProblemLanguageResultExecution timeMemory
1179725patgraArt Exhibition (JOI18_art)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define rep(a,b,c) for(auto a = (b); a != (c); a++) #define repD(a,b,c) for(auto a = (b); a != (c); a--) #define repIn(a, b) for(auto& a : (b)) #define repIn2(a, b, c) for(auto& [a, b] : (c)) constexpr bool dbg = 0; #define DEBUG if constexpr(dbg) #define DC DEBUG std::cerr #define eol std::endl #define ll long long #define pb push_back using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; map<ll, ll> mappy, prefSum; rep(i, 0, n) { ll x, y; cin >> x >> y; mappy[x] += y; } ll prv = 0; repIn2(k, v, mappy) prv += v, prefSum[k] = prv; prv = -5e18; auto it2 = prefSum.rbegin(); ll ans = -5e18; rep(it, mappy.rbegin(), mappy.rend()) { it2++; auto k = it -> first; prv = max(prv, prefSum[k] - k); ans = max(ans, -it2 -> second + k + maxSuf[k]); DC << "maxSuf[" << k << "] = " << prv << eol; DC << ' ' << k << ' ' << -it2 -> second + k + maxSuf[k] << eol; } cout << ans << '\n'; }

Compilation message (stderr)

art.cpp: In function 'int main()':
art.cpp:37:45: error: 'maxSuf' was not declared in this scope
   37 |         ans = max(ans, -it2 -> second + k + maxSuf[k]);
      |                                             ^~~~~~