Submission #941524

# Submission time Handle Problem Language Result Execution time Memory
941524 2024-03-09T05:03:06 Z ifateen Bulldozer (JOI17_bulldozer) C++14
0 / 100
1 ms 600 KB
#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));
    posx.erase(unique(begin(posx), end(posx)), end(posx));

    for (auto& i : info) {
        prefx[compress(i[0], true)] += i[2];
    }
    int sm = 0, mn = 0, ans = 0;
    for (int i = 0; i < posx.size(); i++) {
        sm += prefx[i];
        mn = min(mn, sm);
        ans = max(ans, sm - mn);
    }
    cout << ans;
}

Compilation message

bulldozer.cpp: In function 'int main()':
bulldozer.cpp:32:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for (int i = 0; i < posx.size(); i++) {
      |                     ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -