Files
CodeObject/storage/zeta/cpp/completed/10816.cpp

42 lines
823 B
C++

#include <map>
#include <iostream>
using namespace std;
void fastio() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
int main() {
fastio();
int n;
cin >> n;
map<int, int> ;
int x;
for (auto i = 0; i < n; i++) {
cin >> x;
auto pos = .find(x);
if (pos == .end()) {
[x] = 1;
} else {
pos->second++;
}
}
int m;
cin >> m;
for (auto i = 0; i < m; i++) {
cin >> x;
auto pos = .find(x);
if (pos == .end()) {
cout << "0 ";
} else {
cout << pos->second << " ";
}
}
cout << "\n";
}