Submission #37761

# Submission time Handle Problem Language Result Execution time Memory
37761 2017-12-28T04:56:21 Z mirbek01 Divide and conquer (IZhO14_divide) C++14
17 / 100
1000 ms 13732 KB
# 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 time Memory Grader output
1 Correct 0 ms 13732 KB Output is correct
2 Correct 0 ms 13732 KB Output is correct
3 Correct 0 ms 13732 KB Output is correct
4 Correct 0 ms 13732 KB Output is correct
5 Correct 0 ms 13732 KB Output is correct
6 Correct 0 ms 13732 KB Output is correct
7 Correct 0 ms 13732 KB Output is correct
8 Correct 0 ms 13732 KB Output is correct
9 Correct 0 ms 13732 KB Output is correct
10 Correct 0 ms 13732 KB Output is correct
11 Correct 0 ms 13732 KB Output is correct
12 Correct 0 ms 13732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 13732 KB Output is correct
2 Correct 0 ms 13732 KB Output is correct
3 Correct 19 ms 13732 KB Output is correct
4 Correct 59 ms 13732 KB Output is correct
5 Correct 109 ms 13732 KB Output is correct
6 Correct 263 ms 13732 KB Output is correct
7 Correct 156 ms 13732 KB Output is correct
8 Correct 163 ms 13732 KB Output is correct
9 Correct 603 ms 13732 KB Output is correct
10 Execution timed out 1000 ms 13732 KB Execution timed out
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 13732 KB Execution timed out
2 Halted 0 ms 0 KB -