제출 #1098757

#제출 시각아이디문제언어결과실행 시간메모리
1098757vjudge1Sličice (COCI19_slicice)C++17
90 / 90
33 ms528 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n,m,k; cin>>n>>m>>k; vector<int> p,b; for(int n1=n;n1>0;n1--) { int x; cin>>x; p.push_back(x); } for(int n1=m+1;n1>0;n1--) { int x; cin>>x; b.push_back(x); } int res[501]; memset(res,-1,sizeof(res)); res[0]=0; int ress=0; for(int i=0;i<p.size();i++) { int br=p[i]; int temp[501]={}; for(int i1=0;i1<=500;i1++) temp[i1]=res[i1]; for(int j=0;br<b.size();br++,j++) { for(int kk=0;kk<=k-j;kk++) { if(res[kk]==-1) break; if(temp[kk+j]==-1) { temp[kk+j]=res[kk]+b[br]; } temp[kk+j]=max(temp[kk+j],res[kk]+b[br]); } } for(int i1=0;i1<=500;i1++) { res[i1]=temp[i1]; ress=max(ress,res[i1]); } } cout<<ress; return 0; }

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

slicice.cpp: In function 'int main()':
slicice.cpp:26:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for(int i=0;i<p.size();i++)
      |                 ~^~~~~~~~~
slicice.cpp:33:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |         for(int j=0;br<b.size();br++,j++)
      |                     ~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...