#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vl vector<ll>
#define pll pair<ll, ll>
#define pb push_back
#define fi first
#define se second
#define ff(aaa, bbb, ccc) for(ll aaa = bbb; aaa < ccc; aaa++)
#define all(aa) aa.begin(), aa.end()
int main(){
ll n;
cin >> n;
vector<pair<pll, ll>> val(n);
ff(i, 0, n){
ll x, y, w;
cin >> x >> y >> w;
val[i] = {{x, y}, w};
}
sort(all(val));
vl psum(n);
ff(i, 0, n){
psum[i] = val[i].se;
/*if(i != 0){
psum[i] += psum[i-1];
}*/
}
ll maxx = 0;
ff(i, 0, n){
ll c = 0;
ff(j, i, n){
c += psum[i];
maxx = max(maxx, c);
}
}
cout << maxx;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |