제출 #483414

#제출 시각아이디문제언어결과실행 시간메모리
483414A_DCloud Computing (CEOI18_clo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>

#define int long long
#define ii pair<int,int>
#define F first
#define S second

using namespace std;
const int N=2e3+100;
int dpcost[N][N*50];
int c[N],f[N],v[N];
int cost[N];
int C[N],F[N],V[N];
int dp[N][N*50];
const int INF=9e18;
int n;
int m;

void solve()
{
    cin>>n;
    for(int i=1;i<=n;i++){
        scanf("%lld%lld%lld",&c[i],&f[i],&v[i]);
    }
    cin>>m;
    for(int i=1;i<=m;i++){
        scanf("%lld%lld%lld",&C[i],&F[i],&V[i]);
    }
    for(int i=0;i<N;i++){
        for(int j=1;j<N*50;j++){
            dpcost[i][j]=INF;
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n*50;j++){
            if(j-c[i]>=0){
                dpcost[i][j]=dpcost[i-1][j-c[i]]+v[i];
            }
            dpcost[i][j]=min(dpcost[i-1][j],dpcost[i][j]);
        }
    }
    for(int j=0;j<=n*50;j++){
        cost[j]=dpcost[n][j];
    }
    for(int i=1;i<=m;i++){
        for(int j=1;j<=m*50;j++){
            if(j-C[i]>=0){
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-C[i]]+V[i]);
            }
            else dp[i][j]=dp[i-1][j];
            dp[i][j]=max(dp[i][j],dp[i][j-1]);
           // cout<<dp[i][j]<<" ";
        }
    //    cout<<endl;
    }
  //  cout<<endl;
    int mx=0;
    for(int i=1;i<=n*50;i++){
        mx=max(mx,dp[m][i]-cost[i]);
//        cout<<cost[i]<<" "<<dp[m][i]<<endl;
    }
//    cout<<endl;
    cout<<mx<<endl;
}
main()
{
//    freopen("face.in","r",stdin);
   // freopen("face.out","w",stdout);
    int t=1;
 //   cin>>t;
    while(t--){
        solve();
    }
}

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

clo.cpp:65:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   65 | main()
      | ^~~~
clo.cpp: In function 'void solve()':
clo.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         scanf("%lld%lld%lld",&c[i],&f[i],&v[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
clo.cpp:27:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |         scanf("%lld%lld%lld",&C[i],&F[i],&V[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status