답안 #5325

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
5325 2014-03-23T11:11:44 Z baneling100 택배 (KOI13_delivery) C++
100 / 100
20 ms 1212 KB
#include <stdio.h>
#include <algorithm>

using namespace std;

typedef pair <int,int> ppair;
pair <ppair,int> box[10001];
int n, c, m, d[2001], ans;

void input(void)
{
    int i, x, y, z;

    scanf("%d %d %d",&n,&c,&m);
    for(i=1 ; i<=m ; i++)
    {
        scanf("%d %d %d",&x,&y,&z);
        box[i]=make_pair(make_pair(y-1,-x),-z);
    }
    sort(box+1,box+m+1);
}

void process(void)
{
    int i, j, mmin;

    for(i=1 ; i<=m ; i++)
    {
        box[i].first.second*=-1;
        box[i].second*=-1;
        mmin=box[i].second;
        for(j=box[i].first.second ; j<=box[i].first.first ; j++)
            if(mmin>c-d[j])
                mmin=c-d[j];
        for(j=box[i].first.second ; j<=box[i].first.first ; j++)
            d[j]+=mmin;
        ans+=mmin;
    }
}

void output(void)
{
    printf("%d",ans);
}

int main(void)
{
    input();
    process();
    output();

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1212 KB Output is correct
2 Correct 0 ms 1212 KB Output is correct
3 Correct 0 ms 1212 KB Output is correct
4 Correct 0 ms 1212 KB Output is correct
5 Correct 0 ms 1212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1212 KB Output is correct
2 Correct 0 ms 1212 KB Output is correct
3 Correct 0 ms 1212 KB Output is correct
4 Correct 0 ms 1212 KB Output is correct
5 Correct 0 ms 1212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1212 KB Output is correct
2 Correct 0 ms 1212 KB Output is correct
3 Correct 0 ms 1212 KB Output is correct
4 Correct 0 ms 1212 KB Output is correct
5 Correct 0 ms 1212 KB Output is correct
6 Correct 0 ms 1212 KB Output is correct
7 Correct 0 ms 1212 KB Output is correct
8 Correct 0 ms 1212 KB Output is correct
9 Correct 0 ms 1212 KB Output is correct
10 Correct 0 ms 1212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1212 KB Output is correct
2 Correct 0 ms 1212 KB Output is correct
3 Correct 0 ms 1212 KB Output is correct
4 Correct 0 ms 1212 KB Output is correct
5 Correct 0 ms 1212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1212 KB Output is correct
2 Correct 0 ms 1212 KB Output is correct
3 Correct 20 ms 1212 KB Output is correct
4 Correct 20 ms 1212 KB Output is correct
5 Correct 20 ms 1212 KB Output is correct