# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
684593 | rainboy | Arranging Tickets (JOI17_arranging_tickets) | C11 | 115 ms | 460 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 <string.h>
#define N 200000
#define M 100000
#define INF 0x3f3f3f3f3f3f3f3fLL
long long min(long long a, long long b) { return a < b ? a : b; }
long long max(long long a, long long b) { return a > b ? a : b; }
int main() {
static int ll[M], rr[M], cc[M];
static long long ww[N], dd[N], dd_[N];
int n, m, h, i, j, r, tmp;
long long w, x, y, z, ans;
scanf("%d%d", &n, &m), n--;
x = 0;
for (h = 0; h < m; h++) {
scanf("%d%d%d", &ll[h], &rr[h], &cc[h]), ll[h]--, rr[h]--;
if (ll[h] > rr[h])
tmp = ll[h], ll[h] = rr[h], rr[h] = tmp;
dd[ll[h]] += cc[h], dd[rr[h]] -= cc[h];
x += cc[h];
}
for (i = 1; i < n; i++)
dd[i] += dd[i - 1];
w = -INF;
for (i = 0; i < n; i++)
w = max(w, -dd[i]);
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |