Submission #541360

# Submission time Handle Problem Language Result Execution time Memory
541360 2022-03-23T08:44:12 Z LittleOrange Bulldozer (JOI17_bulldozer) C++17
0 / 100
1 ms 324 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ios::sync_with_stdio(0);cin.tie();
    int n;
    cin >> n;
    vector<pair<ll,ll>> a(n);
    vector<pair<ll,ll>> b(n);
    for (int i = 0;i<n;i++){
        ll x,y,w;
        cin >> x >> y >> w;
        a[i] = {x,w};
        b[i] = {y,w};
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    vector<ll> sum(n+1);
    sum[0] = 0;
    for (int i = 0;i<n;i++){
        sum[i+1] = sum[i]+a[i].second;
    }
    ll m = 0;
    ll ans = 0;
    for (int i = 1;i<=n;i++){
        ans = max(ans,sum[i]-m);
        m = min(m,sum[i]);
    }
    sum[0] = 0;
    for (int i = 0;i<n;i++){
        sum[i+1] = sum[i]+b[i].second;
    }
    m = 0;
    for (int i = 1;i<=n;i++){
        ans = max(ans,sum[i]-m);
        m = min(m,sum[i]);
    }
    cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 324 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 324 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 324 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -