# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
4448 |
2013-10-06T19:45:06 Z |
model_code |
택배 (KOI13_delivery) |
C++ |
|
16 ms |
1224 KB |
#include <stdio.h>
#include <algorithm>
using namespace std;
const int N=2222,M=11111; //
int n,c,m;
struct Box{int a,b,t;};
Box a[M];
int truck[N],x,v;
int ans;
int cmp(const Box &p,const Box &q){return p.b<q.b||(p.b==q.b&&p.a>q.a);}
int min(int p,int q){return p<q?p:q;}
int main()
{
int i,j;
scanf("%d%d%d",&n,&c,&m);
for(i=0;i<m;++i)
scanf("%d%d%d",&a[i].a,&a[i].b,&a[i].t);
sort(a,a+m,cmp);
ans=0;
for(i=0;i<m;++i)
{
x=0;
for(j=a[i].a;j<a[i].b;++j)
if(truck[j]>x) x=truck[j];
v=min(a[i].t,c-x);
for(j=a[i].a;j<a[i].b;++j)
truck[j]+=v;
ans+=v;
}
printf("%d\n",ans);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1224 KB |
Output is correct |
2 |
Correct |
0 ms |
1224 KB |
Output is correct |
3 |
Correct |
0 ms |
1224 KB |
Output is correct |
4 |
Correct |
0 ms |
1224 KB |
Output is correct |
5 |
Correct |
0 ms |
1224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1224 KB |
Output is correct |
2 |
Correct |
0 ms |
1224 KB |
Output is correct |
3 |
Correct |
0 ms |
1224 KB |
Output is correct |
4 |
Correct |
0 ms |
1224 KB |
Output is correct |
5 |
Correct |
0 ms |
1224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1224 KB |
Output is correct |
2 |
Correct |
0 ms |
1224 KB |
Output is correct |
3 |
Correct |
0 ms |
1224 KB |
Output is correct |
4 |
Correct |
0 ms |
1224 KB |
Output is correct |
5 |
Correct |
0 ms |
1224 KB |
Output is correct |
6 |
Correct |
0 ms |
1224 KB |
Output is correct |
7 |
Correct |
0 ms |
1224 KB |
Output is correct |
8 |
Correct |
0 ms |
1224 KB |
Output is correct |
9 |
Correct |
0 ms |
1224 KB |
Output is correct |
10 |
Correct |
0 ms |
1224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1224 KB |
Output is correct |
2 |
Correct |
0 ms |
1224 KB |
Output is correct |
3 |
Correct |
0 ms |
1224 KB |
Output is correct |
4 |
Correct |
0 ms |
1224 KB |
Output is correct |
5 |
Correct |
0 ms |
1224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1224 KB |
Output is correct |
2 |
Correct |
0 ms |
1224 KB |
Output is correct |
3 |
Correct |
16 ms |
1224 KB |
Output is correct |
4 |
Correct |
16 ms |
1224 KB |
Output is correct |
5 |
Correct |
16 ms |
1224 KB |
Output is correct |