-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathccc14s2.cpp
More file actions
44 lines (34 loc) · 933 Bytes
/
ccc14s2.cpp
File metadata and controls
44 lines (34 loc) · 933 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
#include <vector>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int n; cin >> n;
vector<string> first(n);
for (int i = 0; i < n; i++) {
cin >> first[i];
}
map<string, string> partners;
for (int i = 0; i < n; i++) {
string second;
cin >> second;
if (partners.count(first[i]) && (partners[first[i]] != second || partners[first[i]] == first[i])) {
cout << "bad";
return 0;
}
if (partners.count(second) && (partners[second] != first[i] || partners[second] == second)) {
cout << "bad";
return 0;
}
if (first[i] == second) {
cout << "bad";
return 0;
}
partners[first[i]] = second;
partners[second] = first[i];
}
cout << "good";
}