Submission #16239

# Submission time Handle Problem Language Result Execution time Memory
16239 2015-08-18T11:13:31 Z eaststar 택배 (KOI13_delivery) C++14
100 / 100
30 ms 1208 KB
#include <stdio.h>
#include <algorithm>
using namespace std;
struct data{
    int s,e,cnt;
    bool operator<(const data&r)const{
        if(e==r.e)return s>r.s;
        return e<r.e;
    }
}a[10010];
int s[2010],ans,mx;
int main(){
    int i,j,n,c,m;
    scanf("%d%d%d",&n,&c,&m);
    for(i=0;i<m;++i)scanf("%d%d%d",&a[i].s,&a[i].e,&a[i].cnt);
    sort(a,a+m);
    for(i=0;i<m;++i){
        mx=0;
        for(j=a[i].s;j<a[i].e;++j)mx=max(mx,s[j]);
        mx=min(a[i].cnt,c-mx);
        for(j=a[i].s;j<a[i].e;++j)s[j]+=mx;
        ans+=mx;
    }
    printf("%d",ans);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1208 KB Output is correct
2 Correct 0 ms 1208 KB Output is correct
3 Correct 0 ms 1208 KB Output is correct
4 Correct 0 ms 1208 KB Output is correct
5 Correct 0 ms 1208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1208 KB Output is correct
2 Correct 0 ms 1208 KB Output is correct
3 Correct 0 ms 1208 KB Output is correct
4 Correct 0 ms 1208 KB Output is correct
5 Correct 0 ms 1208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1208 KB Output is correct
2 Correct 0 ms 1208 KB Output is correct
3 Correct 0 ms 1208 KB Output is correct
4 Correct 0 ms 1208 KB Output is correct
5 Correct 0 ms 1208 KB Output is correct
6 Correct 0 ms 1208 KB Output is correct
7 Correct 0 ms 1208 KB Output is correct
8 Correct 0 ms 1208 KB Output is correct
9 Correct 0 ms 1208 KB Output is correct
10 Correct 0 ms 1208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1208 KB Output is correct
2 Correct 0 ms 1208 KB Output is correct
3 Correct 0 ms 1208 KB Output is correct
4 Correct 0 ms 1208 KB Output is correct
5 Correct 0 ms 1208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1208 KB Output is correct
2 Correct 0 ms 1208 KB Output is correct
3 Correct 21 ms 1208 KB Output is correct
4 Correct 21 ms 1208 KB Output is correct
5 Correct 30 ms 1208 KB Output is correct