diff --git a/cpp/tknpcb_06.cpp b/cpp/tknpcb_06.cpp new file mode 100644 index 0000000..436828d --- /dev/null +++ b/cpp/tknpcb_06.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; + +int main() { + ios::sync_with_stdio(false); + cin.tie(nullptr); + + int N, Q; + cin >> N >> Q; + vector A(N); + for (int i = 0; i < N; ++i) cin >> A[i]; + + while (Q--) { + int x; + cin >> x; + auto lower = lower_bound(A.begin(), A.end(), x); + auto upper = upper_bound(A.begin(), A.end(), x); + cout << upper - lower << "\n"; + } + + return 0; +}