제출 #941157

#제출 시각아이디문제언어결과실행 시간메모리
941157AiperiiiCloud Computing (CEOI18_clo)C++14
100 / 100
443 ms2388 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define pb push_back #define all(x) x.begin(),x.end() using namespace std; signed main(){ ios_base::sync_with_stdio(); cin.tie(0);cout.tie(0); int n,m; cin>>n; vector <vector <int> > vec; for(int i=0;i<n;i++){ int c,f,v; cin>>c>>f>>v; vec.pb({f,1,c,v}); } cin>>m; for(int i=0;i<m;i++){ int c,f,v; cin>>c>>f>>v; vec.pb({f,0,c,v}); } sort(all(vec));reverse(all(vec)); vector <int> dp(2e5+5,-1e18); dp[0]=0; for(int i=0;i<vec.size();i++){ if(vec[i][1]==1){ for(int j=1e5;j>=0;j--)dp[j+vec[i][2]]=max(dp[j+vec[i][2]],dp[j]-vec[i][3]); } else{ for(int j=vec[i][2];j<=1e5;j++)dp[j-vec[i][2]]=max(dp[j-vec[i][2]],dp[j]+vec[i][3]); } } int ans=0; for(int i=0;i<=1e5;i++)ans=max(ans,dp[i]); cout<<ans<<"\n"; } /* */

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

clo.cpp: In function 'int main()':
clo.cpp:28:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int i=0;i<vec.size();i++){
      |                 ~^~~~~~~~~~~
#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...