답안 #134919

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
134919 2019-07-23T12:15:11 Z miguel Kitchen (BOI19_kitchen) C++14
0 / 100
46 ms 1272 KB
#include<bits/stdc++.h>
using namespace std;
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define sz size()
#define x first
#define y second
#define pi pair <int, int>
#define pii pair <int, pi>
#define vi vector <int>
#define nmax 301
const ll mod = 998244353;
int n, m, k, s;
int a[605], b[605], dp[2][1000001];

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cout<<nmax*nmax;
    cin>>n>>m>>k;
    //if(m<k) return cout<<"Impossible", 0;
    for(int i=1; i<=n; i++){
        cin>>a[i];
        s+=a[i];
        if(a[i]<k) return cout<<"Impossible", 0;
    }
    for(int i=1; i<=m; i++) cin>>b[i];
    for(int i=0; i<=100000; i++){
        dp[0][i]=dp[1][i]=-(1<<30);
    }
    dp[0][0]=0;
    //int cur=0;
    for(int i=1; i<=m; i++){
        for(int h=0; h<=nmax*nmax; h++){
            dp[1][h]==-(1<<30);
        }
        for(int h=0; h<=nmax*nmax; h++){
            if(dp[0][h]==-(1<<30)) continue;
            dp[1][h+b[i]]=max(dp[0][h+b[i]], dp[0][h]+min(b[i], n));
        }
        //cur+=b[i];
        for(int h=0; h<=nmax*nmax; h++) dp[0][h]=dp[1][h];
    }
    //cout<<"xd";
    for(int h=s; h<=nmax*nmax; h++){
        //cout<<h<<" "<<dp[0][h]<<endl;
        if(dp[0][h]>=n*k) return cout<<h-s, 0;
    }
    cout<<"Impossible";

}

Compilation message

kitchen.cpp: In function 'int32_t main()':
kitchen.cpp:36:21: warning: statement has no effect [-Wunused-value]
             dp[1][h]==-(1<<30);
             ~~~~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1144 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1144 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 46 ms 1144 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 1272 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1144 KB Output isn't correct
2 Halted 0 ms 0 KB -