제출 #37761

#제출 시각아이디문제언어결과실행 시간메모리
37761mirbek01금 캐기 (IZhO14_divide)C++14
17 / 100
1000 ms13732 KiB
# include <bits/stdc++.h>

# define pb push_back
# define fr first
# define sc second
# define mk make_pair

using namespace std;

const int inf = 1e9 + 7;
const int N = 1e6 + 5;

typedef long long ll;

int n, a[N], b[N], c[N];
ll ans;

int main()
{
      cin >> n;

      for(int i = 1; i <= n; i ++)
            cin >> a[i] >> b[i] >> c[i];



      for(int i = 1; i <= n; i ++)
      {
            for(int j = i; j <= n; j ++)
            {
                  ll res = 0, sum = 0;

                  for(int k = i; k <= j; k ++)
                        sum += c[k], res += b[k];

                  if(sum < (a[j] - a[i])) continue;
                  ans = max(ans, res);
            }
      }

      cout << ans << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...