Submission #82017

#TimeUsernameProblemLanguageResultExecution timeMemory
82017farukkastamonudaBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include "boxes.h" #include <bits/stdc++.h> #define fi first #define se second #define lo long long #define inf 1000000000 #define md 1000000007 #define li 10000005 #define mp make_pair #define pb push_back using namespace std; int n,k,l,A[li],bas,t,B[li],son; int delivery(int N,int K,int L,int positions[]){ int cevap=0; n=N,k=K,l=L; for(int i=0;i<n;i++) A[i]=positions[i]; for(int i=0;i<n;i++){ if(A[i]!=0) B[++t]=A[i]; } bas=1,son=t; while(bas<=son){ //printf("debug->: : %d %d \n",bas,son); int z1,z2; if(bas+k-1>son) z1=B[son]; else z1=B[bas+k-1]; if(son-k+1<bas) z2=B[bas]; else z2=B[son-k+1]; //cout<<z1; //exit(0); int cst1=z1-B[bas]+min(z1,l-z1)+min(B[bas],l-B[bas]); int cst2=B[son]-z2+min(z2,l-z2)+min(B[son],l-B[son]); //cout<<"ok->> :: :: "<<z1<<" :: "<<B[bas]<<' '<<endl; //exit(0); if(cst1<=cst2){ bas=min(bas+k-1,n)+1; cevap+=cst1; } else {son=max(bas-k+1,1)-1;cevap+=cst2;} } return cevap; } //~ int main(){ //~ scanf("%d %d %d",&n,&k,&l); //~ for(int i=0;i<n;i++) scanf("%d",&A[i]); //~ int ty=delivery(n,k,l,A); //~ printf("%d\n",ty); //~ return 0; //}

Compilation message (stderr)

boxes.cpp: In function 'int delivery(int, int, int, int*)':
boxes.cpp:13:5: error: ambiguating new declaration of 'int delivery(int, int, int, int*)'
 int delivery(int N,int K,int L,int positions[]){
     ^~~~~~~~
In file included from boxes.cpp:1:0:
boxes.h:4:11: note: old declaration 'long long int delivery(int, int, int, int*)'
 long long delivery(int N, int K, int L, int p[]);
           ^~~~~~~~