Submission details
Task:Skyline
Sender:ind1f
Submission time:2025-10-29 16:35:48 +0200
Language:C++ (C++17)
Status:COMPILE ERROR

Compiler report

input/code.cpp:9:1: error: 'bitset' does not name a type
    9 | bitset<A> f;
      | ^~~~~~
input/code.cpp: In function 'int main()':
input/code.cpp:15:3: error: 'f' was not declared in this scope
   15 |   f[0] = true;
      |   ^
input/code.cpp:19:5: error: 'bitset' was not declared in this scope
   19 |     bitset<A> nf = f;
      |     ^~~~~~
input/code.cpp:2:1: note: 'std::bitset' is defined in header '<bitset>'; did you forget to '#include <bitset>'?
    1 | #include <iostream>
  +++ |+#include <bitset>
    2 | 
input/code.cpp:19:15: error: 'nf' was not declared in this scope; did you mean 'n'?
   19 |     bitset<A> nf = f;
      |               ^~
      |               n

Code

#include <iostream>

using namespace std;

const int N = 2e3 + 5;
const int A = 1e6 + 5;

int n, q;
bitset<A> f;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> q;
  f[0] = true;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    bitset<A> nf = f;
    nf <<= a;
    f |= nf;
  }
  while (q--) {
    int b;
    cin >> b;
    cout << (f[b] ? "Yes" : "No") << ' ';
  }
  return 0;
}