제출 #778078

#제출 시각아이디문제언어결과실행 시간메모리
778078Jarif_Rahman선물상자 (IOI15_boxes)C++17
50 / 100
2060 ms278436 KiB
#include "boxes.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; const int K = 1e7; ll S[K]; vector<ll> sth[K]; ll delivery(int n, int k, int L, int P[]){ vector<ll> A(n+1), B(n+1); A[0] = 0, B[n] = 0; fill(S, S+k, 0); for(int i = 1; i <= n; i++){ S[i%k]+=2*P[i-1]; A[i] = S[i%k]; } fill(S, S+k, 0); for(int i = n-1; i >= 0; i--){ S[(n-i)%k]+=2*(L-P[i]); B[i] = S[(n-i)%k]; } vector<ll> C(n+1); C[n] = 0; for(int i = n-1; i >= 0; i--){ C[i] = ll((n-i+k-1)/k)*L; sth[i%k].pb(B[i]); for(int j = 0; j < sth[i%k].size(); j++) C[i] = min(C[i], *(sth[i%k].rbegin()+j)+ll(L)*j); } ll ans = 1e18; for(int i = 0; i <= n; i++) ans = min(ans, A[i]+C[i]); return ans; }

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

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:34:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         for(int j = 0; j < sth[i%k].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...