제출 #81678

#제출 시각아이디문제언어결과실행 시간메모리
81678wzy선물상자 (IOI15_boxes)C++11
0 / 100
15 ms376 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; long long delivery(int N, int K, int L, int p[]) { #define int long long int ans = (int) 1e18; int k = K; int n = N; int l = L; for(int j = N - 1 ; j >= 0 ; j--){ for(int r = 0 ; (j - k*r + 1) >= 0 ; r++){ int u = j - k*r + 1; if(u > j) continue; // cout<<u<<" " << j <<" " << ans << endl; ans = min(ans , 2*p[u]*((u+1)/k + ((u+1)%k ? 1 : 0)) + 2*(L - p[j])*((n - j)/k + ((n-j)%k ? 1 : 0)) + L*((j-u+1)/k + ((j-u+1)%k ? 1 : 0))); // cout<<u<<" " << j <<" " << ans << endl; } // cout<<"__"<<endl; // cout<<j <<" " << ans << endl; ans = min(ans , 2*(L - p[j])*((n-j)/k + ((n-j)%k ? 1 : 0)) + L*((j)/k + (j%k ? 1 : 0))); // cout<<j <<" " << ans << endl; int i = j; ans = min(ans , 2*p[i]*((i+1)/k + ((i+1)%k ? 1 : 0)) + L *((n-i-1)/k + ((n-i-1)%k ? 1 : 0))); // cout<<j <<" " << ans <<" "<<endl; // cout<<"__"<<endl; } return ans; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:11:6: warning: unused variable 'l' [-Wunused-variable]
  int l = L;
      ^
#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...