Submission #241104

#TimeUsernameProblemLanguageResultExecution timeMemory
241104NONAMEGo (COCI18_go)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; const int N = 111; int n, k, m, a[N], b[N], t[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k >> m; for (int i = 0; i < m; ++i) { cin >> a[i] >> b[i] >> t[i]; v.pb(make_pair(a[i], make_pair(b[i], t[i]))); } sort(v.begin(), v.end()); for (int i = 0; i < m; ++i) a[i] = v[i].first, b[i] = v[i].second.first, t[i] = v[i].second.second; int cur = 0, ans = 0; for (int i = 0; i < m && a[i] <= k; ++i) { int tot = 2 * (k - a[i]); cur = 0; int j = i; while (j < m && a[j] <= k) { if (k - a[j] < t[j]) cur += b[j]; ++j; } ans = max(ans, cur); while (j < m) { if (tot + a[j] - k < t[j]) cur += b[j]; ++j; } ans = max(ans, cur); } for (int i = m - 1; i >= 0 && a[i] >= k; --i) { int tot = 2 * (a[i] - k); cur = 0; int j = i; while (j >= 0 && a[j] >= k) { if (a[j] - k < t[j]) cur += b[j]; --j; } ans = max(ans, cur); while (j >= 0) { if (tot + k - a[j] < t[j]) cur += b[j]; --j; } ans = max(ans, cur); } cout << ans << "\n"; }

Compilation message (stderr)

go.cpp: In function 'int main()':
go.cpp:16:9: error: 'v' was not declared in this scope
         v.pb(make_pair(a[i], make_pair(b[i], t[i])));
         ^
go.cpp:19:10: error: 'v' was not declared in this scope
     sort(v.begin(), v.end());
          ^