Cod sursa(job #133152)
| Utilizator | Data | 7 februarie 2008 18:48:11 | |
|---|---|---|---|
| Problema | Gardieni | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.57 kb |
#include <stdio.h>
//using namespace std;
long a[1000002],n,t;
void citire()
{
freopen("gardieni.in","r",stdin);
freopen("gardieni.out","w",stdout);
scanf("%ld%ld", &n, &t);
int i;
for (i=1; i<=t; i++)
a[i]=2000000000;
long z,x,c;
for (i=1; i<=n; i++)
{
scanf("%ld%ld%ld", &z, &x, &c);
for (int j=z; j<=x; j++)
if (a[j]>c)
a[j]=c;
}
long long s=0;
for (i=1; i<=t; i++)
s+=a[i];
printf("%lld",s);
fclose(stdin);
fclose(stdout);
}
int main()
{
citire();
return 0;
}
