Submission #16851

# Submission time Handle Problem Language Result Execution time Memory
16851 2015-10-22T07:35:20 Z hjk0553 택배 (KOI13_delivery) C
Compilation error
0 ms 0 KB
#include<stdio.h>
#include<algorithm>
using namespace std;
int n;
int i,j,k;
int villagecount;
int volume;
int maxcarryweight=0;
int track[2001];
struct delivery
{
    int sendvillage;
    int receivevillage;
    int weight;
} data[10001];
bool compare(const delivery &a,const delivery &b)
{
    return a.receivevillage<b.receivevillage;
}
int main()
{
    //freopen("input.txt","r",stdin);
    scanf("%d %d",&villagecount,&volume);
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d %d %d",&data[i].sendvillage,&data[i].receivevillage,&data[i].weight);
    }
    sort(data+1,data+1+n,compare);
    for(i=1;i<=n;i++)
    {
        int Max=-1e9;
        int sw=0;
        for(j=data[i].sendvillage;j<data[i].receivevillage;j++) Max=max(Max,track[j]);
        for(j=data[i].sendvillage;j<data[i].receivevillage;j++)
        {
            if(Max+data[i].weight>volume)
            {
                if(Max==0){track[j]=volume;sw=1;}
                else {track[j]+=volume-Max;sw=2;}
            }
            else track[j]+=data[i].weight;
        }
        if(sw==1) maxcarryweight+=volume;
        else if(sw==2) maxcarryweight+=volume-Max;
        else maxcarryweight+=data[i].weight;
    }
    //for(i=1;i<=villagecount;i++)
    //{
    //    printf("%d ",track[i]);
    //}
    printf("%d",maxcarryweight);
    return 0;
}

Compilation message

delivery.c:2:20: fatal error: algorithm: 그런 파일이나 디렉터리가 없습니다
 #include<algorithm>
                    ^
compilation terminated.