Submission #260956

#TimeUsernameProblemLanguageResultExecution timeMemory
260956ElyesChaabouniBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
/*#pragma GCC optimize("O3")*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
//#define ordered_set tree<int, null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
#define eps 1e-9
#define MOD1 998244353
#define MOD2 1000000007
#define INV_10 299473306
#define INF 1000000001
#define PI 3.14159265358979323846
using namespace std;
long long delivery(int N, int K, int L, int p[]) {
	long long cost_as[N+1], cost_des[N+1];
	cost_as[0]=0;
	for(int i = 1; i <= N; i++)
	{
		int x=(i/K)*K;
		if(i%K==0)
			x-=K;
		cost_as[i]=cost_as[x]+min(2*p[i-1], L);
	}
	cost_des[0]=0;
	for(int i = 1; i <= N; i++)
	{
		int x=(i/K)*K;
		if(i%K==0)
			x-=K;
		long long cu=min(2*(L-p[N-i]), L)
		cost_des[i]=cost_des[x]+cu;
	}
	long long ans=1000000000000000000LL;
	for(int i = 0; i <= N; i++)
	{
		long long cu=cost_as[i]+cost_des[N-i];
		ans=min(ans, cu);
	}
	return ans;
}
//size

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:30:3: error: expected ',' or ';' before 'cost_des'
   cost_des[i]=cost_des[x]+cu;
   ^~~~~~~~
boxes.cpp:29:13: warning: unused variable 'cu' [-Wunused-variable]
   long long cu=min(2*(L-p[N-i]), L)
             ^~