제출 #79389

#제출 시각아이디문제언어결과실행 시간메모리
79389Plurm선물상자 (IOI15_boxes)C++11
0 / 100
5 ms504 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; long long delivery(int N, int K, int L, int p[]) { vector<int> a,b; for(int i = 0; i < N; i++){ if(p[i] < L-p[i]){ a.push_back(p[i]); }else{ b.push_back(L-p[i]); } } sort(a.begin(),a.end()); sort(b.begin(),b.end()); vector<long long> dpa,dpb; vector<long long> ansa; dpa.resize(a.size()); dpa[0] = 2ll*a[0]; long long mn = (long long)(N+K-1)/(long long)K*(long long)L; ansa.push_back(mn); for(int i = 1; i < a.size(); i++){ dpa[i] = i >= K ? dpa[i-K] : 0ll; dpa[i] += 2ll*(long long)a[i]; } dpb.resize(b.size()); dpb[0] = 2ll*b[0]; for(int i = 1; i < b.size(); i++){ for(int j = 0; j < a.size(); j++){ mn = min(mn,dpa[j] + dpb[i-1] + (long long)(N-i-j+K-2)/(long long)K*(long long)L); } dpb[i] = i >= K ? dpb[i-K] : 0ll; dpb[i] += 2ll*(long long)b[i]; } for(int j = 0; j < a.size(); j++){ mn = min(mn,dpa[j] + dpb[b.size()-1] + (long long)(N-b.size()-j+K-2)/(long long)K*(long long)L); } return mn; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:22:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 1; i < a.size(); i++){
                 ~~^~~~~~~~~~
boxes.cpp:28:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 1; i < b.size(); i++){
                 ~~^~~~~~~~~~
boxes.cpp:29:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = 0; j < a.size(); j++){
                  ~~^~~~~~~~~~
boxes.cpp:35:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int j = 0; j < a.size(); j++){
                 ~~^~~~~~~~~~
#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...