# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
38481 | 14kg | Divide and conquer (IZhO14_divide) | C++11 | 66 ms | 5408 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <algorithm>
#define N 100001
#define INF 999999999999999999
#define LL long long
#define max2(x,y) (x>y?x:y)
using namespace std;
struct DNC {
int w, g, e;
} in[N];
int n, list_len;
LL out;
pair<LL, LL> d[N];
pair<LL, int> list[N];
int search(long long num) {
pair<LL, int> temp = { num,0 };
pair<LL, int> *w = upper_bound(list + 1, list + list_len + 1, temp);
return w->second;
}
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d %d %d", &in[i].w, &in[i].g, &in[i].e);
for (int i = 1; i <= n; i++)
d[i] = { d[i - 1].first - (LL)(in[i].w - in[i - 1].w) + (LL)in[i].e,
d[i - 1].second + (LL)in[i].g };
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |