Submission #77569

# Submission time Handle Problem Language Result Execution time Memory
77569 2018-09-28T17:13:23 Z MvC Boxes with souvenirs (IOI15_boxes) C++14
Compilation error
0 ms 0 KB
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<61);
const int inf=(1<<30);
const int nmax=1e7+50;
const int mod=1e9+7;
using namespace std;
ll i,k1,nr,a[nmax],ans;
vector<ll>f,s;
ll delivery(int n,ll k,ll l,ll pos[])
{
	for(i=1;i<=n;i++)a[i]=pos[i-1];
	l--;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        if((l&1) && a[i]==(l/2)+1)nr++;
        else if(a[i]<=(l+1)/2)f.pb(a[i]);
        else s.pb(a[i]);
    }
    reverse(s.begin(),s.end());
    ans+=(l+1)*(nr/k);
    nr-=(nr/k)*k;
    if(nr)
    {
        k1=k-nr;
        ans+=l+1;
        while(k1--)
        {
            if(f.back()>=l-s.back()+1)f.pop_back();
            else s.pop_back();
        }
    }
    while(!f.empty())
    {
        ans+=f.back()*2;
        k1=k;
        while(k1-- && !f.empty())f.pop_back();
    }
    while(!s.empty())
    {
        ans+=(l-s.back()+1)*2;
        k1=k;
        while(k1-- && !s.empty())s.pop_back();
    }
    return ans;
}

Compilation message

/tmp/ccd7F9FG.o: In function `main':
grader.c:(.text.startup+0x22f): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status