Submission #389109

#TimeUsernameProblemLanguageResultExecution timeMemory
389109PedroBigManBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include "boxes.h"
/*
Author of all code: Pedro BIGMAN Dias
Last edit: 15/02/2021
*/
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <list>
#include <iomanip>
#include <stdlib.h>
#include <time.h>
#include <cstring>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=(ll) a; i<(ll) b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define whole(x) x.begin(),x.end()
#define DEBUG(i) cout<<"Pedro Is The Master "<<i<<endl
#define INF 1000000000000000000LL
#define EPS 0.00000001
#define pi 3.14159
ll mod=1000000007LL;

template<class A=ll> 
void Out(vector<A> a) {REP(i,0,a.size()) {cout<<a[i]<<" ";} cout<<endl;}

template<class A=ll>
void In(vector<A> &a, ll N) {A cur; REP(i,0,N) {cin>>cur; a.pb(cur);}} 

ll delivery(int n, int k, int l, int pos[]) 
{
    ll N = (ll) n; ll K = (ll) k; ll L = (ll) l; vector<ll> p; REP(i,0,N) {p.pb((ll) pos[i]);}
	vector<ll> h1,h2; ll newN=0LL;
	REP(i,0,N) 
	{
		if(p[i]==0) {continue;}
		newN++;
		if(p[i]<=(L-2LL)/2LL) {h1.pb(p[i]);}
		else if(p[i]>=(L+1LL)/2LL) {h2.pb(L-p[i]);}
	}
	N=newN;
	ll N1=h1.size(); ll N2 = h2.size(); sort(whole(h1)); sort(whole(h2));
	vector<ll> dp1,dp2; dp1.pb(0LL); dp2.pb(0LL);
	REP(i,0,N1)
	{
		if(i<K) {dp1.pb(2LL*h1[i]);}
		else {dp1.pb(2LL*h1[i]+dp1[i-K]);}
	}
	REP(i,0,N2)
	{
		if(i<K) {dp2.pb(2LL*h2[i]);}
		else {dp2.pb(2LL*h2[i]+dp2[i-K]);}
	}
	while(dp1.size()<=N) {dp1.pb(INF);} while(dp2.size()<=N) {dp2.pb(INF);}
	ll ans = INF;
	REP(i,0,N+1)
	{
		REP(j,0,N+1)
		{
			ans=min(ans,dp1[i]+dp2[j]+L*((N-i-j+K-1LL)/K));
		}
	}s
	return ans;
	/*
	vector<ll> minyet; 
	vector<ll> y; 
	REP(i,0,N+1) 
	{
		y.pb(K*dp2[i]-i*L);
		if(i<K) {minyet.pb(y[i]);} else {minyet.pb(min(y[i],minyet[i-K]));}
	}
	vector<ll> f; 
	REP(S,0,N+1) 
	{
		f.pb((S*L+minyet[S])/K); 
	}
	ll ans = INF;
	REP(i,0,N+1)
	{
		ans=min(ans,f[i]+dp1[N-i]);
	}*/
	return ans;
}

Compilation message (stderr)

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:69:18: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   69 |  while(dp1.size()<=N) {dp1.pb(INF);} while(dp2.size()<=N) {dp2.pb(INF);}
      |        ~~~~~~~~~~^~~
boxes.cpp:69:54: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   69 |  while(dp1.size()<=N) {dp1.pb(INF);} while(dp2.size()<=N) {dp2.pb(INF);}
      |                                            ~~~~~~~~~~^~~
boxes.cpp:77:3: error: 's' was not declared in this scope
   77 |  }s
      |   ^