답안 #858305

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
858305 2023-10-08T05:40:04 Z Trisanu_Das Kitchen (BOI19_kitchen) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
 
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n, m, k; cin >> n >> m >> k;
    vector<int> a(n), b(m);
    int sum = 0;
    for (auto &x : a) {
        cin >> x; sum += x;
    }
    for (auto &x : b) cin >> x;
    bitset<mx> dp(1);
    for (auto x : b) dp |= (dp << x);
    for (int i = sum; i < 90001; i++) {
        if (dp[i]) {
            cout << i - sum;
            return 0;
        }
    }
    cout << "Impossible\n";
}

Compilation message

kitchen.cpp: In function 'int main()':
kitchen.cpp:13:12: error: 'mx' was not declared in this scope; did you mean 'm'?
   13 |     bitset<mx> dp(1);
      |            ^~
      |            m
kitchen.cpp:13:14: error: template argument 1 is invalid
   13 |     bitset<mx> dp(1);
      |              ^
kitchen.cpp:16:15: error: invalid types 'int[int]' for array subscript
   16 |         if (dp[i]) {
      |               ^