#include <bits/stdc++.h>
using namespace std;
int main(void) {
int n;
cin >> n;
vector <pair <int,pair <int,int>>> a;
for(int i = 0; i < n; i ++) {
int d, x, y;
cin >> d >> x >> y;
a.push_back({d, {y, x}});
}
sort(a.begin(), a.end());
int mx = 0;
for(int i = 0; i < n; i ++) {
int cursum = 0;
cursum += a[i].second.first;
int curgold = 0;
curgold += a[i].second.second;
for(int j = i + 1; j < n; j ++) {
curgold += a[j].second.second;
cursum += a[j].second.first;
if(a[j].first - a[i].first <= cursum) {
mx = max(mx, curgold);
}
// cout << cursum << " " << curgold << "\n";
}
}
cout << mx;
return false;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
288 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
288 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
288 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |