제출 #565006

#제출 시각아이디문제언어결과실행 시간메모리
565006KarukCloud Computing (CEOI18_clo)C++14
0 / 100
330 ms262144 KiB
#include<bits/stdc++.h> #define min(A,B) (A<B?A:B) #define max(A,B) (A>B?A:B) using namespace std; vector<long long>dp[4003]; void solve() { int n; cin>>n; vector<vector<long long> >a; for(int i=0;i<n;i++) { long long f,v,c; cin>>c>>f>>v; a.push_back({f,c,-v}); } int m; cin>>m; for(int i=0;i<m;i++) { long long f,v,c; cin>>c>>f>>v; a.push_back({f,-c,v}); } sort(a.begin(),a.end()); dp[0]=vector<long long>(101,0); for(int i=1;i<=n+m;i++) { int maxs=min(100000,100+50*min(i,n+m-i)); dp[i]=vector<long long>(100001,0); for(int negcores=0;negcores<=100000;negcores++) { if(negcores<dp[i-1].size()) dp[i][negcores]=max(dp[i][negcores],dp[i-1][negcores]); if(negcores+a[i-1][1]>=0 && negcores+a[i-1][1]<dp[i-1].size()) dp[i][negcores]=max(dp[i][negcores],dp[i-1][negcores+a[i-1][1]]+a[i-1][2]); } } cout<<dp[n+m][0]<<endl; } int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); solve(); return 0; }

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

clo.cpp: In function 'void solve()':
clo.cpp:28:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |             if(negcores<dp[i-1].size())
      |                ~~~~~~~~^~~~~~~~~~~~~~~
clo.cpp:30:59: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |             if(negcores+a[i-1][1]>=0 && negcores+a[i-1][1]<dp[i-1].size())
      |                                         ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
clo.cpp:25:13: warning: unused variable 'maxs' [-Wunused-variable]
   25 |         int maxs=min(100000,100+50*min(i,n+m-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...