Submission #1122233

#TimeUsernameProblemLanguageResultExecution timeMemory
1122233IcelastBulldozer (JOI17_bulldozer)C++17
5 / 100
1 ms504 KiB
#include <iostream> #include <bits/stdc++.h> #define ll long long using namespace std; const ll maxn = 2*1e5+5, INF = 4e18+9; struct point{ ll x, y, w; }; void sub1(int n, vector<point> a){ sort(a.begin(), a.end(), [&](point a, point b){return a.x < b.x;}); vector<ll> f(n+1, 0); ll ans = 0; for(int i = 1; i <= n; i++){ f[i] = max(f[i-1]+a[i].w, a[i].w); ans = max(ans, f[i]); } cout << ans; } void solve(){ int n; cin >> n; vector<point> a(n+1); bool issub1 = true; for(int i = 1; i <= n; i++){ cin >> a[i].x >> a[i].y >> a[i].w; if(a[i].y != 0) issub1 = false; } if(issub1){ sub1(n, a); return; } sub1(n, a); } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); //freopen("TRUFFLE.inp", "r", stdin); //freopen("TRUFFLE.out", "w", stdout); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...