Submission #1278113

#TimeUsernameProblemLanguageResultExecution timeMemory
1278113toplion7Art Exhibition (JOI18_art)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int inf = 1e18 + 7; const int MOD = 1000000007; const int MOD1 = 998244353; const int MOD2 = 1e9 + 9; const int MAXXX = 1e3 + 5; const int MAXXXx = 1e3 + 5; const int OFFSET = 200; void Make_set(vector<int>& v) { set<int> s(v.begin(), v.end()); v.assign(s.begin(), s.end()); } int Pow(int n, int k, int mod) { int res = 1; while (k > 0) { if (k % 2 == 1) { res = (res * n) % mod; } n = (n * n) % mod; k /= 2; } return res; } vector<pair<int, vector<int>>> dp(MAXXX); int x[MAXXX]; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); int T ; // cin >> T; T = 1; for (int K = 0; K < T; K++) { int n; cin >> n; vector<pair<int, int>> v(n+1); for(int i = 0; i < n; i++) cin >> v[i].first >> v[i].second; int pr[n], ans = 0, mn = 0; sort(v.begin(), v.end()); pr[0] = 0; for(int i = 1; i <= n; i++) { pr[i] = pr[i - 1] + v[i].second; } for(int r = 1; r <= n; r++) { ans = max(ans , pr[r] - v[r].first - mn); mn = min(mn, pr[r - 1] - v[r].first); ans = max(ans, a[r].second); } cout << ans; } return 0; } /* 3 2 3 11 2 4 5 6 4 1 1 5 10 3 9 1 4 2 5 3 */

Compilation message (stderr)

art.cpp: In function 'int main()':
art.cpp:56:28: error: 'a' was not declared in this scope
   56 |             ans = max(ans, a[r].second);
      |                            ^