-
Notifications
You must be signed in to change notification settings - Fork 0
/
same.cpp
61 lines (61 loc) · 1.04 KB
/
same.cpp
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
52
53
54
55
56
57
58
59
60
61
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
vector<int> a;
multiset<int> cnt;
set<int> tmp;
vector<int> b;
int main()
{
bool flag = true;
int na, nb;
cin >> na;
for (int i = 0; i < na; i++)
{
int t;
cin >> t;
a.push_back(t);
cnt.insert(a[i]);
}
sort(a.begin(), a.end());
cin >> nb;
if (na != nb)
{
flag = false;
}
for (int i = 0; i < nb; i++)
{
int t;
cin >> t;
b.push_back(t);
}
sort(b.begin(), b.end());
for (int i = 0; i < na; i++)
{
if (a[i] != b[i])
{
flag = false;
break;
}
}
if (flag == true)
{
cout << "1" << endl;
}
else
{
cout << "0" << endl;
}
for (int i = 0; i < a.size(); i++)
{
if (tmp.count(a[i]) < 1)
{
cout << a[i] << " " << cnt.count(a[i]) << endl;
tmp.insert(a[i]);
}
}
system("pause");
return 0;
}