제출 #67760

#제출 시각아이디문제언어결과실행 시간메모리
67760theknife2001선물상자 (IOI15_boxes)C++17
0 / 100
2 ms376 KiB
#include "boxes.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; const int N=1e7+55; long long dp[N][2]; int n; long long delivery(int N, int k, int L, int p[]) { n=N; int x; int temp=0; bool q=0; for(int i=0;i<n;i++) { x=k; while(x--&&i<n) { if(p[i]==0) i++; dp[i][0]=temp+p[i]; i++; } i--; temp+=p[i]+min(p[i],L-p[i]); } temp=0; for(int i=n-1;i>=0;i--) { x=k; while(x--&&i<n) { dp[i][1]=temp+(L-p[i]); i--; } i++; temp+=L-p[i]+min(p[i],L-p[i]); } long long ans=1e18; for(int i=0;i<n;i++) { ans=min(dp[i][0]+(i+1<n?dp[i+1][1]:0)+min(p[i],L-p[i])+(i+1<n?min(p[i+1],L-p[i+1]):0),ans); } return ans; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:10:48: warning: declaration of 'N' shadows a global declaration [-Wshadow]
 long long delivery(int N, int k, int L, int p[])
                                                ^
boxes.cpp:6:11: note: shadowed declaration is here
 const int N=1e7+55;
           ^
boxes.cpp:15:10: warning: unused variable 'q' [-Wunused-variable]
     bool q=0;
          ^
#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...