제출 #1006342

#제출 시각아이디문제언어결과실행 시간메모리
1006342christinelynnCloud Computing (CEOI18_clo)C++17
100 / 100
345 ms1472 KiB
#include <bits/stdc++.h> #define int long long #define pb push_back #define repp(i,x,n) for(int i=x;i<=n;i++) #define repo(i,x,n) for(int i=x;i>=n;i--) #define cy cout<<"Yes"<<endl #define cn cout<<"No"<<endl #define r0 return 0 #define fi first #define se second #define liow ios_base::sync_with_stdio(false);cin.tie(NULL) #define jelek cout<<"jelek"<<endl #define pii pair<int,int> #define all(v) v.begin(),v.end() #define pi pair<pair<int,int>,pair<int,int>> #define p4 pair<pii,pii> #define fl fflush(stdout) using namespace std; const int mod=1e9+7,maxn=1e6+5,N=(1<<17),INF=1e18; void solve(){ int n;cin>>n; vector<pair<pair<int,int>,pair<int,int>>>v; repp(i,1,n){ int c,f,d;cin>>c>>f>>d; v.pb({{f,1},{c,d}}); } int m;cin>>m; repp(i,1,m){ int c,f,d;cin>>c>>f>>d; v.pb({{f,0},{c,d}}); } sort(all(v),greater<p4>()); int dp[100005]; dp[0]=0; repp(i,1,100000) dp[i]=-INF; for(int i=0;i<v.size();i++){ if(v[i].fi.se==1){ for(int j=100000;j>=1;j--){ if(j-v[i].se.fi<0 || dp[j-v[i].se.fi]==-INF) continue; dp[j]=max(dp[j],dp[j-v[i].se.fi]-v[i].se.se); } } else { for(int j=0;j<=100000;j++){ if(j+v[i].se.fi>100000 || dp[j+v[i].se.fi]==-INF) continue; dp[j]=max(dp[j],dp[j+v[i].se.fi]+v[i].se.se); } } } int ans=0; repp(i,0,100000){ ans=max(ans,dp[i]); } cout<<ans; } signed main() { liow; int t=1; // cin>>t; while(t--){ solve(); } }

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

clo.cpp: In function 'void solve()':
clo.cpp:37:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<std::pair<long long int, long long int>, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |   for(int i=0;i<v.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...