제출 #671763

#제출 시각아이디문제언어결과실행 시간메모리
671763mseebacherBoxes with souvenirs (IOI15_boxes)C++17
10 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef vector<int> vi; ll sum = 0; ll delivery(int N, int K, int L, int pos[]){ sum+= pos[0]; for(int i = 1;i<N;i++){ if(pos[i]-pos[i-1] > L/2){ sum += pos[i-1]; sum += abs(pos[i]-L); }else{ sum += pos[i]-pos[i-1]; } } sum += min(pos[N-1],abs(pos[N-1]-L)); ll erg = sum; sum = 0; sum+= abs(pos[N-1]-L); for(int i = N-1;i>0;i--){ if(pos[i]-pos[i-1] > L/2){ sum += pos[i-1]; sum += abs(pos[i]-L); }else{ sum += pos[i]-pos[i-1]; } } sum += min(pos[0],abs(pos[0]-L)); return min(erg,sum); }

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

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:9:24: warning: unused parameter 'K' [-Wunused-parameter]
    9 | ll delivery(int N, int K, int L, int pos[]){
      |                    ~~~~^
#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...