제출 #165336

#제출 시각아이디문제언어결과실행 시간메모리
165336losmi247선물상자 (IOI15_boxes)C++14
20 / 100
3 ms376 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e7+67; ll n,k,l,a[N]; ll delivery(int d,int K,int L,int positions[]){ n = d,k = K,l = L; for(int i = 1; i <= n; i++){ a[i] = positions[i-1]; } if(k == 1){ ll sol = 0; for(int i = 1; i <= n; i++){ sol += min({2*a[i],2*(l-a[i]),l}); } return sol; } if(k == n){ ll mini = 10000000000,maxi = -1; ll maxil = -1,minid = 10000000000; for(int i = 1; i <= n; i++){ maxi = max(maxi,a[i]); mini = min(mini,a[i]); if(a[i] <= l/2){ maxil = max(maxil,a[i]); } else{ minid = min(minid,a[i]); } } ll sol = min({2*maxi,2*(l-mini),l}); if(maxil != -1 && minid != 10000000000){ sol = min(sol,2*maxil+2*(l-minid)); } return sol; } } /*int main(){ }*/

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

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:39: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...