forked from VibhutiJindal/CodeChef
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhashCp
More file actions
51 lines (43 loc) · 671 Bytes
/
hashCp
File metadata and controls
51 lines (43 loc) · 671 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
41
42
43
44
45
46
47
48
49
50
51
#include <bits/stdc++.h>
using namespace std;
bool untracable(string mag[], string note[], int m, int n)
{
unordered_map<string, int> words;
for(int i = 0; i < n; i++)
{
words[mag[i]] = words[mag[i]] + 1;
}
for(int i = 0; i < n; i++)
{
if(words[note[i]] > 0)
{
words[note[i]]--;
}
else{
return false;
}
}
return true;
}
int main()
{
string mag[30000];
string note[30000];
int m, n;
cin >> m >> n;
for(int i = 0; i < m; i++)
{
cin >> mag[i];
}
for(int i = 0; i < n; i++)
{
cin >> note[i];
}
if(untracable(mag, note, m, n))
{
cout << "yes";
}
else{
cout << "no";
}
}