-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10816.cpp
More file actions
40 lines (39 loc) · 736 Bytes
/
10816.cpp
File metadata and controls
40 lines (39 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int arr[20000001];
int main(int argc, char** argv)
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int num;
int n,m;
cin>>n;
for (int i = 0; i < n; ++i)
{
cin>>num;
if(num>=0) arr[num]++;
else
{
num = num * -1;
num = num + 10000000;
arr[num]++;
}
}
cin>>m;
for (int i = 0; i < m; ++i)
{
cin>>num;
if(num>=0) cout<<arr[num]<<" ";
else
{
num = num * -1;
num = num + 10000000;
cout<<arr[num]<<" ";
}
}
return 0;
}