이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define el '\n'
using namespace std ;
const int MN = 1e5 + 6;
int x[MN] , g[MN] , d[MN] , n;
namespace sub_trau{
void solve(){
int64_t ans = 0;
for ( int i = 1 ; i <= n ; i++ ){
for ( int j = i ; j <= n ; j++ ){
int64_t energy = 0 , gold = 0;
for ( int k = i ; k <= j ; k++ ){
energy += d[k];
gold += g[k];
}
if (energy >= x[j] - x[i]) ans = max(ans , gold);
}
}
cout << ans;
}
}
int32_t main (){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for ( int i = 1 ; i <= n ; i++ ) cin >> x[i] >> g[i] >> d[i];
if (n <= 5000) sub_trau::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... |