제출 #134519

#제출 시각아이디문제언어결과실행 시간메모리
134519Boxworld선물상자 (IOI15_boxes)C++14
20 / 100
2 ms380 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; 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++){ if (p[i]*2<L)ans=ans+p[i]*2; else ans=ans+(L-p[i])*2; } return ans; }else 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:29: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...