Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- map<int, int> mutants;
- int main() {
- freopen("mutants.in", "r", stdin);
- freopen("mutants.out", "w", stdout);
- int n, m, temp;
- cin >> n;
- for(int i = 0; i < n; i++) {
- cin >> temp;
- if(mutants.find(temp) != mutants.end()) {
- mutants[temp]++;
- }
- else {
- mutants[temp] = 1;
- }
- }
- cin >> m;
- for(int i = 0; i < m; i++) {
- cin >> temp;
- if(mutants.find(temp) != mutants.end()) {
- cout << mutants[temp];
- }
- else {
- cout << 0;
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment