-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCCC14S2.java
More file actions
58 lines (57 loc) · 1.25 KB
/
CCC14S2.java
File metadata and controls
58 lines (57 loc) · 1.25 KB
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
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int t = 2*n;
int i = 0;
String[] s = new String[t];
while(i < t){
s[i] = in.next();
i++;
}
i = 0;
HashMap<String, String> hmap = new HashMap<String, String>();
while(i < n){
hmap.put(s[i], s[i+n]);
i++;
}
i = 0;
boolean pairing = true;
while(i < n){
if(!((hmap.get(s[i]).equals(s[i+n])))||!((hmap.get(s[i+n]).equals(s[i])))||hmap.get(s[i]).equals(s[i])||hmap.get(s[i+n]).equals(s[i+n])){
pairing = false;
break;
}
i++;
}
i = 0;
/*while(i < n){
System.out.print(s[i] + " ");
i++;
}
while(i < t){
System.out.print(s[i] + " ");
i++;
}
System.out.println();
i = 0;*/
/*while(i < n){
System.out.print(hmap.get(s[i]) + " ");
i++;
}
System.out.println();
while(i < t){
System.out.print(hmap.get(s[i]) + " ");
i++;
}
System.out.println();*/
if(pairing == false){
System.out.print("bad");
}
else{
System.out.print("good");
}
}
}