exec_outcome
stringclasses
1 value
code_uid
stringlengths
32
32
file_name
stringclasses
111 values
prob_desc_created_at
stringlengths
10
10
prob_desc_description
stringlengths
63
3.8k
prob_desc_memory_limit
stringclasses
18 values
source_code
stringlengths
117
65.5k
lang_cluster
stringclasses
1 value
prob_desc_sample_inputs
stringlengths
2
802
prob_desc_time_limit
stringclasses
27 values
prob_desc_sample_outputs
stringlengths
2
796
prob_desc_notes
stringlengths
4
3k
lang
stringclasses
5 values
prob_desc_input_from
stringclasses
3 values
tags
listlengths
0
11
src_uid
stringlengths
32
32
prob_desc_input_spec
stringlengths
28
2.37k
difficulty
int64
-1
3.5k
prob_desc_output_spec
stringlengths
17
1.47k
prob_desc_output_to
stringclasses
3 values
hidden_unit_tests
stringclasses
1 value
PASSED
727d5665ba63e3cb373f456ba920dff6
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Objects; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int testCase = sc.nextInt(); for (int i=0; i< testCase; i++) { int length = sc.nextInt(); String row1 = sc.next(); String row2 = sc.next(); String replaceString1 = row1.replace('B','G'); String replaceString2 = row2.replace('B','G'); if (Objects.equals(replaceString1, replaceString2)) { System.out.println("YES"); } else { System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
e8499d2bce835ab2636b5a15511c5f04
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class cf { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); String s1 = sc.next().replace('G', 'B'); String s2 = sc.next().replace('G', 'B'); if (s1.equals(s2)) { System.out.println("YES"); } else { System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
e51a747c3cc6fc66a97ff4f30fb02c00
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class cf { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); String s1 = sc.next().replace('G', 'B'); String s2 = sc.next().replace('G', 'B'); int i = 0; for (; i < n; i++) { if (s1.charAt(i) != s2.charAt(i)) { System.out.println("NO"); break; } } if (i == n) { System.out.println("YES"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
687c484c4b0bd54f25ea39909037194e
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; import java.io.*; public final class CF_1722B { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); for(int testcase = 0; testcase < t; testcase++){ int n = in.nextInt(); char[] a = in.next().toCharArray(); char[] b = in.next().toCharArray(); for(int i = 0; i<n; i++){ if(a[i] == 'G'){ a[i] = 'B'; } if(b[i] == 'G'){ b[i] = 'B'; } } boolean same = true; for(int i = 0; i<n; i++){ if(a[i] != b[i]){ same = false; break; } } if(same){ out.println("YES"); } else{ out.println("NO"); } } in.close(); out.close(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
78fb9ab57a4ab32b4d68a950a2b0235d
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class B { public static void main(String[] args){ Scanner scn = new Scanner(System.in); int t = scn.nextInt(); while(t-- > 0){ int n = scn.nextInt(); String s1 = scn.next(); String s2 = scn.next(); // System.out.println(s1 + " " + s2); String ans = solve(s1, s2); // String ans = getSum(s1) == getSum(s2) ? "YES" : "NO"; System.out.println(ans); } } public static String solve(String s1, String s2){ char[] arr1 = s1.toCharArray(); char[] arr2 = s2.toCharArray(); for(int i = 0; i < arr1.length; i++){ if(arr1[i] == 'G' || arr1[i] == 'B') arr1[i] = 'G'; if(arr2[i] == 'G' || arr2[i] == 'B') arr2[i] = 'G'; } for(int i = 0; i < arr1.length; i++){ if(arr1[i] != arr2[i]) return "NO"; } return "YES"; } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
7ca5c4913ac1c8f6ebc97ace02d5ee14
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class CP { public static void main(String[] args) { // TODO Auto-generated method stub Character[] c= {'T','i','m','u','r'}; List<Character> list=Arrays.asList(c); Set<Character> set=new HashSet<>(list); Scanner s=new Scanner(System.in); int t=s.nextInt(); for(int i=0;i<t;i++) { int n=s.nextInt(); String s1=s.next(); String s2=s.next(); boolean f=true; for(int j=0;j<s1.length();j++) { if(s1.charAt(j)=='R' && s2.charAt(j)!='R') { f=false; break; } if(s2.charAt(j)=='R' && s1.charAt(j)!='R') { f=false; break; } } if(f) { System.out.println("YES"); }else { System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
3ee2b4cbcb326cc893ab42a88a616ddd
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class App { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(reader.readLine()); while(t > 0) { System.out.println(solve(reader) ? "YES" : "NO"); t -= 1; } reader.close(); } public static boolean solve(BufferedReader reader) throws Exception { int n = Integer.parseInt(reader.readLine()); String[] arr = new String[2]; for (int i = 0; i < 2; i++) { arr[i] = reader.readLine(); } for (int i = 0; i < n; i++) { char current1 = arr[0].charAt(i); char current2 = arr[1].charAt(i); if(!( (current1 == 'R' && current2 == 'R')|| (current1 == 'B' && current2 == 'G')|| (current1 == 'G' && current2 == 'B')|| (current1 == 'G' && current2 == 'G')|| (current1 == 'B' && current2 == 'B'))) { return false; } } return true; } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
60887e00426b251f9e2db3ea8eb4f264
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class cf1722B { public static void main(String[] args) { FastReader sc = new FastReader(); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); //num column String s1 = sc.nextLine().replace('B', 'G'); String s2 = sc.nextLine().replace('B', 'G'); System.out.println(s1.equals(s2) ? "YES" : "NO"); } } static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
c2a2a6d785b63ffab69e7ae02c682e00
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class cf1722B { public static void main(String[] args) { FastReader sc = new FastReader(); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); //num column boolean sol = true; String s1 = sc.nextLine(); String s2 = sc.nextLine(); for(int i=0; i<n; i++) { if(s1.charAt(i) != s2.charAt(i) && (s1.charAt(i) == 'R' || s2.charAt(i) =='R')) { sol = false; break; } } System.out.println(sol ? "YES" : "NO"); } } static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
468ec438b17e90869d495b3910a0764d
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
//1722B - ColourBlindness - (codeforces) import java.util.Scanner; public class B_Colourblindness{ public static void result(String s1 , String s2 , int n){ int s = 0; for(int i = 0 ; i<n ; i++){ if((s1.charAt(i) == 'R') && (s2.charAt(i)=='R')){ s+=1; } else if(((s1.charAt(i)=='G') || (s1.charAt(i) == 'B')) && ((s2.charAt(i) == 'B')||(s2.charAt(i)=='G'))){ s+=1; } } if(s==n){ System.out.println("YES"); } else{ System.out.println("NO"); } } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int testCase = sc.nextInt(); for(int i = 0 ; i<testCase ; i++){ int length = sc.nextInt(); String str1 = sc.next(); String str2 = sc.next(); result(str1,str2,length); } sc.close(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
12425129fe28e029ed4e234f6a0e66b7
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
// 1722B - ColourBlindness - (codeforces) import java.util.Scanner; public class B_Colourblindness{ public static void result(String s1 , String s2 , int n){ int s = 0; for(int i = 0 ; i<n ; i++){ if((s1.charAt(i) == 'R') && (s2.charAt(i)=='R')){ s+=1; } else if(((s1.charAt(i)=='G') || (s1.charAt(i) == 'B')) && ((s2.charAt(i) == 'B')||(s2.charAt(i)=='G'))){ s+=1; } } if(s==n){ System.out.println("YES"); } else{ System.out.println("NO"); } } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int testCase = sc.nextInt(); for(int i = 0 ; i<testCase ; i++){ int length = sc.nextInt(); String str1 = sc.next(); String str2 = sc.next(); result(str1,str2,length); } sc.close(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
d2b8bc3fa4ec2032f49a3d9df8cb5d37
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Program { public static void main(String[] args) { int t=0; Scanner sc=new Scanner(System.in); t=sc.nextInt(); while(t-->0){ int n=0, flag=0; n=sc.nextInt(); String str1=sc.next(); String str2=sc.next(); for(int i=0;i<n;i++){ if(str1.charAt(i)==str2.charAt(i)){ flag+=0; }else if(((str1.charAt(i)=='B' && str2.charAt(i)=='G')||(str1.charAt(i)=='G' && str2.charAt(i)=='B'))){ flag+=0; }else{ flag+=1; } } if(flag>0){ System.out.println("NO"); }else{ System.out.println("YES"); } } sc.close(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
3ebe67b53ef211c8cb8f8788bb354578
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; /** * B_Colourblindness */ public class B_Colourblindness { static String color(String row1, String row2, int n) { for (int i = 0; i < n; i++) { if (row1.charAt(i) == 'R' && row2.charAt(i) != 'R' || (row2.charAt(i) == 'R' && row1.charAt(i) != 'R')) return "NO"; } return "YES"; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int testcase = sc.nextInt(); while (testcase-- > 0) { int n = sc.nextInt(); String row1 = sc.next(); String row2 = sc.next(); System.out.println(color(row1, row2, n)); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
272a0acb110885ec2e9ea937709c2afc
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; public class Mian { static FastReader in=new FastReader(); static PrintWriter out=new PrintWriter(System.out); static int n,m,zu; static void solve(){ n=in.nextInt(); char a[]=in.next().toCharArray(); char b[]=in.next().toCharArray(); for(int i=0;i<a.length;i++) if(a[i]=='G') a[i]='B'; for(int i=0;i<b.length;i++) if(b[i]=='G') b[i]='B'; for(int i=0;i<a.length;i++){ if(a[i]!=b[i]){ out.println("No");return; } } out.println("YES"); } public static void main(String[] args) { zu=in.nextInt(); while(zu-->0){ solve(); } out.flush(); out.close(); } static class FastReader{ StringTokenizer st; BufferedReader br; FastReader(){ br=new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(st==null||!st.hasMoreElements()){ try { st=new StringTokenizer(br.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return st.nextToken(); } long nextLong(){ return Long.parseLong(next()); } double nextDouble(){ return Double.parseDouble(next()); } int nextInt(){ return Integer.parseInt(next()); } String nextLine(){ String str=""; try { str=br.readLine(); } catch (IOException e) { throw new RuntimeException(e); } return str; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
1d519fbd7ad1aad14df9e5509a0c118b
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Code { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); while (a-- > 0) { int l = sc.nextInt(); String first = sc.next(); String second = sc.next(); boolean identical = true; if (l == first.toUpperCase(Locale.ROOT).length() && l == second.toUpperCase(Locale.ROOT).length()) { for (int i = 0; i < l; i++) { if (first.charAt(i) == 'B' && second.charAt(i) == 'R' || first.charAt(i) == 'R' && second.charAt(i) == 'B') { identical = false; break; } if (first.charAt(i) == 'G' && second.charAt(i) == 'R' || first.charAt(i) == 'R' && second.charAt(i) == 'G') { identical = false; break; } } if (identical == true) System.out.println("Yes"); else System.out.println("No"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
569e52664958dd3a9642970b26fee210
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Main { public static void main( String[] args ) { Scanner in = new Scanner( System.in ); int n = in.nextInt(); int ans = 0; while( n --> 0 ) { int m = in.nextInt(); String s = in.next(); String k = in.next(); s = s.replace( "G", "B" ); k = k.replace( "G", "B" ); if( s.equals( k )) { System.out.println( "YES" ); } else { System.out.println( "NO" ); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
439e176a87cd2d7e126aa480e948cd7b
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class B817 { static AReader scan = new AReader(); static void solve() { int n = scan.nextInt(); char[] cs1 = scan.next().toCharArray(); char[] cs2 = scan.next().toCharArray(); boolean flag = true; for(int i = 0;i<n;i++){ if(cs1[i] != cs2[i] && (cs1[i] == 'R' || cs2[i] == 'R')){ flag = false; break; } } if(flag) System.out.println("YES"); else System.out.println("NO"); } public static void main(String[] args) { int T = scan.nextInt(); while (T-- > 0) { solve(); } } } class AReader { private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); private StringTokenizer tokenizer = new StringTokenizer(""); private String innerNextLine() { try { return reader.readLine(); } catch (IOException ex) { return null; } } public boolean hasNext() { while (!tokenizer.hasMoreTokens()) { String nextLine = innerNextLine(); if (nextLine == null) { return false; } tokenizer = new StringTokenizer(nextLine); } return true; } public String nextLine() { tokenizer = new StringTokenizer(""); return innerNextLine(); } public String next() { hasNext(); return tokenizer.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } } class Pair { int x,y; public Pair(int x, int y) { this.x = x; this.y = y; } } class Node{ int l,r; int val; int lazy; int cnt = 0,lnum,rnum; public Node(int l, int r) { this.l = l; this.r = r; } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
dcfa5ea66edc3259e85559eb32e8599b
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.*; import java.util.*; public class colourblindness { public static void main(String[] args) throws IOException{ //BufferedReader br = new BufferedReader(new FileReader("input.in")); //PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("output.out"))); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int t = Integer.parseInt(st.nextToken()); for(int i = 0; i < t; i++) { int n = Integer.parseInt(br.readLine()); char[] first = br.readLine().toCharArray(); char[] second = br.readLine().toCharArray(); String ans = "YES"; for(int j = 0; j < n; j++) { if(!((first[j]=='R' && second[j]=='R') || ((first[j]=='G' || first[j]=='B') && (second[j]=='G' || second[j]=='B')))) { ans = "NO"; break; } } System.out.println(ans); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
3c2a5f9d91ae0b3f3fa1f52501e946a8
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
/* ⣿⣿⣿⣿⡿⠛⠛⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠛⠛⢿⣿⣿⣿⣿ ⣿⣿⣿⣿⠁⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠛⠛⠛⠛⠻⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠁⠀⠀⠀⠈⣿⣿⣿⣿ ⣿⠋⠉⠁⠀⠀⠀⠀⢴⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠻⣿⣿⣿⣿⣿⣿⣿⣿⣦⠀⠀⠀⠀⠈⠉⠻⣿ ⣿⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣿⠟⠁⣰⡆⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣄⡈⠻⣿⣿⣿⣿⡿⠏⠀⠀⠀⠀⠀⠀⠀⠀⣿ ⣿⣦⣄⣀⣤⣶⣄⠀⠀⠀⠀⠙⢿⡿⠃⠀⡾⠃⣰⠟⢠⡟⠀⠀⠀⠀⠀⠀⠀⠀⢿⡄⠈⢿⡀⠈⢿⡿⠋⠀⠀⠀⠀⣠⣶⣄⣀⣀⣴⣿ ⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⢀⣿⣷⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣾⣷⣶⣾⣿⡄⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣼⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⣀⣴⣶⣶⣄⠀⠀⠀⠀⠀⠀⣠⣴⣶⣦⣄⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⢰⣿⣿⣿⣿⣿⣷⡄⠀⠀⢀⣾⣿⣿⣿⣿⣿⣇⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⢸⣿⣿⣿⣿⣿⣿⠇⠀⠀⠘⣿⣿⣿⣿⣿⣿⡿⠀⠀⣠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣀⠀⠻⠿⣿⣿⠿⠋⠀⠀⠀⠀⠘⠿⢿⣿⡿⠿⠃⢀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣀⠀⠀⠀⠀⠀⠐⢿⣿⠇⠀⠀⠀⠀⠀⣀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⡿⠛⠲⠦⣤⣤⣤⣀⣀⣤⣤⣤⠴⠖⠛⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⢸⢧⣀⠀⢰⡇⠀⠈⠉⡏⠉⠀⢸⠀⠀⢀⣼⡇⠙⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⣟⠀⠈⠉⣾⠳⠶⠤⣤⣧⠤⠴⢾⡗⠉⠉⠀⢇⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⡿⠋⠉⠙⠻⠛⠁⠀⠀⠀⢀⡏⠑⢶⣤⡟⠀⠀⠀⠀⡇⠀⠀⠀⣷⣠⡴⠖⢻⠀⠀⠀⠀⠈⠻⠟⠋⠉⠙⢿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣷⠀⠀⠀⠈⠉⠛⠛⠛⠛⠛⠛⠋⠉⠀⠀⠀⣾⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣧⣀⣀⠀⠀⠀⠀⠐⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⠀⠀⠀⠀⢀⣀⣠⣾⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⣿⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣼⣿⣿⣿⣿⣇⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣤⣤⣴⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣤⣤⣤⣤⣴⣶⣿⣿⣿⣿⣿⣿⣿⣿⣦⣤⣤⣴⣿⣿⣿⣿⣿⣿⣿ */ import java.lang.reflect.Array; import static java.lang.Math.*; import java.util.Arrays; import java.util.Scanner; public class Test{ public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); int n; String s1 , s2; char[] a1 , a2; while(t-- != 0){ n = input.nextInt(); s1 = input.next(); s2 = input.next(); a1 = s1.toCharArray(); a2 = s2.toCharArray(); for(int i = 0; i < n; i++){ if(a1[i] == 'G') a1[i] = 'B'; if(a2[i] == 'G') a2[i] = 'B'; } // To Convert Char Array To String: s1 = String.valueOf(a1); s2 = String.valueOf(a2); if(s1.equals(s2)) System.out.println("YES"); else System.out.println("NO"); } } } /* int t = input.nextInt(); int Col; String s1; String s2; int C_Red1 = 0; int C_Red2 = 0; int C_Green_And_Blue1 = 0; int C_Green_And_Blue2 = 0; while(t-- != 0){ Col = input.nextInt(); s1 = input.next(); s2 = input.next(); for(int i = 0; i < Col; i++){ if(s1.charAt(i) == 'R') C_Red1++; if(s2.charAt(i) == 'R') C_Red2++; if(s1.charAt(i) == 'B' || s1.charAt(i) == 'G') C_Green_And_Blue1++; if(s2.charAt(i) == 'B' || s2.charAt(i) == 'G') C_Green_And_Blue2++; } if(C_Red1 == C_Red2 && C_Green_And_Blue1 == C_Green_And_Blue2) System.out.println("YES"); else System.out.println("NO"); C_Red1 = 0; C_Red2 = 0; C_Green_And_Blue1 = 0; C_Green_And_Blue2 = 0; } */
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
cfb997383d5a251c48a9e5aae67588d8
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class color { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int t =sc.nextInt(); while(t-->0) { int n=sc.nextInt(); String s1=sc.next(); String s2=sc.next(); if(s1.replace('B','G').equals(s2.replace('B','G'))) System.out.println("yes"); else System.out.println("no"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
c043741aab7c3f886c0b3f6c245f0458
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Basics { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int test=sc.nextInt(); for (int k=0;k<test;k++) { int length = sc.nextInt(); String input1 = sc.next(); String input2 = sc.next(); boolean isEqual = true; for (int i = 0; i < length; i++) { if ((input1.charAt(i) == 'R' && input2.charAt(i) == 'B') || (input1.charAt(i) == 'R' && input2.charAt(i) == 'G')) { isEqual = false; System.out.println("NO"); break; } else if ((input2.charAt(i) == 'R' && input1.charAt(i) == 'B') || (input2.charAt(i) == 'R' && input1.charAt(i) == 'G')) { isEqual = false; System.out.println("NO"); break; } } if (isEqual) System.out.println("YES"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
bd9c85e478df059b40c30ad2ef3722ec
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int caseNum = in.nextInt(); // Scanner has functions to read ints, longs, strings, chars, etc. for (int t = 1; t <= caseNum; ++t) { int n = in.nextInt(); String strOne = in.next().replace("G", "B"); String strTwo = in.next().replace("G", "B"); if (strOne.equals(strTwo)) { System.out.println("YES"); } else { System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
678c3f37e499caf8803da31a144b8166
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Contestcf { public static void main(String[] args) { Scanner in =new Scanner(System.in); int t=in.nextInt(); for (int i = 0; i < t; i++) { int c=0; int l=0; int r=in.nextInt(); String f=in.next(); String s=in.next(); for (int j = 0; j < r; j++) { char first=f.charAt(j); char second=s.charAt(j); if(first==second){ l++; }else if(first!= second){ if(first =='B' && second =='G'){ l++; }else if(first=='G' && second=='B'){ l++; }else{ c++; } } } if(c>0 && l<r){ System.out.println("No"); }else{ System.out.println("Yes"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
861ef513e399d90c1aa855e12813a45a
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; import javax.sound.midi.Soundbank; // import java. public class tsp { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); String s = sc.next(); String s2 = sc.next(); int si = -1; for(int i=0; i<n;i++) { char a = s.charAt(i); char b = s2.charAt(i); if((a=='B' && b == 'R') || (a=='R' && b == 'B')) { System.out.println("NO"); si=0; break; } else if((a=='G' && b == 'R') || (a=='R' && b == 'G')) { System.out.println("NO"); si=0; break; } } if(si==-1) { System.out.println("YES"); } } // System.out.println("Sum of x+y = " + z); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
52f3355297bef7366ab09bed358caf21
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; import java.io.*; public class Codeforces{ public static void main(String[]args) throws Exception{ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); String st=sc.next(),ss=sc.next(); boolean kp=true; for(int i=0;i<n;i++) { if(st.charAt(i)!=ss.charAt(i) && ((st.charAt(i)=='R' && ss.charAt(i)=='B') ||(st.charAt(i)=='B' && ss.charAt(i)=='R') ||(st.charAt(i)=='R' && ss.charAt(i)=='G') || (st.charAt(i)=='G' && ss.charAt(i)=='R'))) { System.out.println("NO"); kp=false; break; } } if(kp==true) { System.out.println("YES"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
1bf2cbc10851f68e34064576ff9b0eb4
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t-->0) { int flag=0; int c=0; int len=s.nextInt(); String a=s.next(); String b=s.next(); String ans=""; String ans1=""; for(int i=0;i<len;i++) { if(a.charAt(i)=='G') ans+="A"; else if ( a.charAt(i)=='B') ans+="A"; else ans+="R"; if(b.charAt(i)=='G') ans1+="A"; else if ( b.charAt(i)=='B') ans1+="A"; else ans1+="R"; } for(int i=0;i<len;i++) { if(ans.charAt(i)==ans1.charAt(i)) { c++; } } if(c==len) System.out.println("YES"); else System.out.println("NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
743199710b952330ff8ccff3b8e20aa2
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
//============================================================================ //Everyone has a different way of thinking, so God Created us // Hope You Respect My Way..,Thank You ): // Author : Murad // Name : Codeforces.cpp & Atcoder.cpp // Description : Problem name //============================================================================/ import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in= new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); int t=in.nextInt(); while(t-->0){ int n=in.nextInt(); char a[][]=new char[2][n]; boolean ok=false; for(int i=0;i<2;i++) { a[i]=in.next().toCharArray(); } for(int i=1;i<2;i++){ for(int j=0;j<n;j++){ if (i != 0) { if ((a[i][j] == 'R' && a[i - 1][j] == 'G') || (a[i][j] == 'R' && a[i - 1][j] == 'B')) { ok |= true; break; } if ((a[i][j] == 'G' && a[i - 1][j] == 'R') || (a[i][j] == 'B' && a[i - 1][j] == 'R')) { ok |= true; break; } } } } if(ok)out.println("NO"); else out.println("YES"); } out.flush(); } static class NumberTheory{ public static long gcd(long a,long b){ long c; while (a != 0) { c = a; a = b % a; b = c; } return b; } } static class Pair implements Comparable<Pair> { long x; long y; Pair(long x, long y) { this.x = x; this.y = y; } @Override public int compareTo(Pair o) { if(x-o.x==0)return Math.toIntExact(y - o.y); return Math.toIntExact(x - o.x); } } static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null; } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public long[] readLongArray(int n) { long[] x = new long[n]; for (int i = 0; i < n; i++) { x[i] = nextLong(); } return x; } public int[] readIntArray(int n) { int[] x = new int[n]; for (int i = 0; i < n; i++) { x[i] = nextInt(); } return x; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
aa688f432090c91aac8cac224f0c495a
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class temp { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int col = sc.nextInt(); String s1 = null; String s2 = null; s1 = sc.next(); s2 = sc.next(); int i=0,j=0; boolean flag = false; boolean[]arr= new boolean[col]; while(i<col && j < col){ if(s1.charAt(i)==s2.charAt(j)){ arr[i] = true; } else if(s1.charAt(i)!=s2.charAt(j)){ if((s1.charAt(i)=='G' && s2.charAt(j)=='B') ||( s1.charAt(i)=='B' && s2.charAt(j)=='G')){ arr[i] = true; } else{ arr[i] = false; } } i++; j++; } for (boolean b : arr) { if (!b) { flag = true; break; } } if(flag) System.out.println("No"); else System.out.println("Yes"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
607b9153f15d5d36ecdaf7b14581af3a
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = br.readLine(); String[] values = line.split(" "); int j = Integer.parseInt(values[0]); String alpha = "abcdefghijklmnopqrstuvwxyz"; while(j>0) { String yo = "YES"; line = br.readLine(); values = line.split(" "); int k = Integer.parseInt(values[0]); line = br.readLine(); String one = line; line = br.readLine(); String two = line; for(int i = 0; i<one.length(); i++) { if(one.charAt(i)=='B'&&two.charAt(i)=='G') { continue; } if(one.charAt(i)=='G'&&two.charAt(i)=='B') { continue; } if(one.charAt(i)=='R'&&two.charAt(i)=='R') { continue; } if(one.charAt(i)=='G'&&two.charAt(i)=='G') { continue; } if(one.charAt(i)=='B'&&two.charAt(i)=='B') { continue; } else{ yo = "NO"; } } System.out.println(yo); j--; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
6a9425ea8fbc1c2a52d90eed43ce8f82
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args){ Scanner scn = new Scanner(System.in); int T = scn.nextInt(); while(T-->0){ int n = scn.nextInt(); scn.nextLine(); String str1 = scn.nextLine(); String str2 = scn.nextLine(); int c1 = 0, c2 = 0, c3 = 0, c4 = 0; boolean colored = true; for(int i=0; i<n; i++){ char ch1 = str1.charAt(i); char ch2 = str2.charAt(i); if(ch1=='R' && ch2!='R'){ colored = false; break; }else if(ch1!='R' && ch2=='R'){ colored = false; break; } } if(colored==true) System.out.println("Yes"); else System.out.println("No"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
c143be52f33c707e0c129a852828228c
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class codeForce4 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); while(t-->0) { int n = s.nextInt(); String st1 =s.next(); String st2 = s.next(); boolean b1 = false; boolean b2 = false; for(int i = 0; i<st1.length(); i++) { if(st1.charAt(i)=='R'&& (st2.charAt(i)=='B'||st2.charAt(i)=='G')) b1 = true; } for(int i = 0; i<st2.length(); i++) { if(st2.charAt(i)=='R'&& (st1.charAt(i)=='B'||st1.charAt(i)=='G')) b2 = true; } if(b1==true || b2 == true) { System.out.println("NO"); }else { System.out.println("YES"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
e61f8264c765c7ea7818c87e8594bc19
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; /** * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools * * To modify the template, go to Preferences -> Editor -> File and Code Templates -> Other */ public class Main { public static void main(String[] args) { // Write your solution here Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int columns = sc.nextInt(); sc.nextLine(); String firstRow = sc.nextLine(); String secRow = sc.nextLine(); checkIfSame(columns,firstRow,secRow); } } private static void checkIfSame(int columns, String firstRow, String secRow) { int BG = 0; int R = 0; for(int i = 0; i < columns;i++){ switch(firstRow.charAt(i)){ case 'B': case 'G': BG++; break; case 'R': R++; break; } switch(secRow.charAt(i)){ case 'B': case 'G': BG--; break; case 'R': R--; break; } if(BG!=0 && R!=0){ System.out.println("NO"); return; } } System.out.println("YES"); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
c03f452f59881b8fd2a23e9cdee13246
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; /** * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools * * To modify the template, go to Preferences -> Editor -> File and Code Templates -> Other */ public class Main { public static void main(String[] args) { // Write your solution here Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int columns = sc.nextInt(); sc.nextLine(); String firstRow = sc.nextLine(); String secRow = sc.nextLine(); checkIfSame(columns,firstRow,secRow); } } private static void checkIfSame(int columns, String firstRow, String secRow) { boolean isSame = false; for(int i = 0; i < columns;i++){ if(firstRow.charAt(i) == secRow.charAt(i)){ //perfectly Same isSame = true; }else if(firstRow.charAt(i)=='B' && secRow.charAt(i)=='G'){ //Hybrid same isSame = true; } else if(firstRow.charAt(i)=='G' && secRow.charAt(i)=='B'){ //Hybrid same isSame = true; } else{ //not Same isSame = false; break; } } if(isSame){ System.out.println("YES"); }else{ System.out.println("NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
88afba587b46c6b6f51797d927a2bdee
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class code4 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); while(t-- > 0) { int n = input.nextInt(); int c = 0; int c1 = 0; String s = input.next(); String s1 = input.next(); for (int i = 0; i < n; i++) { if(s.charAt(i) != s1.charAt(i)){ if(s.charAt(i) == 'G' && s1.charAt(i) == 'B'){ c = 0; } else if(s1.charAt(i) == 'G' && s.charAt(i) == 'B'){ c = 0; } else { c = -1; break; } } } if(c == 0){ System.out.println("YES"); }else{ System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
fa11b8462df6e189abb13fd4438d41f0
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.System.out; import java.util.*; import java.io.*; import java.math.*; public class Solution{ public static void main(String [] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int n = sc.nextInt(); String a = sc.next(); String b = sc.next(); char [] ref = a.toCharArray(); char [] ref2 = b.toCharArray(); boolean flag = true; for(int i=0;i<n;i++){ if((ref[i]=='R' && ref2[i]=='G') || (ref[i]=='R' && ref2[i]=='B') || (ref[i]=='G' && ref2[i]=='R') || (ref[i]=='B' && ref2[i]=='R')){ flag=false; break; } } if(!flag) System.out.println("NO"); else System.out.println("YES"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
c134b7d367437e58822dd4b47dff78f5
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
/* * problem link : */ import java.io.*; import java.util.HashMap; public class temp{ public static String helper(String s1,String s2){ for(int i=0;i<s1.length();i++){ char c1 = s1.charAt(i); char c2 = s2.charAt(i); if(c1==c2) continue; else if((c1=='B' && c2=='G') || (c1=='G' && c2=='B')) continue; else return "NO"; } return("YES"); } public static void main(String[] args) throws IOException{ //VScode // BufferedReader br = new BufferedReader(new FileReader("input.txt")); // PrintWriter bw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt"))); //Normal BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); /* --------------------------X----------------------------------------X------------------------------------ Your code STARTS here */ int t = Integer.parseInt(br.readLine()); while(t-- > 0){ int n = Integer.parseInt(br.readLine()); String s1 = br.readLine(); String s2 = br.readLine(); bw.write(helper(s1,s2)+"\n"); } /* --------------------------X----------------------------------------X------------------------------------ Your code ENDS here */ bw.flush(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
12405ec0dd95c307dfc95be827f13144
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
//package MyPackage; import java.io.*; import java.util.*; public class C { static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader(){ br=new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(st==null || !st.hasMoreTokens()){ try { st=new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt(){ return Integer.parseInt(next()); } long nextLong(){ return Long.parseLong(next()); } double nextDouble(){ return Double.parseDouble(next()); } String nextLine(){ String str=""; try { str=br.readLine().trim(); } catch (Exception e) { e.printStackTrace(); } return str; } } static class FastWriter { private final BufferedWriter bw; public FastWriter() { this.bw = new BufferedWriter(new OutputStreamWriter(System.out)); } public void print(Object object) throws IOException { bw.append("" + object); } public void println(Object object) throws IOException { print(object); bw.append("\n"); } public void close() throws IOException { bw.close(); } } private static int dfs(int s, List<List<Integer>> adj, Integer dp[], boolean vis[]) { if(dp[s] != null) return dp[s]; int dis = 0; for(int nbr: adj.get(s)) { if(!vis[nbr]) { vis[nbr] = true; dis = 1 + dfs(nbr, adj, dp, vis); } } return dp[s] = dis; } public static int[] solve(int N, int Q, int[][] Edge, int[][] query) { List<List<Integer>> adj = new ArrayList<>(); for(int i = 0; i < N; i++) adj.add(new ArrayList<>()); for(int a[]: Edge) { adj.get(a[0]).add(a[1]); adj.get(a[1]).add(a[0]); } int ans[] = new int[Q]; int j = 0; Integer dp[] = new Integer[N]; for(int a[]: query) { int u = a[0]; int v = a[1]; adj.get(u).remove(Integer.valueOf(v)); adj.get(v).remove(Integer.valueOf(u)); boolean vis[] = new boolean[N]; vis[0] = true; ans[j] = dfs(0, adj, dp, vis); j++; adj.get(u).add(v); adj.get(v).add(u); } return ans; } static int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } public static void main(String[] args) { try { FastReader in=new FastReader(); FastWriter out = new FastWriter(); StringBuilder sb = new StringBuilder(); int testCases=in.nextInt(); while(testCases-- > 0){ int n = in.nextInt(); String f = in.next(); String s = in.next(); for(int i = 0; i < n; i++) { if(f.charAt(i) == 'G') { String sub = f.substring(0, i); String sub2 = f.substring(i + 1); f = sub + 'B' + sub2; } if(s.charAt(i) == 'G') { String sub = s.substring(0, i); String sub2 = s.substring(i + 1); s = sub + 'B' + sub2; } } // System.out.println(f + " " + s); if(f.equals(s)) sb.append("YES\n"); else sb.append("NO\n"); } out.println(sb); out.close(); } catch (Exception e) { System.out.println(e); return; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
fcba3bca33476a78b0e4a0b2596f4eff
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Prob1722B { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } public static void main(String[] args) { FastReader s = new FastReader(); int t= s.nextInt(); for (int i =0;i<t;i++){ int n =s.nextInt(); String s1 = s.nextLine(); String s2 = s.nextLine(); s1 = s1.replace('G','B'); s2 = s2.replace('G','B'); if (s1.equals(s2)) System.out.println("YES"); else System.out.println("NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
6823d3634f9fde50042a09b7e11ea8d5
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int c=sc.nextInt(); String s1=sc.next(); String s2=sc.next(); char[] a=s1.toCharArray(); char[] b=s2.toCharArray(); for(int i=0;i<c;i++) { if(a[i]=='G') a[i]='B'; if(b[i]=='G') b[i]='B'; } if(Arrays.equals(a,b)) System.out.println("YES"); else System.out.println("NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
bb39386c006cad982b5c5debd00c5795
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class ProblemB { public static void main(String[] args) { // TODO Auto-generated method stub Scanner obj=new Scanner(System.in); int t=obj.nextInt(); for(int i=0;i<t;i++) { int n=obj.nextInt(); obj.nextLine(); char ch[][]=new char[2][n]; for(int j=0;j<2;j++) { String str=obj.nextLine(); for(int k=0;k<n;k++) { ch[j][k]=str.charAt(k); if(ch[j][k]=='G') { ch[j][k]='B'; } } } int flag=0; for(int k=0;k<n;k++) { if(ch[0][k]!=ch[1][k]) { System.out.println("No"); flag=1; break; } } if(flag==0) { System.out.println("Yes"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
6add739b2dbf1ab924d5383dad02f558
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; /** * * @author Vattikuti Rajesh */ public class Solution{ public static void main(String r[]){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); String str1=sc.next(); String str2=sc.next(); //r-0 b-1 g-2 int flag=0; for(int i=0;i<n;i++){ if(str1.charAt(i)!=str2.charAt(i)&&(str1.charAt(i)=='R'||str2.charAt(i)=='R')){ System.out.println("NO"); flag=1; break; } } if(flag==0) System.out.println("YES"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
37d6069640b2dd30d4004ef3b0e398b0
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Main { static Scanner input = new Scanner(System.in); public static void main(String[] args) { int t = input.nextInt(); for (int i = 0; i < t; i++) { int n = input.nextInt(); input.nextLine(); String s1 = input.nextLine(); String s2 = input.nextLine(); int m = -1; for (int j =0;j<n;j++){ if (s1.charAt(j) == s2.charAt(j) || (s1.charAt(j) == 'G' && s2.charAt(j) == 'B')|| (s2.charAt(j) == 'G' && s1.charAt(j) == 'B')){ m = j; }else{ System.out.println("NO"); break; } } if (m == n-1){ System.out.println("YES"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
533f82acf2e28439658d35fd8eb3a619
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } public static void main(String[] args) { FastReader in = new FastReader(); int t = in.nextInt(); while(t!=0){ int n=in.nextInt(); String a=in.nextLine(); String b=in.nextLine(); boolean flag=true; // for(int i=0;i<n;i++){a[i]= in.next().charAt(0);} // for(int i=0;i<n;i++){b[i]=in.next().charAt(0);} for(int i=0;i<n;i++){ if(a.charAt(i)!=b.charAt(i)){ if(a.charAt(i)=='B'&&b.charAt(i)=='G'||a.charAt(i)=='G'&&b.charAt(i)=='B'){continue;} else{ System.out.println("NO") ;flag=false;break; }} } if(flag==true){System.out.println("YES");} t--; } }}
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
0a1c8e0fe15743c37ffd487cc382d509
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class New { public static void main (String[] args) throws java.lang.Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int testCases = Integer.parseInt(br.readLine()); while(testCases-->0){ int n = Integer.parseInt(br.readLine()); String a = br.readLine(); String b = br.readLine(); boolean found = true; for(int i=0;i<n;i++) { if(a.charAt(i)=='R' && b.charAt(i)=='R') continue; else if(a.charAt(i)=='R' || b.charAt(i)=='R') { found = false; break; } } if(found) out.println("Yes"); else out.println("No"); } out.close(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
eb5944baa392ce95310ffac0c8de505b
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class sol { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); for(int i =0; i < n;i++) { int col = scanner.nextInt(); String a1 = scanner.next(); String a2 = scanner.next(); int count =0; for(int j = 0; j < col;j++) { if(a1.charAt(j) == a2.charAt(j) || (a1.charAt(j) == 'G' && a2.charAt(j) == 'B') ||(a2.charAt(j) == 'G' && a1.charAt(j) == 'B')) { count++; } } if(count == col) { System.out.println("YES"); } else { System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
50ff529446ea298a186c4d443b2dc510
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class cf817A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int k = 0; k < t; k++) { int n=sc.nextInt(); String s1=sc.next(); String s2=sc.next(); char[]ch1=new char[n]; char[]ch2=new char[n]; ch1=s1.toCharArray(); ch2=s2.toCharArray(); for(int i=0;i<ch1.length;i++){ if(ch1[i]=='G'){ ch1[i]='B'; } if(ch2[i]=='G'){ ch2[i]='B'; } } int count=0; for(int i=0;i<ch1.length;i++){ if(ch1[i]==ch2[i]){ count++; } } if(count==n){ System.out.println("YES"); } else{ System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
d28b5da29c4c25b7f7128da54bff061a
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; import java.util.*; public class MyPractise3 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ boolean status=false; int n=sc.nextInt(); String str1=sc.next(); String str2=sc.next(); int count=0; for(int i=0;i<n;i++){ if(str1.charAt(i)==str2.charAt(i)) count++; else if((str1.charAt(i)=='G'&&str2.charAt(i)=='B')||(str1.charAt(i)=='B'&&str2.charAt(i)=='G')) count++; } if(count==n) System.out.println("YES"); else System.out.println("NO"); } }}
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
2a24d5c287ac711384879835b6bcb7b9
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class hello { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int T = scn.nextInt(); while(T-- > 0){ int n = scn.nextInt(); String p = scn.next(); String q = scn.next(); boolean flag = true; for(int i = 0;i<p.length();i++){ char ch = p.charAt(i); char ph = q.charAt(i); if(ch != ph){ if(ch == 'G' && ph == 'B'){ } else if(ch == 'B' && ph == 'G'){ } else{ flag = false; break; } } if(flag == false){ break; } } if(flag){ System.out.println("YES"); } else{ System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
46b817d76e9b59c702e228894db381b5
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class B_Colourblindness { public static void main(String[] args) { try { FastReader s = new FastReader(); int t = s.nextInt(); while (t-- > 0) { int n = s.nextInt(); String x = s.nextLine(); String y = s.nextLine(); boolean flag=false; outer: for(int i=0;i<n;i++) { char a=x.charAt(i); char b= y.charAt(i); if(a==b || (a=='B'&&b=='G') || (a=='G'&&b=='B') ) { flag=true; continue; } else{ flag=false; System.out.println("NO"); break outer; } } if(flag) { System.out.println("YES"); } } } catch (Exception e) { return; } } static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } int[] readArray(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); return a; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
e2026ac90c9ff777df8eca14c302360f
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class problem2 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while (t-- > 0) { int n = scanner.nextInt(); String s1 = scanner.next(); String s2 = scanner.next(); char a1[] = s1.toCharArray(); char a2[] = s2.toCharArray(); boolean ans = false; for (int i = 0; i < n; i++) { if(a1[i] == a2[i] || a1[i] == 'G' && a2[i] == 'B' || a1[i] == 'B' && a2[i] == 'G') { ans = true; } else { ans = false; break; } } if(ans) { System.out.println("Yes"); } else { System.out.println("No"); } } scanner.close(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
574f29bed95a0dc44d7979ea7d63bf3b
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
/* KEEP CALM AND जय श्री राम * A B C are easy just dont give up , you can do it! * FIRST AND VERY IMP -> READ AND UNDERSTAND THE QUESTION VERY CAREFULLY. * WARNING -> DON'T CODE BULLSHIT , ALWAYS CHECK THE LOGIC ON MULTIPLE TESTCASES AND EDGECASES BEFORE. * SECOND -> TRY TO FIND RELEVENT PATTERN SMARTLY. * WARNING -> IF YOU THINK YOUR SOLUION IS JUST DUMB DONT SUBMIT IT BEFORE RECHECKING ON YOUR END. try try till you die; :):):) */ import java.util.*; import java.io.*; import java.util.stream.*; import java.util.Scanner; import java.math.BigInteger; public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); while(t-- > 0){ int n = scn.nextInt(); String a = scn.next(); String b = scn.next(); int p = 0; solve(n , a, b); } } public static void solve(int n , String a , String b){ for(int i = 0 ; i < n ; i++ ){ char k = a.charAt(i); char k2 = b.charAt(i); if(k != k2){ if(k == 'B' && k2 == 'G'){ if(i == a.length()-1){ printY(); } } else if(k == 'G' && k2 == 'B'){ if(i == a.length()-1){ printY(); } } else if(k=='R' || k2 == 'R'){ printN(); return; }else{ printN(); return; } }else{ if(i == a.length()-1){ printY(); } } } } public static int name(int n){ if(n < 1){ return 0; } return n + name(n-1); } public static void answer(int[] arr , int n){ HashMap<Integer , Integer> map = new HashMap<>(); for(int i = 0 ; i < arr.length ; i++){ int k = arr[i]; if(map.containsKey(k)){ map.put(k , map.get(k)+1); }else{ map.put(k , 1); } } boolean sabn = true; for(int key : map.keySet()){ if(key >= 0){ sabn = false; } } if(sabn = true){ int sum = 0; for(int i : arr){ sum += i; } System.out.println(sum*-1); return; } System.out.println(arr.length); } // int ko char array m karne ke lia char[] arr = (n+"").toCharArray(); likhneka public static <K, V> K getKey(Map<K, V> map, V value) { for (Map.Entry<K, V> entry : map.entrySet()) { if (value.equals(entry.getValue())) { return entry.getKey(); } } return null; } public static void printArray(int[] arr) { for (int i = 0 ; i < arr.length ; i++) { System.out.print(arr[i] + " "); } System.out.println(); } public static void swap(int[] arr) { for (int i = 0 ; i < arr.length ; i = i + 2) { int temp = arr[i]; arr[i] = arr[i + 1]; arr[i + 1] = temp; } } public static boolean isPrime(int n) { // Corner cases if (n <= 1) return false; if (n <= 3) return true; // This is checked so that we can skip // middle five numbers in below loop if (n % 2 == 0 || n % 3 == 0) return false; for (int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; } public static boolean completez(String str) { boolean ans = true; for (int i = 0 ; i < str.length() ; i++) { char ch = str.charAt(i); if (ch != '0') { ans = false; break; } } return ans; } public static void block(long x, int cc ) { // int cc == 0; ArrayList<Integer> v = new ArrayList<Integer>(); // Convert decimal number to // its binary equivalent // System.out.print("Blocks for " + x + " : "); while (x > 0) { v.add((int)x % 2); x = x / 2; } // Displaying the output when // the bit is '1' in binary // equivalent of number. for (int i = 0; i < v.size(); i++) { if (v.get(i) == 1) { cc++; } } System.out.println(cc - 1); } static int highestPowerof2(int n) { int res = 0; for (int i = n; i >= 1; i--) { if ((i & (i - 1)) == 0) { res = i; break; } } return res; } public static int count(int[] arr, int k) { int cc = 0; for (int i = 0 ; i < arr.length ; i++ ) { if (arr[i] == k) { cc++; } } return cc; } public static long integerfrmbinary(String str) { long j = 0; for (int i = 0; i < str.length(); i++) { if (str.charAt(i) == '1') { j = j + (long)Math.pow(2, str.length() - 1 - i); } } return (long) j; } // static long binaryToDecimal(long n) // { // long num = n; // long dec_value = 0; // long base = 1; // long temp = num; // while (temp > 0) { // long last_digit = (long)temp % 10; // temp = (long)temp / 10; // dec_value += (long)last_digit * base; // base = (long)base * 2; // } // return (long)dec_value; // } // public static boolean distinct(int kk) { // int arr[] = Integer.toString(num).chars().map(c->c - '0').toArray(); // int size = arr.length; // HashSet<Integer>hs = new HashSet<>(); // for (int i = 0; i < arr.length; i++) { // hs.add(arr[i]); // } // if (hs.size() == size)return true; // else return false; // } static int maxInArray(int[] arr) { int max = arr[0]; for (int i = 0 ; i < arr.length ; i++) { if (arr[i] > max) { max = arr[i]; } } return max; } static boolean f2(HashMap<Integer, Integer> map) { int val = 0; for (int vale : map.values()) { if (vale > 1) { return false; } } return true; } static boolean find(int[] arr, int k, int j) { for (int i = j + 1 ; i < arr.length ; i++) { if (arr[i] == k) { return true; } } return false; } static void printN() { System.out.println("NO"); } static void printY() { System.out.println("YES"); } static int findfrequencies(int a[], int n) { int count = 0; for (int i = 0; i < a.length; i++) { if (a[i] == n) { count++; } } return count; } static long big( long a, long b) { return (a + b - 1) / b; } static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } float nextFloat() { return Float.parseFloat(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } int[] readArray(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); return a; } long[] readArrayLong(int n) { long[] a = new long[n]; for (int i = 0; i < n; i++) a[i] = nextLong(); return a; } } public static int[] radixSort2(int[] a) { int n = a.length; int[] c0 = new int[0x101]; int[] c1 = new int[0x101]; int[] c2 = new int[0x101]; int[] c3 = new int[0x101]; for (int v : a) { c0[(v & 0xff) + 1]++; c1[(v >>> 8 & 0xff) + 1]++; c2[(v >>> 16 & 0xff) + 1]++; c3[(v >>> 24 ^ 0x80) + 1]++; } for (int i = 0; i < 0xff; i++) { c0[i + 1] += c0[i]; c1[i + 1] += c1[i]; c2[i + 1] += c2[i]; c3[i + 1] += c3[i]; } int[] t = new int[n]; for (int v : a)t[c0[v & 0xff]++] = v; for (int v : t)a[c1[v >>> 8 & 0xff]++] = v; for (int v : a)t[c2[v >>> 16 & 0xff]++] = v; for (int v : t)a[c3[v >>> 24 ^ 0x80]++] = v; return a; } static int[] EvenOddArragement(int nums[]) { int i1 = 0, i2 = nums.length - 1; while (i1 < i2) { while (nums[i1] % 2 == 0 && i1 < i2) { i1++; } while (nums[i2] % 2 != 0 && i2 > i1) { i2--; } int temp = nums[i1]; nums[i1] = nums[i2]; nums[i2] = temp; } return nums; } static int gcd(int a, int b) { while (b != 0) { int t = a; a = b; b = t % b; } return a; } static int lcm(int a, int b) { return (a / gcd(a, b)) * b; } public static HashMap<Integer, Integer> sortByValue(HashMap<Integer, Integer> hm) { // Create a list from elements of HashMap List<Map.Entry<Integer, Integer> > list = new LinkedList<Map.Entry<Integer, Integer> >(hm.entrySet()); // Sort the list Collections.sort(list, new Comparator<Map.Entry<Integer, Integer> >() { public int compare(Map.Entry<Integer, Integer> o1, Map.Entry<Integer, Integer> o2) { return (o1.getValue()).compareTo(o2.getValue()); } }); // put data from sorted list to hashmap HashMap<Integer, Integer> temp = new LinkedHashMap<Integer, Integer>(); for (Map.Entry<Integer, Integer> aa : list) { temp.put(aa.getKey(), aa.getValue()); } return temp; } static int DigitSum(int n) { int r = 0, sum = 0; while (n >= 0) { r = n % 10; sum = sum + r; n = n / 10; } return sum; } static boolean checkPerfectSquare(int number) { double sqrt = Math.sqrt(number); return ((sqrt - Math.floor(sqrt)) == 0); } static boolean isPowerOfTwo(int n) { if (n == 0) return false; return (int)(Math.ceil((Math.log(n) / Math.log(2)))) == (int)(Math.floor(((Math.log(n) / Math.log(2))))); } static boolean isPrime2(int n) { if (n <= 1) { return false; } if (n == 2) { return true; } if (n % 2 == 0) { return false; } for (int i = 3; i <= Math.sqrt(n) + 1; i = i + 2) { if (n % i == 0) { return false; } } return true; } static String minLexRotation(String str) { int n = str.length(); String arr[] = new String[n]; String concat = str + str; for (int i = 0; i < n; i++) { arr[i] = concat.substring(i, i + n); } Arrays.sort(arr); return arr[0]; } static String maxLexRotation(String str) { int n = str.length(); String arr[] = new String[n]; String concat = str + str; for (int i = 0; i < n; i++) { arr[i] = concat.substring(i, i + n); } Arrays.sort(arr); return arr[arr.length - 1]; } static class P implements Comparable<P> { int i, j; public P(int i, int j) { this.i = i; this.j = j; } public int compareTo(P o) { return Integer.compare(i, o.i); } } static class pair { int i, j; pair(int x, int y) { i = x; j = y; } } static int binary_search(int a[], int value) { int start = 0; int end = a.length - 1; int mid = start + (end - start) / 2; while (start <= end) { if (a[mid] == value) { return mid; } if (a[mid] > value) { end = mid - 1; } else { start = mid + 1; } mid = start + (end - start) / 2; } return -1; } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
e625304587289ae4bec75b40fca03215
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); String str1=sc.next(); String str2=sc.next(); str1= str1.replaceAll("B","G"); str2= str2.replaceAll("B","G"); if(str1.equals(str2)) System.out.println("YES"); else System.out.println("NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
7815c6bdcb2f2d8dc20032fc316af6b2
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { if(st.hasMoreTokens()){ str = st.nextToken("\n"); } else{ str = br.readLine(); } } catch (IOException e) { e.printStackTrace(); } return str; } } public static void main (String[] args) throws java.lang.Exception { FastReader scn = new FastReader(); int t =scn.nextInt(); while(t-- > 0){ int n = scn.nextInt(); int flag = 0; String str1 = scn.next(); String str2 = scn.next(); char[] ch1 = str1.toCharArray(); char[] ch2 = str2.toCharArray(); for(int j=0; j<ch1.length; j++){ if(ch1[j] != ch2[j]){ if((ch1[j] == 'G' && ch2[j] == 'B') || ch1[j] == 'B' && ch2[j] == 'G') continue; else{ flag = 1; } } } System.out.println(flag == 0 ? "YES" : "NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
9205fc3e6da664876896a9c8aaac3254
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class twoQ { public static void main(String[] args) { Scanner sc =new Scanner(System.in); int t=sc.nextInt(); while(t--!=0) { int n=sc.nextInt(); sc.nextLine(); String s1=sc.nextLine(); String s2=sc.nextLine(); int i=0; int j=0; boolean flag=true; while(i<n) { if(s1.charAt(i)==s2.charAt(j)) { i++; j++; }else if((s1.charAt(i)=='G' && s2.charAt(j)=='B')||(s1.charAt(i)=='B' && s2.charAt(j)=='G')) { i++; j++; }else { flag=false; break; } } System.out.println(flag==true? "YES":"NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
992bce6b7edc8bfc2f78bdfd6cfd09d9
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class solution{ public static void main(String ar[]){ Scanner s = new Scanner(System.in); int t=s.nextInt(); while(t>0){ int n=s.nextInt(),f=0; String s1=s.next(); String s2=s.next(); for(int i=0;i<n;i++){ if((s1.charAt(i)=='R' && s2.charAt(i)!='R') || (s2.charAt(i)=='R' && s1.charAt(i)!='R')) { f=1; break; } } if(f==0){ System.out.println("Yes"); } else{ System.out.println("NO"); } t--; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
726b742a23dc68a8250a08fbf9a4afbf
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
//package com.company.Array; import java.util.*; import java.lang.*; import java.io.*; public class Codechef { // static Scanner sc = new Scanner(System.in); static FastReader in =new FastReader(); static final Random random=new Random(); static long mod=1000000007L; static HashMap<String,Integer>mp=new HashMap<>(); static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } int [] readIntArray(int n) { int res [] = new int [n]; for(int i = 0; i<n; i++) res[i] = nextInt(); return res; } long [] readLongArray(int n) { long res [] = new long [n]; for(int i = 0; i<n; i++)res[i] = nextLong(); return res; } } public static void main (String[] args) throws java.lang.Exception { int test = in.nextInt(); while (test-->0){ int n = in.nextInt(); String s = in.nextLine(); String str = in.nextLine(); int fl =0; for(int i =0;i<n;i++){ if(s.charAt(i)==str.charAt(i) || (s.charAt(i)=='B' && str.charAt(i)=='G') || (s.charAt(i)=='G' && str.charAt(i)=='B') ){ fl++; } } if(fl==n){ System.out.println("YES"); }else{ System.out.println("NO"); } } } static int max(int a, int b) { if(a<b) return b; return a; } static int abs(int a) { if(a<0) return -1*a; return a; } static < E > void print(E res) { System.out.println(res); } static void count(String str1, String str2) { int c = 0, j = 0; for (int i = 0; i < str1.length(); i++) { if (str2.indexOf(str1.charAt(i)) >= 0) { c += 1; } } System.out.println("No. of matching characters are: " + c); } static int findGCD(int a, int b) { if (b == 0) return a; return findGCD(b, a % b); } static int findLcm(int x, int y) { return (x / findGCD(x, y)) * y; } static Long factorial(Long n) { if (n == 0) return (long)1; return n * factorial(n - 1); } static void LargestSum(int [] arr){ int max =0; int sum =0; for(int i =0;i<arr.length;i++){ sum =sum+arr[i]; max = Math.max(max,sum); if(sum<0){ sum=0; } } System.out.println(max); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
145611b3d4dbd1e8bf222092f5864ffb
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class B_Colourblindness { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- != 0) { int n = sc.nextInt(); int c1r = 0, c2r = 0, c1b = 0, c2b = 0; String str1 = sc.next(); String str2 = sc.next(); boolean flag = true; for (int i = 0; i < n; i++) { if (str1.charAt(i) == 'R' && str2.charAt(i) != 'R' || str2.charAt(i) == 'R' && str1.charAt(i) != 'R') { flag = false; break; } } if (flag) System.out.println("YES"); else System.out.println("NO"); } sc.close(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
ca6fb506e216172bd915e75f7791d91e
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.*; import java.util.*; public class Main { static Reader r = new Reader(); static StringBuilder sb = new StringBuilder(); static int[] cnt; public static void main(String args[]) throws IOException { int t = r.readInt(); while(t-->0){ solve(); } System.out.println(sb); } static void solve() throws IOException{ int n = r.readInt(); String s1 = r.readLine(); String s2 = r.readLine(); boolean b = true; for(int i=0;i<n;i++){ if(s1.charAt(i)==s2.charAt(i)) continue; if(s1.charAt(i)=='R' || s2.charAt(i)=='R'){ b = false; break; } } sb.append(b ? "YES\n" : "NO\n"); } } class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String readLine() throws IOException { byte[] buf = new byte[10000]; // line length int cnt = 0, c; while((c=read())!=-1){ if(c=='\n'){ if(cnt!=0) break; else continue; } buf[cnt++] = (byte)c; } return new String(buf, 0, cnt); } public int readInt() throws IOException { int ret = 0; byte c = read(); while(c <= ' '){ c = read();} boolean neg = (c == '-'); if(neg) c = read(); do{ ret = (ret<<3) + (ret<<1) + c - '0'; } while ((c = read()) >= '0' && c <= '9'); return neg ? -ret : ret; } public long readLong() throws IOException { long ret = 0; byte c = read(); while(c <= ' '){ c = read();} boolean neg = (c == '-'); if(neg) c = read(); do{ ret = (ret<<3) + (ret<<1) + c - '0'; } while ((c = read()) >= '0' && c <= '9'); return neg ? -ret : ret; } private void fillBuffer() throws IOException { bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); if(bytesRead == -1) buffer[0] = -1; } private byte read() throws IOException { if(bufferPointer == bytesRead) fillBuffer(); return buffer[bufferPointer++]; } public void close() throws IOException { if(din==null) return; din.close(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
6aff1de8de786e8a1c2985708caf0ca0
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { static InputStream is; static PrintWriter out; static String INPUT = ""; static final int ima = Integer.MAX_VALUE, imi = Integer.MIN_VALUE; static final long lma = Long.MAX_VALUE, lmi = Long.MIN_VALUE; static final long mod = (long) 1e9 + 7; static void solve() { int caseNo = 1; for (int T = sc.nextInt(); T > 1; T--, caseNo++) { solveIt(caseNo); } solveIt(caseNo); } // Solution static void solveIt(int testCaseNo) { int n = sc.nextInt(); String s = sc.next(); String t = sc.next(); for (int i = 0; i < n; i++) { if (s.charAt(i) == 'R' && t.charAt(i) != 'R') { System.out.println("NO"); return; } if (t.charAt(i) == 'R' && s.charAt(i) != 'R') { System.out.println("NO"); return; } } System.out.println("YES"); } public static void main(String[] args) throws Exception { long S = System.currentTimeMillis(); is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); out = new PrintWriter(System.out); solve(); out.flush(); long G = System.currentTimeMillis(); sc.tr(G - S + "ms"); } static class sc { private static boolean endOfFile() { if (bufferLength == -1) return true; int lptr = ptrbuf; while (lptr < bufferLength) { if (!isThisTheSpaceCharacter(inputBufffferBigBoi[lptr++])) return false; } try { is.mark(1000); while (true) { int b = is.read(); if (b == -1) { is.reset(); return true; } else if (!isThisTheSpaceCharacter(b)) { is.reset(); return false; } } } catch (IOException e) { return true; } } private static byte[] inputBufffferBigBoi = new byte[1024]; static int bufferLength = 0, ptrbuf = 0; private static int justReadTheByte() { if (bufferLength == -1) throw new InputMismatchException(); if (ptrbuf >= bufferLength) { ptrbuf = 0; try { bufferLength = is.read(inputBufffferBigBoi); } catch (IOException e) { throw new InputMismatchException(); } if (bufferLength <= 0) return -1; } return inputBufffferBigBoi[ptrbuf++]; } private static boolean isThisTheSpaceCharacter(int c) { return !(c >= 33 && c <= 126); } private static int skipItBishhhhhhh() { int b; while ((b = justReadTheByte()) != -1 && isThisTheSpaceCharacter(b)); return b; } private static double nextDouble() { return Double.parseDouble(next()); } private static char nextChar() { return (char) skipItBishhhhhhh(); } private static String next() { int b = skipItBishhhhhhh(); StringBuilder sb = new StringBuilder(); while (!(isThisTheSpaceCharacter(b))) { sb.appendCodePoint(b); b = justReadTheByte(); } return sb.toString(); } private static char[] readCharArray(int n) { char[] buf = new char[n]; int b = skipItBishhhhhhh(), p = 0; while (p < n && !(isThisTheSpaceCharacter(b))) { buf[p++] = (char) b; b = justReadTheByte(); } return n == p ? buf : Arrays.copyOf(buf, p); } private static char[][] readCharMatrix(int n, int m) { char[][] map = new char[n][]; for (int i = 0; i < n; i++) map[i] = readCharArray(m); return map; } private static int[] readIntArray(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); return a; } private static long[] readLongArray(int n) { long[] a = new long[n]; for (int i = 0; i < n; i++) a[i] = nextLong(); return a; } private static int nextInt() { int num = 0, b; boolean minus = false; while ((b = justReadTheByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')); if (b == '-') { minus = true; b = justReadTheByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = justReadTheByte(); } } private static long nextLong() { long num = 0; int b; boolean minus = false; while ((b = justReadTheByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')); if (b == '-') { minus = true; b = justReadTheByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = justReadTheByte(); } } private static void tr(Object... o) { if (INPUT.length() != 0) System.out.println(Arrays.deepToString(o)); } } } // And I wish you could sing along, But this song is a joke, and the melody I // wrote, wrong
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
e4ab5ed835669b7e5f99400262304d4e
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
/*package whatever //do not write package name here */ import java.util.Scanner; public class code{ public static void main(String args[]){ Scanner s = new Scanner(System.in); int t = s.nextInt(); while(t-->0){ int n = s.nextInt(); String str1 = s.next(); String str2 = s.next(); if(str1.equals(str2)==true){ System.out.println("YES"); }else{ String str3 = ""; //change all green to blue for(int i = 0;i<n;i++){ if(str1.charAt(i)=='G'){ str3+="B"; }else{ str3+=str1.charAt(i); } } String str4 = ""; for(int j = 0;j<n;j++){ if(str2.charAt(j)=='G'){ str4+='B'; }else{ str4+=str2.charAt(j)+""; } } // System.out.println(str3+" "+str4); if(str3.equals(str4)==true){ System.out.println("YES"); }else{ System.out.println("NO"); } } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
8918f920bc7858d082bdb55feb3c755e
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
/* Problem: Verdict: */ import java.util.*; import java.io.*; public class Colourblindness { static void solve()throws IOException{ int n =readInt(); boolean okay = true; String first = next(), second = next(); for (int i = 0; i < n; i++) { if(first.charAt(i)=='R' && (second.charAt(i)=='B' || second.charAt(i)=='G'))okay=false; if(second.charAt(i)=='R' && (first.charAt(i)=='B' || first.charAt(i)=='G'))okay=false; } System.out.println(okay ? "YES":"NO"); } public static void main(String[] args) throws IOException { int x = readInt(); for (int i = 0; i < x; i++) { solve(); } } static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); static StringTokenizer st; static String next() throws IOException { while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine().trim()); return st.nextToken(); } static long readLong() throws IOException { return Long.parseLong(next()); } static int readInt() throws IOException { return Integer.parseInt(next()); } static double readDouble() throws IOException { return Double.parseDouble(next()); } static char readCharacter() throws IOException { return next().charAt(0); } static String readLine() throws IOException { return br.readLine().trim(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
0a224208d6ada6ee1b5bb4950984caee
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Problems { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while(t > 0) { int n = in.nextInt(); String s1 = in.next(); String s2 = in.next(); System.out.println(color(s1, s2)?"Yes":"NO"); t--; } } public static boolean color(String s1 , String s2) { for (int i = 0; i < s1.length() && i <s2.length(); i++) { if(s1.charAt(i) != s2.charAt(i)) { if((s1.charAt(i) == 'B' || s1.charAt(i) == 'G') && (s2.charAt(i)=='B'||s2.charAt(i)=='G')) { continue; } else { return false; } } } return true; } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
0746431c252bdcde83eea99546c5c3e4
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
/* "Everything in the universe is balanced. Every disappointment you face in life will be balanced by something good for you! Keep going, never give up." Just have Patience + 1... */ import java.util.*; import java.lang.*; import java.io.*; public class SolutionB { public static void main(String[] args) throws Exception { out = new PrintWriter(new BufferedOutputStream(System.out)); sc = new FastReader(); int test = sc.nextInt(); for (int t = 1; t <= test; t++) { solve(t); } out.close(); } private static void solve(int t) { int n = sc.nextInt(); char[][] arr = new char[2][n]; arr[0] = sc.next().toCharArray(); arr[1] = sc.next().toCharArray(); for (int i = 0; i < n; i++) { if (arr[0][i] == 'R' && arr[1][i] != 'R') { out.println("NO"); return; } if (arr[0][i] != 'R' && arr[1][i] == 'R') { out.println("NO"); return; } } out.println("YES"); } public static FastReader sc; public static PrintWriter out; static class FastReader { BufferedReader br; StringTokenizer str; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (str == null || !str.hasMoreElements()) { try { str = new StringTokenizer(br.readLine()); } catch (IOException lastMonthOfVacation) { lastMonthOfVacation.printStackTrace(); } } return str.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException lastMonthOfVacation) { lastMonthOfVacation.printStackTrace(); } return str; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
7d8d6d7d38019d99b354afdd1476fb02
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Abc { public static void main(String args[]) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for(int p=1;p<=t;p++) { int n = in.nextInt(); String s[] = new String[2]; s[0] = in.next(); s[1] = in.next(); int flag=0; for(int i=0;i<n;i++) { char ch1 = s[0].charAt(i); char ch2 = s[1].charAt(i); if(ch1 != ch2) { if(ch1=='R' || ch2=='R') { flag=1; break; } } } if(flag==1) System.out.println("NO"); else System.out.println("YES"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
87bb9bd164a062eebb078d83d3080a50
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
// "static void main" must be defined in a public class. import java.util.*; public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int shh = scn.nextInt(); for(int h = 0 ; h < shh ; h++){ int n = scn.nextInt(); scn.nextLine(); String str = scn.nextLine(); String s = scn.nextLine(); boolean ans = true; for(int i = 0 ; i < n ; i++){ char ch = str.charAt(i); char c = s.charAt(i); if(ch == 'R' && c != 'R'){ ans = false; break; } if(c == 'R' && ch != 'R'){ ans = false; break; } } if(ans){ System.out.println("YES"); }else{ System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
3dcc2edad514695a16e98ea790380055
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int col; boolean flag = true; for(int i=0;i<t;i++){ col = sc.nextInt(); String[] color = new String[2]; for(int j=0;j<2;j++){ color[j] =sc.next(); } for(int k=0;k<col;k++){ if(color[0].charAt(k) == color[1].charAt(k) || (color[0].charAt(k) == 'G' && color[1].charAt(k) == 'B') || (color[0].charAt(k) == 'B' && color[1].charAt(k) == 'G')){ flag= true; continue; } else { flag=false; System.out.println("NO"); break; } } if(flag) System.out.println("YES"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
3a7de3885765033cb7b41bee73d9a51e
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.*; public class Dalt { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader (new InputStreamReader (System.in)); int numberOfSets = Integer.parseInt(br.readLine()); for (int nos = 0; nos < numberOfSets; nos++) { int size = Integer.parseInt(br.readLine()); char [] c1 = br.readLine().toCharArray(); char [] c2 = br.readLine().toCharArray(); boolean result = true; for (int i = 0; i < size; i++) { if ((c1[i] == 'R'&&c2[i] !='R') || (c2[i] == 'R'&&c1[i] !='R') ) { System.out.println("NO"); result = false; break; } } if (result) {System.out.println("YES");} } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 11
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
361481e705a597f32a62175a263371a6
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; import java.io.*; public class solve{ public static void main(String [] args){ Scanner scan = new Scanner(System.in); int t = scan.nextInt(); int flag = 0; for(int j=1 ; j<=t ; j++){ int n = scan.nextInt(); flag = 0; String s1 = scan.next(); String s2 = scan.next(); for(int i=0 ; i<n ; i++){ if(s1.charAt(i)=='R'){ if(s2.charAt(i)!='R'){ flag = 1; break; } } else if(s2.charAt(i)=='R'){ if(s1.charAt(i)!='R'){ flag=1; break; } } else { flag = 0; } } if(flag==0) System.out.println("YES"); else System.out.println("NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
e32eac17c8c44e3e1c9802a8c6a928d5
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { // write your code here Scanner scan = new Scanner(System.in); int i,n,check=0; int t = Integer.valueOf(scan.nextLine()); while(t>0){ check=0; n = Integer.valueOf(scan.nextLine()); String inp1 = scan.nextLine(); String inp2 = scan.nextLine(); for(i=0;i<n;i++){ if(inp1.charAt(i)==inp2.charAt(i)){ continue; }else if(inp1.charAt(i)=='G' && inp2.charAt(i)=='B'){ continue; }else if(inp1.charAt(i)=='B' && inp2.charAt(i)=='G'){ continue; }else{ check=1; break; } } System.out.println(""); if(check==0){ System.out.println("YES"); }else{ System.out.println("NO"); } t--; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
3f41ab2ec75fcbee7dfecd17d0580749
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); for (int i = 0; i < t; i++) { int n = input.nextInt(); input.nextLine(); String a = input.nextLine(); String b =input.nextLine(); boolean good = true; for (int j = 0; j < n; j++) { char ac = a.charAt(j); char bc = b.charAt(j); //System.out.println(ac+" "+j+" "+bc); if((ac=='R'&&bc=='B')||(ac=='B'&&bc=='R')||(ac=='G'&&bc=='R')||(ac=='R'&&bc=='G')){ good = false; break; } else{ continue; } } if(good) System.out.println("YES"); else System.out.println("NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
4be9ecbc89018dd416af944bf7e7a5ef
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; import java.util.*; public class Main { public static Scanner input = new Scanner(System.in); public static void main(String[] args) { int t = input.nextInt(); int n; boolean b = false; String s1,s2; while(t>0) { n=input.nextInt(); s1 =input.next(); s2 =input.next(); b = false; for (int i = 0; i < n; i++) { switch(s1.charAt(i)) { case 'R': if(s2.charAt(i) != 'R') b = true; break; case 'B': if(!(s2.charAt(i) == 'G'||s2.charAt(i) == 'B')) b = true; break; case 'G': if(!(s2.charAt(i) == 'G'||s2.charAt(i) == 'B')) b = true; break; } if(b) break; } System.out.println((b?"NO":"YES")); t--; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
4ea9de9a057a7d862dbe7963019130f0
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class r { public static void main(String[] args) { Scanner s = new Scanner(System.in); int testcases = s.nextInt(); for (int p = 0; p < testcases; p++) { int limit = s.nextInt(); String word1 = s.next(); char[] list1 = new char[limit]; for (int u = 0; u < list1.length; u++) { list1[u] = word1.charAt(u); } String word2 = s.next(); char[] list2 = new char[limit]; for (int u = 0; u < list2.length; u++) { list2[u] = word2.charAt(u); } int counter = 0; for (int i = 0; i < limit; i++) { if (list1[i] == list2[i] || list1[i] == 'G' && list2[i] == 'B' || list1[i] == 'B' && list2[i] == 'G') { counter++; } } if (counter == limit) System.out.println("YES"); else System.out.println("NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
37f87ec26976764cefe73a1002f3038e
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class solution { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { int n = sc.nextInt(); sc.nextLine(); String s = sc.nextLine(); String k = sc.nextLine(); String y = k.replace('B', 'G'); String z = s.replace('B', 'G'); int m = y.compareTo(z); //System.out.println(m); if (m == 0) System.out.println("YES"); else System.out.println("NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
51fafd0bcd4ef0ea5c0acd72b14be9f6
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashSet; import java.util.Scanner; /** * * @author hamza */ public class JavaApplication14 { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public Reader(String file_name) throws IOException { din = new DataInputStream( new FileInputStream(file_name)); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String readLine() throws IOException { byte[] buf = new byte[64]; // line length int cnt = 0, c; while ((c = read()) != -1) { if (c == '\n') { if (cnt != 0) { break; } else { continue; } } buf[cnt++] = (byte)c; } return new String(buf, 0, cnt); } public int nextInt() throws IOException { int ret = 0; byte c = read(); while (c <= ' ') { c = read(); } boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (neg) return -ret; return ret; } public long nextLong() throws IOException { long ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (neg) return -ret; return ret; } public double nextDouble() throws IOException { double ret = 0, div = 1; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (c == '.') { while ((c = read()) >= '0' && c <= '9') { ret += (c - '0') / (div *= 10); } } if (neg) return -ret; return ret; } private void fillBuffer() throws IOException { bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); if (bytesRead == -1) buffer[0] = -1; } private byte read() throws IOException { if (bufferPointer == bytesRead) fillBuffer(); return buffer[bufferPointer++]; } public void close() throws IOException { if (din == null) return; din.close(); } } public static void main(String[] args) throws IOException { Scanner scan=new Scanner(System.in); int t=scan.nextInt(); PrintWriter pr=new PrintWriter(System.out); while(t-->0){ int col=scan.nextInt(); String s=scan.next(); String s2=scan.next(); boolean flag=true; for(int i=0;i<col;i++) { char c1=s.charAt(i); char c2=s2.charAt(i); if(c1=='R'&&c2=='B'||c1=='R'&&c2=='G') { flag=false; i=col; } if(c1=='B'&&c2=='R'||c1=='G'&&c2=='R') { flag=false; i=col; } } if(flag) pr.append("yes"); else pr.append("no"); pr.append('\n'); } pr.flush(); pr.close(); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
f0490feda3bdbd0f16ee228a2e1e1391
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.*; import java.util.InputMismatchException; public class Colorblindness { public static void main(String[] args)throws Exception{ FastReader f=new FastReader(System.in); int t=f.nextInt(); while (t-->0){ int n=f.nextInt(); char[] firstRow=f.nextString().toCharArray(); char[] secondRow=f.nextString().toCharArray(); boolean isSame=true; for (int i=0;i<n;i++){ if ((firstRow[i]=='R' && secondRow[i]!='R') || (firstRow[i]!='R' && secondRow[i]=='R')){ isSame=false; break; } } System.out.println(isSame?"YES":"NO"); } } } class FastReader { private InputStream stream; private byte[] buf = new byte[8192]; private int curChar; private int pnumChars; private FastReader.SpaceCharFilter filter; public FastReader(InputStream stream) { this.stream = stream; } public int read() { if (pnumChars == -1) { throw new InputMismatchException(); } if (curChar >= pnumChars) { curChar = 0; try { pnumChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (pnumChars <= 0) { return -1; } } return buf[curChar++]; } public String next() { return nextString(); } public int nextInt() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } int res = 0; do { if (c == ',') { c = read(); } if (c < '0' || c > '9') { throw new InputMismatchException(); } res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public double nextDouble() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } double res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public String nextString() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isSpaceChar(c)); return res.toString(); } public String nextLine() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isEndOfLine(c)); return res.toString(); } public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } public boolean isSpaceChar(int c) { if (filter != null) { return filter.isSpaceChar(c); } return isWhitespace(c); } public static boolean isWhitespace(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
f5ce65077476fd2cc4f9102e874785af
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class colourBlindness { public static void main(String arg[]){ Scanner ax=new Scanner(System.in); int t; t=ax.nextInt(); int l[]=new int[t]; String s1[]=new String[t]; String s2[]=new String[t]; for(int i=0;i<t;i++) { l[i]=ax.nextInt(); s1[i]=ax.next(); s2[i]=ax.next(); } for(int i=0;i<t;i++) { checkSame(s1[i],s2[i],l[i]); } } static void checkSame(String s1,String s2,int n){ int flag=1; char t1,t2; for(int i=0;i<n;i++) { t1 = s1.charAt(i); t2 = s2.charAt(i); if (t1 != t2) { if (t1 == 'G' && t2 == 'B') continue; if (t1 == 'B' && t2 == 'G') continue; flag = 0; break; } } System.out.println(flag==1?"YES":"NO"); } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
e0825b7ea1d721af927eda0b2653381d
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class codeforces { public static void main(String[] args) { try { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); String str1=sc.next(); String str2=sc.next(); String str3=str1.replace('B', 'G'); String str4=str2.replace('B', 'G'); if(str3.equals(str4)){ System.out.println("YES"); } else{ System.out.println("NO"); } } } catch (Exception e) { //TODO: handle exception } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
dfdb7bad3f45ed7bfdc173660ef4090d
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class D { public static void main(String args[]) { Scanner sc=new Scanner(System.in); // System.out.println("enter teste case"); int test=sc.nextInt(); for(int i=1;i<=test;i++) { int grid=sc.nextInt(); sc.nextLine(); String s=sc.nextLine(); String s2=sc.nextLine(); String res="NO"; for(int j=0;j<grid;j++) { if(s.charAt(j)==s2.charAt(j)) { res="YES"; } else{ if(((s.charAt(j)=='G')&&(s2.charAt(j)=='B'))||(s.charAt(j)=='B')&&(s2.charAt(j)=='G')) { res="YES"; } else { res="NO"; break; } } } System.out.println(res); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
024b5541129c0d7c49f98c085544bab1
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class acmp { public static void main(String[] args) { Scanner css = new Scanner(System.in); int t = css.nextInt(); for (int i = 0; i < t; i++) { int n = css.nextInt(); int count1 = 0, count1R = 0, count2 = 0, count2R = 0; String a = css.next(); String b = css.next(); String s = ""; for (int j = 0; j < n; j++) { if((a.charAt(j) == b.charAt(j)) || (a.charAt(j) == 'G') && (b.charAt(j) == 'B') || (a.charAt(j) == 'B') && (b.charAt(j) == 'G')){ s = "YES"; continue; }else{ s = "NO"; break; } } System.out.println(s); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
01d88848a64e9ab06c00aa58b1f86fb0
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class main //class pp { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int n = sc.nextInt(); String s1 = sc.next(); String s2 = sc.next(); int count =0; for(int i=0;i<n;i++){ String c1=String.valueOf(s1.charAt(i)); String c2=String.valueOf(s2.charAt(i)); if(c1.equals(c2) || (c1.equals("B") && c2.equals("G") ) || (c1.equals("G") && c2.equals("B") )) count++; } //System.out.println(f1); //System.out.println(f2); if(count==n ) System.out.println("YES"); else System.out.println("NO"); } } //method to check prime static boolean isPrime(long n) { // Corner cases if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; } // method to return gcd of two numbers static long gcd(long a, long b) { if (a == 0) return b; return gcd(b % a, a); } // method to return LCM of two numbers static long lcm(long a, long b) { return (a / gcd(a, b)) * b; } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
5c825ffa4784a400145fd86d0fb29a61
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); String s1=sc.next(); String s2=sc.next(); String s3=s1.replaceAll("G","B"); String s4=s2.replaceAll("G","B"); if(s3.equals(s4)) { System.out.println("YES"); } else { System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
46803ed45b9829e1006d79d311e9cc0a
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Solution { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int n = sc.nextInt(); for (int i = 0; i < n; i++) { int b = sc.nextInt(); String s1 = sc.next(); String s2 = sc.next(); char[] arr1 = s1.toCharArray(); char[] arr2 = s2.toCharArray(); int R = 0; int GB = 0; for (int j = 0; j < arr1.length; j++) { if (arr1[j] == 'R' && arr2[j] != 'R') { R = 1; } if (arr1[j] != 'R' && arr2[j] == 'R'){ R = 1; } } if (R != 1) { System.out.println("YES"); } else { System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
6f64061f8621a6780840ce903f3a47e1
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Codeforce17 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int x=0;x<t;x++){ int n=sc.nextInt(); String a=sc.next(); String b=sc.next(); int count=0; for(int i=0;i<n;i++){ char y=a.charAt(i); char z=b.charAt(i); if((y=='R'&&z!='R')||(z=='R'&&y!='R')) count++; } if(count>0) System.out.println("NO"); else System.out.println("YES"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
3d79c62f5b7f6b55cd4fc5e4dd5db562
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; import java.io.*; public class B { public static void main(String[] args) throws IOException { Reader sc = new Reader(); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); while(t-- > 0) { int n = sc.nextInt(); char[] arr1 = sc.next().toCharArray(); char[] arr2 = sc.next().toCharArray(); boolean check = true; for(int i = 0;i < n;i++) { if(arr1[i] != arr2[i]) { if(arr1[i] == 'B' && arr2[i] == 'G' || arr1[i] == 'G' && arr2[i] == 'B') { } else check = false; } } out.println(check ? "YES" : "NO"); } out.flush(); } static int[] bin(long n) { long i; List<Integer> list = new ArrayList<>(); list.add(0); for(i = 1 << 30;i > 0;i /= 2) { if((n & i) != 0) list.add(1); else list.add(0); } int[] arr = new int[32]; for(i = 0;i < list.size();i++) arr[(int)i] = list.get((int)i); return arr; } static int[] sort(int[] arr,int n) { List<Integer> list = new ArrayList<>(); for(int i = 0;i < n;i++) list.add(arr[i]); Collections.sort(list); for(int i = 0;i < n;i++) arr[i] = list.get(i); return arr; } static int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } static int isPrime(int n) { if(n < 2) return 0; if(n < 4) return 1; if((n % 2) == 0 || (n % 3) == 0) return 0; for(int i = 5; (i * i) <= n; i += 6) if((n % i) == 0 || (n % (i + 2)) == 0) return 0; return 1; } static class Reader { BufferedReader br; StringTokenizer st; public Reader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { if(st.hasMoreTokens()) str = st.nextToken("\n"); else str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
6eb427e229d2bc20fcdb2560efcf85bd
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class colourblind { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int l=0;l<t;l++) { int n=sc.nextInt(); int c=0; sc.nextLine(); String a=sc.nextLine(); String b=sc.nextLine(); for(int i=0;i<n;i++) { if(a.charAt(i)==b.charAt(i)) c++; else if(a.charAt(i)=='G'&& b.charAt(i)=='B') c++; else if(a.charAt(i)=='B'&& b.charAt(i)=='G') c++; } if(c==n) System.out.println("yes"); else System.out.println("no"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
a5ed7a4b0d1b4d89fc2de3157154cbe4
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.HashMap; import java.util.Map; import java.util.Scanner; /** * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools * * To modify the template, go to Preferences -> Editor -> File and Code Templates -> Other */ public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long t = sc.nextLong(); while (t > 0) { int n = sc.nextInt(); String st1=""; String st2=""; st1 = sc.next(); st2=sc.next(); String ans="YES"; int j=0; while(j<st1.length()) { if (st1.charAt(j) != st2.charAt(j)) { if (st1.charAt(j) == 'G' && st2.charAt(j) == 'B' || st1.charAt(j) == 'B' && st2.charAt(j) == 'G') { j++; }else { ans="NO"; break; } }else{ j++; } } System.out.println(ans); t--; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
08e58e06111cb4aff6bf5025bdf9669b
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Main { public static void main ( String[] args ) { Scanner scan = new Scanner (System.in); int t= scan.nextInt (); while(t>0){ int n=scan.nextInt (); String s1 = scan.next (); s1=s1.replaceAll("B","G"); String s2= scan.next (); s2=s2.replaceAll ("B","G"); if(s1.equals (s2)) System.out.println ("YES"); else System.out.println ("NO"); t--; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
62110781a2430286a63c174abc49ccc7
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Main { public static void main ( String[] args ) { Scanner scan = new Scanner (System.in); int t= scan.nextInt (); while(t>0){ int n=scan.nextInt (); char c1[]= new char[n]; String s1 = scan.next (); for(int i=0;i<n;i++) { c1[i] = s1.charAt (i); if (c1[i] == 'B') c1[i] = 'G'; } String s2= scan.next (); boolean check = true; for(int i=0;i<n;i++) { char c= s2.charAt (i); if(c=='B') c='G'; if(c!=c1[i]){ check=false; break; } } if(check) System.out.println ("YES"); else System.out.println ("NO"); t--; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
6fe28da768114c455dc8681af9908301
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
//package codeForces; import java.util.Scanner; public class B_1722 { static final Scanner sc = new Scanner(System.in); static boolean solve() { int t = Integer.parseInt(sc.nextLine()); String str1 = sc.nextLine(); String str2 = sc.nextLine(); for (int i = 0; i < str2.length(); i++) { if (str1.charAt(i) == 'R' && str1.charAt(i) != str2.charAt(i)){ return false; } if (str2.charAt(i) == 'R' && str2.charAt(i) != str1.charAt(i)){ return false; } } return true; } public static void main(String[] args) { // int t = 1; int t = Integer.parseInt(sc.nextLine()); while (t-- > 0) { System.out.println(solve() ? "YES" : "NO"); } } // TEMPLATES public static final String ALPHABET = "abcdefghijklmnopqrstuvwxyz"; }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
4bf9f890e3148fd12dd6134490d50c3a
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); test : while (t-->0){ int n = in.nextInt(); String s1 = in.next(); String s2 = in.next(); for (int i = 0; i < n; i++) { if(s1.charAt(i) == 'R' ^ s2.charAt(i) == 'R') { System.out.println("NO"); continue test; } } System.out.println("YES"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
227fce8d10194c56baaf91c0946e6d4d
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while (t-->0){ in.nextInt(); String s1 = in.next(); String s2 = in.next(); s1 = s1.replace('G', 'B'); s2 = s2.replace('G', 'B'); System.out.println(s1.equals(s2)?"YES":"NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
a35c61dbc10ad38536fb3608345c576e
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while (t-->0) { int n = in.nextInt(); StringBuilder s1 = new StringBuilder(in.next()); StringBuilder s2 = new StringBuilder(in.next()); for (int i=0; i<n ; i++){ if (s1.charAt(i)=='B'){ s1.setCharAt(i, 'G'); } if (s2.charAt(i)=='B'){ s2.setCharAt(i, 'G'); } } if (s1.toString().equals(s2.toString())){ System.out.println("YES"); }else { System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
ba7a85eacfcfe6c6bee133153f61a81d
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class Solution{ public static void main(String[] args){ Scanner in=new Scanner(System.in); int t=in.nextInt(); for(int i=0;i<t;i++){ int n=in.nextInt(); String s1=in.next(); String s2=in.next(); char ch1[]=s1.toCharArray(); char ch2[]=s2.toCharArray(); for(int k=0;k<n;k++) { if(ch1[k]=='G') { ch1[k]='B'; } } for(int k=0;k<n;k++) { if(ch2[k]=='G') { ch2[k]='B'; } } if(Arrays.equals(ch1,ch2)==true){ System.out.println("YES"); }else { System.out.println("NO"); } } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
42d0fd0c8a973620b7c9e3c553aaa3e5
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Writer { public static void main(String[] args) { FastReader f = new FastReader(); int x = f.nextInt(); for (int i = 0; i < x; i++) { int y = f.nextInt(); String s1 = f.next(); String s2 = f.next(); int a = 0; for (int j = 0; j < y; j++) { if (s1.charAt(j) == 'R' && s2.charAt(j) != 'R'){ System.out.println("NO"); a++; break; } else if (s1.charAt(j) != 'R' && s2.charAt(j) == 'R'){ System.out.println("NO"); a++; break; } } if (a == 0){ System.out.println("YES"); } } } static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { if(st.hasMoreTokens()){ str = st.nextToken("\n"); } else{ str = br.readLine(); } } catch (IOException e) { e.printStackTrace(); } return str; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
fe6dddbfe8d722f06be29963250b6de7
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
//package round817div4; import java.io.BufferedWriter; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; import java.util.Arrays; @SuppressWarnings("unused") public class B { private static Reader fs; private static OutputWriter out; private static void solve() throws IOException { int t = fs.nextInt(); while (t-- > 0) { int n = fs.nextInt(); char[] a = fs.nextString().toCharArray(); char[] b = fs.nextString().toCharArray(); boolean flag = false; for(int i = 0; i < n; i++) { if (a[i] == b[i]) flag = true; else if(a[i] == 'G' && b[i] == 'B') flag = true; else if (a[i] == 'B' && b[i] == 'G') flag = true; else { flag = false; break; } } if(flag) out.println("Yes"); else out.println("NO"); } } static class Element implements Comparable<Element> { int value; int freq; Element(int value, int freq) { this.value = value; this.freq = freq; } public int compareTo(Element e) { if (this.freq > e.freq) { return 1; } if (this.freq == e.freq) { return 0; } return -1; } } public static void main(String[] args) throws Exception { // console input output fs = new Reader(); out = new OutputWriter(); // File input output // reader = new Reader("temp.txt"); // writer=new OutputWriter("output.txt"); solve(); fs.close(); out.close(); } private static long min(long... values) { long min = values[0]; for (long value : values) { if (min > value) { min = value; } } return min; } private static long max(long... values) { long max = values[0]; for (long value : values) { if (max < value) { max = value; } } return max; } private static boolean[] SieveOfEratosthenes() { int n = (int) 1e7 + 7; boolean[] ans = new boolean[n]; Arrays.fill(ans, true); ans[0] = false; ans[1] = false; for (int i = 2; i < n; i++) { if (ans[i]) { for (int j = i * i; j < n; j = j + i) { ans[j] = false; } } } return ans; } static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream dataInputStream; private int bufferPointer, bytesRead; private byte[] buffer; public Reader() { this.dataInputStream = new DataInputStream(System.in); this.buffer = new byte[BUFFER_SIZE]; this.bufferPointer = 0; this.bytesRead = 0; } public Reader(String fileName) throws FileNotFoundException { this.dataInputStream = new DataInputStream(new FileInputStream(fileName)); this.buffer = new byte[BUFFER_SIZE]; this.bufferPointer = 0; this.bytesRead = 0; } public String nextLine() throws IOException { int c; do { c = readByte(); } while (c <= ' '); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = readByte(); } while (c != '\n'); return res.toString(); } public String nextString() throws IOException { int c; do { c = readByte(); } while (c <= ' '); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = readByte(); } while (c > ' '); return res.toString(); } public String nextLine(int n) throws IOException { byte[] arr = new byte[n + 1]; int count = 0; byte b; while ((b = readByte()) != -1) { if (b == '\n') { if (count != 0) { break; } else { continue; } } arr[count++] = b; } return new String(arr, 0, count); } public String nextString(int n) throws IOException { byte[] arr = new byte[n + 10]; int count = 0; byte b; while ((b = readByte()) != -1) { if (b == ' ' || b == '\n') { if (count != 0) { break; } else { continue; } } arr[count++] = b; } return new String(arr, 0, count); } // TODO: char is of 2 bytes, used only 1, correct it. public char nextChar() throws IOException { byte b = readByte(); while (b == ' ') { b = readByte(); } return (char) b; } public int nextInt() throws IOException { int res = 0; byte b = readByte(); while (b <= ' ') { b = readByte(); } boolean negative = (b == '-'); if (negative) { b = readByte(); } do { res = res * 10 + (b - '0'); } while ((b = readByte()) >= '0' && b <= '9'); if (negative) { res *= -1; } return res; } public long nextLong() throws IOException { long res = 0; byte b = readByte(); while (b <= ' ') { b = readByte(); } boolean negative = (b == '-'); if (negative) { b = readByte(); } do { res = res * 10 + (b - '0'); } while ((b = readByte()) >= '0' && b <= '9'); if (negative) { res *= -1; } return res; } public float nextFloat() throws IOException { float res = 0, div = 1; byte b = readByte(); while (b <= ' ') { b = readByte(); } boolean negative = (b == '-'); if (negative) { b = readByte(); } do { res = res * 10 + (b - '0'); } while ((b = readByte()) >= '0' && b <= '9'); if (b == '.') { while ((b = readByte()) >= '0' && b <= '9') { res += (b - '0') / (div *= 10); } } if (negative) { res *= -1; } return res; } public double nextDouble() throws IOException { double res = 0, div = 1; byte b = readByte(); while (b <= ' ') { b = readByte(); } boolean negative = (b == '-'); if (negative) { b = readByte(); } do { res = res * 10 + (b - '0'); } while ((b = readByte()) >= '0' && b <= '9'); if (b == '.') { while ((b = readByte()) >= '0' && b <= '9') { res += (b - '0') / (div *= 10); } } if (negative) { res *= -1; } return res; } public int[] readArray(int n) throws IOException { int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = fs.nextInt(); } return arr; } private void fillBuffer() throws IOException { bytesRead = dataInputStream.read(buffer, bufferPointer = 0, BUFFER_SIZE); if (bytesRead == -1) { buffer[0] = -1; } } private byte readByte() throws IOException { if (bufferPointer == bytesRead) { fillBuffer(); } return buffer[bufferPointer++]; } public void close() throws IOException { if (dataInputStream == null) { return; } dataInputStream.close(); } } static class OutputWriter { private final PrintWriter printWriter; public OutputWriter() { printWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); } public OutputWriter(String fileName) throws FileNotFoundException { printWriter = new PrintWriter( new BufferedWriter( new OutputStreamWriter( new FileOutputStream(fileName)))); } public OutputWriter(OutputStream outputStream) { printWriter = new PrintWriter( new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter(Writer writer) { this.printWriter = new PrintWriter(writer); } // TODO: do something foe this flush, it will make code slower public void print(Object... objects) { for (int i = 0; i < objects.length; i++) { if (i != 0) printWriter.print(' '); printWriter.print(objects[i]); } // printWriter.flush(); } public void println(Object... objects) { print(objects); printWriter.println(); // printWriter.flush(); } public void close() { printWriter.close(); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
eb6c500ff48d2bdf6f3604070d300928
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class Practice2 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while (t!=0) { int n = scanner.nextInt(); String s1 = scanner.next(); StringBuffer sb1 = new StringBuffer(s1); String s2 = scanner.next(); StringBuffer sb2 = new StringBuffer(s2); int len=s1.length(); for(int i=0;i<len;++i) if(sb1.charAt(i)=='G') sb1.setCharAt(i,'B'); for(int i=0;i<len;++i) if(sb2.charAt(i)=='G') sb2.setCharAt(i,'B'); s1 = sb1.toString(); s2 = sb2.toString(); if(s1.equals(s2)) System.out.println("YES"); else System.out.println("NO"); t--; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
bd6f3d499c0db6ed400c4937f8c8d1b9
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.Scanner; public class A{ public static void main(String args[]){ Scanner s = new Scanner(System.in); int q = s.nextInt(); for(int j = 0; j < q; j++){ int w = s.nextInt(); String str1 = s.next(); String str2 = s.next(); boolean b = true; for(int i = 0; i < w; i++){ if(str1.charAt(i) == 'R' && str2.charAt(i) != 'R'){ System.out.println("NO"); b = false; break; } else if(str1.charAt(i) != 'R' && str2.charAt(i) == 'R'){ System.out.println("NO"); b = false; break; } } if(b) System.out.println("YES"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
c9baa9af3c0eb80a40763e58a649a86b
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; import java.io.*; public class B1722 { static Scanner sc = new Scanner(); public static void main(String[] args) { int t = sc.nextInt(); while (t-- > 0) { solve(); } } public static void solve() { int n = sc.nextInt(); String[] str = new String[2]; for (int i = 0; i < 2; i++) { str[i] = sc.next(); } int cnt = 0, rs = -1; for (int i = 0; i < n; i++) { if (str[0].charAt(i) == 'R' || str[1].charAt(i) == 'R') { cnt++; if (str[0].charAt(i) == str[1].charAt(i)) { rs++; } } } System.out.println((cnt == rs + 1) ? "YES" : "NO"); } static class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); String next() { while (!st.hasMoreTokens()) try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } double nextDouble() { return Double.parseDouble(next()); } int[] readArray(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); return a; } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
f1efdfec008ae2be369c3a6b815a9f6c
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.util.*; public class colorblind{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int n =sc.nextInt(); String s1 = sc.next(); String s2 = sc.next(); System.out.println(helper(s1,s2,n)); } } public static String helper(String s1,String s2,int n){ int count =0; for(int i=0;i<n;i++){ if(s1.charAt(i)=='R'&& (s2.charAt(i)=='B'||s2.charAt(i)=='G')){ count++; } if(s2.charAt(i)=='R'&& (s1.charAt(i)=='B'||s1.charAt(i)=='G')){ count++; } } if(count >0){ String ss ="NO"; return ss; } String sss ="YES"; return sss; } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output
PASSED
b1eb5233b0375b48ce206fe755cb90a8
train_109.jsonl
1661871000
Vasya has a grid with $$$2$$$ rows and $$$n$$$ columns. He colours each cell red, green, or blue.Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be coloured the same.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class CodeForce_1722_B { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); int T = Integer.parseInt(read.readLine()); for(int test = 0; test < T; test++) { int N = Integer.parseInt(read.readLine()); String A = read.readLine(); String B = read.readLine(); boolean result = true; for(int i = 0; i < N; i++) { char a = A.charAt(i); char b = B.charAt(i); if(a == 'R' || b == 'R') { if(a != 'R' || b != 'R') { result = false; break; } } } if(result) System.out.println("YES"); else System.out.println("NO"); } } }
Java
["6\n\n2\n\nRG\n\nRB\n\n4\n\nGRBG\n\nGBGB\n\n5\n\nGGGGG\n\nBBBBB\n\n7\n\nBBBBBBB\n\nRRRRRRR\n\n8\n\nRGBRRGBR\n\nRGGRRBGR\n\n1\n\nG\n\nG"]
1 second
["YES\nNO\nYES\nNO\nYES\nYES"]
NoteIn the first test case, Vasya sees the second cell of each row as the same because the second cell of the first row is green and the second cell of the second row is blue, so he can't distinguish these two cells. The rest of the rows are equal in colour. Therefore, Vasya will say that the two rows are coloured the same, even though they aren't.In the second test case, Vasya can see that the two rows are different.In the third test case, every cell is green or blue, so Vasya will think they are the same.
Java 8
standard input
[ "implementation" ]
86a2e0854f9faf0b119d0d5e4b8fe952
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of columns of the grid. The following two lines each contain a string consisting of $$$n$$$ characters, each of which is either R, G, or B, representing a red, green, or blue cell, respectively — the description of the grid.
800
For each test case, output "YES" if Vasya considers the grid's two rows to be identical, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
standard output