Submission #941521

#TimeUsernameProblemLanguageResultExecution timeMemory
941521ifateenBulldozer (JOI17_bulldozer)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector<int> posx, posy; int compress(int x, bool X) { if (X) return lower_bound(begin(posx), end(posx), x) - begin(posx); return lower_bound(begin(posy), end(posy), x) - begin(posy); } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int q; cin >> q; vector<vector<int>> info; vector<int> prefx(q), prefy(q); while (q--) { int x, y, v; cin >> x >> y >> v; posx.push_back(x); posy.push_back(y); info.push_back({x, y, v}); } sort(begin(posx), end(posx)); sort(begin(posy), end(posy)); posx.erase(unique(begin(posx), end(posx)), end(posx)); posy.erase(unique(begin(posy), end(posy)), end(posy)); for (auto& i : info) { prefx[compress(i[0], true)] += i[2]; prefy[compress(i[1], false)] += i[2]; } int sm = 0, mn = 0, ans = 0; for (int i = 0; i < size(posx); i++) { sm += prefx[i]; mn = min(mn, sm); ans = max(ans, sm - mn); } sm = 0, mn = 0; for (int i = 0; i < size(posy); i++) { sm += prefy[i]; mn = min(mn, sm); ans = max(ans, sm - mn); } cout << ans; }

Compilation message (stderr)

bulldozer.cpp: In function 'int main()':
bulldozer.cpp:35:25: error: 'size' was not declared in this scope; did you mean 'dysize'?
   35 |     for (int i = 0; i < size(posx); i++) {
      |                         ^~~~
      |                         dysize
bulldozer.cpp:41:25: error: 'size' was not declared in this scope; did you mean 'dysize'?
   41 |     for (int i = 0; i < size(posy); i++) {
      |                         ^~~~
      |                         dysize