#include <bits/stdc++.h>
using namespace std;
#define form(mt) for(auto vec:mt){for (auto el:vec){cout << el << " ";} cout << "\n";}
#define forv(vec) for (auto el:vec){cout <<el.second << " ";}
struct camp{
int x, g, e;
};
signed main() {
long long n, maxx = 0;
cin >> n;
vector<camp> vec(n);
for (int i = 0; i< n; i++) cin >> vec[i].x >> vec[i].g >> vec[i].e;
for (int i = 0; i<n; i++){
long long esum=0,gsum=0,xsum=0;
int k = i;
// for (int k = i; k<n; k++){
// esum +=vec[k].e;
// xsum +=vec[k].x;
// if (esum < xsum){
// break;
// }else{
// gsum += vec[k].g;
// }
// }
do{
esum+=vec[k].e;
xsum +=vec[k].x;
gsum += vec[k].g;
k++;
}while(esum >= xsum && k<n-1);
maxx = max(gsum, maxx);
}
cout << maxx;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |