Submission #1090866

#TimeUsernameProblemLanguageResultExecution timeMemory
1090866vjudge1은행 (IZhO14_bank)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int,int>;
using tii = tuple<int,int,int>;

const int maxn = 2e1 + 5;

int n,m,s[maxn],c[maxn],dp[maxn][1 << maxn];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    cin >> n >> m;
    
    for(int i = 0;i < n;i++) cin >> s[i];
    
    for(int i = 0;i < m;i++) cin >> c[i];
    
    for(int i = 0;i < n;i++)
        for(int j = 0;j < (1 << n);j++)
            dp[0][0] = -1;

    dp[0][0] = 0;
    
    for(int i = 0;i < n;i++)
        for(int mask = 0;mask < (1 << m);mask++)
            if(dp[i][mask] != -1){
                if(dp[i][mask] == s[i]){
                    if(i == n - 1){
                        cout << "YES";
                        return 0;
                    }
                    else dp[i + 1][mask] = 0;
                }
                for(int j = 0;j < m;j++)
                    if(!(mask & (1 << j))) dp[i][mask | (1 << j)] = dp[i][mask] + c[j];
            }
    
    cout << "NO";

    return 0;
}

Compilation message (stderr)

/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status