제출 #418415

#제출 시각아이디문제언어결과실행 시간메모리
418415vanic선물상자 (IOI15_boxes)C++14
0 / 100
1 ms276 KiB
#include "boxes.h" #include <cmath> #include <algorithm> using namespace std; typedef long long ll; ll delivery(int n, int k, int l, int p[]) { sort(p, p+n); ll sol=0; if(k==1){ for(int i=0; i<n; i++){ sol+=min(p[i], n-p[i]); } } else if(k==n){ int smj=0; for(int i=0; i<n; i++){ if(p[i]<(n-p[i])%n){ smj|=1; } else if(p[i]>(n-p[i])%n){ smj|=2; } } if(smj==3){ sol=n; } else{ for(int i=0; i<n; i++){ sol=max(sol, (ll)min(p[i], n-p[i])*2); } } } return sol; }

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

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:9:31: warning: unused parameter 'l' [-Wunused-parameter]
    9 | ll delivery(int n, int k, int l, int p[]) {
      |                           ~~~~^
#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...