This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//sub1 b瀛 1
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxn = 2e3 + 3;
array<int, 4> a[maxn];
int val[maxn];
void solve(){
int n; cin >> n;
for(int i = 1; i <= n; i++){
cin >> a[i][0] >> a[i][1] >> a[i][2];
a[i][3] = i;
}
sort(a + 1, a + n + 1);
for(int i = 1; i <= n; i++) val[a[i][3]] = a[i][2];
int cur = 0, mn = 0, ans = 0;
for(int i = 1; i <= n; i++){
cur += val[i];
ans = max(ans, cur - mn);
mn = min(cur, mn);
}
cout << ans;
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
solve();
}
# | 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... |