제출 #134551

#제출 시각아이디문제언어결과실행 시간메모리
13455120160161simone선물상자 (IOI15_boxes)C++14
20 / 100
2 ms504 KiB
#include "boxes.h" #include <bits/stdc++.h> #define M 100000010 using namespace std; int mi[M]; long long delivery(int N, int K, int L, int p[]) { if(K==1) { long long ans=0; for(int i=0;i<N;i++) ans+=min(abs(L-p[i]),abs(p[i]))*2; return ans; } if(K==N) { int Mli=p[0],Mlx=p[0],Mri=p[N-1],Mrx=p[N-1]; for (int i=0;i<N;i++) { if(p[i]*2<L) Mlx=p[i]; if(p[i]*2==L) return L; if(p[i]*2>L) { Mri=p[i]; break; } } if(Mli*2>L) { return (L-Mli)*2; } else if(Mrx*2<L) { return Mrx*2; } else { if (L<Mlx*2+(L-Mri)*2) return L; else return Mlx*2+(L-Mri)*2; } } }

컴파일 시 표준 에러 (stderr) 메시지

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:42:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...