Cod sursa(job #125915)
Utilizator | Data | 20 ianuarie 2008 21:14:00 | |
---|---|---|---|
Problema | Gardieni | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include <stdio.h>
long long unsigned v[1100000], n, a, b, c, cost, t;
int main()
{
freopen("gardieni.in","r",stdin);
freopen("gardieni.out","w",stdout);
long long unsigned i, j;
scanf("%llu %llu",&n, &t);
for (i = 1; i <= n; i++)
{
scanf("%llu %llu %llu", &a, &b, &c);
for (j = a; j <= b; j++) if (!v[j] || v[j] > c) v[j] = c;
}
for (i = 1; i <= t; i++) cost += v[i];
printf("%llu\n",cost);
return 0;
}