제출 #621916

#제출 시각아이디문제언어결과실행 시간메모리
621916Deepesson선물상자 (IOI15_boxes)C++17
10 / 100
2 ms408 KiB
#include <bits/stdc++.h> long long delivery(int N, int K, int L, int p[]); using ll = long long; ll inf = 1LL<<60LL; long long delivery(int N, int K, int L, int p[]) { ll dp[N+1]; for(auto&x:dp)x=inf; dp[0]=0; std::multiset<ll> setnob,setcob; setnob.insert(0); setcob.insert(2*L); std::deque<ll> dn,dc; dn.push_back(0); dc.push_back(2*L); for(int i=0;i!=N;++i){ int c=0; ll custo_local = std::min((ll)L,(ll)2*p[i]); dp[i+1]=std::min(*setnob.begin()+custo_local,*setcob.begin()); dp[i+1]=std::min(dp[i+1],dp[i]+std::min({custo_local,(ll)2*L-2*p[i]})); if(dn.size()>=K){ setnob.erase(setnob.find(dn.front())); dn.pop_front(); } if(dc.size()>=K){ setcob.erase(setcob.find(dc.front())); dc.pop_front(); } ll custo_push = 2*L-2*p[i]; setnob.insert(dp[i+1]); dn.push_back(dp[i+1]); setcob.insert(dp[i+1]+custo_push); dc.push_back(dp[i+1]+custo_push); } return dp[N]; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:21:21: warning: comparison of integer expressions of different signedness: 'std::deque<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |         if(dn.size()>=K){
      |            ~~~~~~~~~^~~
boxes.cpp:25:21: warning: comparison of integer expressions of different signedness: 'std::deque<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |         if(dc.size()>=K){
      |            ~~~~~~~~~^~~
boxes.cpp:17:13: warning: unused variable 'c' [-Wunused-variable]
   17 |         int c=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...