Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9db32aa

Browse files
codeforces div 4
1 parent e092d09 commit 9db32aa

File tree

3 files changed

+190
-0
lines changed

3 files changed

+190
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import java.io.*;
2+
import java.util.*;
3+
4+
public class Colourblindness {
5+
static BufferedReader br;
6+
static StringTokenizer st;
7+
8+
static int nextInt() throws IOException {
9+
return Integer.parseInt(next());
10+
}
11+
12+
static String next() throws IOException {
13+
while (st == null || !st.hasMoreTokens()) {
14+
st = new StringTokenizer(br.readLine());
15+
}
16+
return st.nextToken();
17+
}
18+
19+
static long nextLong() throws IOException {
20+
return Long.parseLong(next());
21+
}
22+
23+
public static void main(String args[]) throws IOException {
24+
br = new BufferedReader(new InputStreamReader(System.in));
25+
int t = nextInt();
26+
while (t-- > 0) {
27+
input();
28+
}
29+
br.close();
30+
}
31+
32+
public static void input() throws IOException {
33+
int n = nextInt();
34+
String s1 = next();
35+
String s2 = next();
36+
int c = 0;
37+
for (int i = 0; i < n; i++) {
38+
if ((s1.charAt(i) == s2.charAt(i)) || (s1.charAt(i) == 'G' && s2.charAt(i) == 'B')
39+
|| (s1.charAt(i) == 'B' && s2.charAt(i) == 'G')) {
40+
c++;
41+
}
42+
}
43+
if (c == n) {
44+
System.out.println("YES");
45+
} else {
46+
System.out.println("NO");
47+
48+
}
49+
}
50+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import java.io.*;
2+
import java.util.*;
3+
4+
public class Wordgame {
5+
static BufferedReader br;
6+
static StringTokenizer st;
7+
8+
static int nextInt() throws IOException {
9+
return Integer.parseInt(next());
10+
}
11+
12+
static String next() throws IOException {
13+
while (st == null || !st.hasMoreTokens()) {
14+
st = new StringTokenizer(br.readLine());
15+
}
16+
return st.nextToken();
17+
}
18+
19+
static long nextLong() throws IOException {
20+
return Long.parseLong(next());
21+
}
22+
23+
public static void main(String args[]) throws IOException {
24+
br = new BufferedReader(new InputStreamReader(System.in));
25+
int t = nextInt();
26+
while (t-- > 0) {
27+
input();
28+
}
29+
br.close();
30+
}
31+
32+
public static void input() throws IOException {
33+
int n = nextInt();
34+
List<String> s1 = new ArrayList<>();
35+
List<String> s2 = new ArrayList<>();
36+
List<String> s3 = new ArrayList<>();
37+
38+
for (int i = 0; i < 3; i++) {
39+
for (int j = 0; j < n; j++) {
40+
String s = next();
41+
if (i == 0)
42+
s1.add(s);
43+
if (i == 1)
44+
s2.add(s);
45+
if (i == 2)
46+
s3.add(s);
47+
}
48+
}
49+
50+
Collections.sort(s1);
51+
Collections.sort(s2);
52+
Collections.sort(s3);
53+
54+
int p1 = 0, p2 = 0, p3 = 0;
55+
for (int i = 0; i < n; i++) {
56+
if ((s2.contains(s1.get(i))) && !(s3.contains(s1.get(i)))) {
57+
p1++;
58+
p2++;
59+
} else if ((s3.contains(s2.get(i))) && !(s1.contains(s2.get(i)))) {
60+
p3++;
61+
p2++;
62+
} else if ((s1.contains(s3.get(i))) && !(s2.contains(s3.get(i)))) {
63+
p1++;
64+
p3++;
65+
} else if (!((s2).contains(s1.get(i))) && !((s3).contains(s1.get(i)))) {
66+
p1 += 3;
67+
} else if (!((s2).contains(s3.get(i))) && !((s1).contains(s3.get(i)))) {
68+
p3 += 3;
69+
} else if (!((s1).contains(s2.get(i))) && !((s3).contains(s2.get(i)))) {
70+
p2 += 3;
71+
} else {
72+
continue;
73+
}
74+
75+
}
76+
77+
System.out.println(p1 + " " + p2 + " " + p3);
78+
79+
}
80+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import java.io.*;
2+
import java.util.*;
3+
4+
public class spellcheck {
5+
static BufferedReader br;
6+
static StringTokenizer st;
7+
8+
static int nextInt() throws IOException {
9+
return Integer.parseInt(next());
10+
}
11+
12+
static String next() throws IOException {
13+
while (st == null || !st.hasMoreTokens()) {
14+
st = new StringTokenizer(br.readLine());
15+
}
16+
return st.nextToken();
17+
}
18+
19+
static long nextLong() throws IOException {
20+
return Long.parseLong(next());
21+
}
22+
23+
public static void main(String args[]) throws IOException {
24+
br = new BufferedReader(new InputStreamReader(System.in));
25+
int t = nextInt();
26+
while (t-- > 0) {
27+
input();
28+
}
29+
br.close();
30+
}
31+
32+
public static void input() throws IOException {
33+
34+
Set<Character> s = new HashSet<>();
35+
s.add('T');
36+
s.add('i');
37+
s.add('m');
38+
s.add('u');
39+
s.add('r');
40+
int n = nextInt();
41+
String word = next();
42+
if (n == 5) {
43+
Set<Character> in = new HashSet<>();
44+
45+
for (int i = 0; i < word.length(); i++) {
46+
in.add(word.charAt(i));
47+
}
48+
49+
if (s.equals(in)) {
50+
System.out.println("YES");
51+
} else {
52+
System.out.println("NO");
53+
54+
}
55+
} else {
56+
System.out.println("NO");
57+
}
58+
59+
}
60+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /