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
|
18a83cc32c66db0da0f8c324f05928d8
|
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 static java.lang.Character.isWhitespace;
import java.io.*;
import java.util.*;
public final class Main {
void solve(InputReader in, StringBuilder sb) {
int t = in.nextInt();
var colorMap = Map.of('R', 1, 'G', 2, 'B', 2);
while (t-- > 0) {
int n = in.nextInt();
var row1 = in.nextLine();
var row2 = in.nextLine();
boolean correct = true;
for (int i = 0, j = 0; i < n && j < n; i++, j++) {
if (colorMap.get(row1.charAt(i)) != colorMap.get(row2.charAt(j))) {
correct = false;
break;
}
}
if (correct) {
sb.append("YES\n");
} else {
sb.append("NO\n");
}
}
}
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
StringBuilder sb = new StringBuilder();
Main solver = new Main();
solver.solve(in, sb);
System.out.println(sb.toString());
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
String nextLine() {
try {
return reader.readLine();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
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());
}
}
}
|
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 17
|
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
|
9a9959cb1599c43dd4c1a0378fdccc6d
|
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.*;
import java.util.function.*;
import java.util.stream.*;
import static java.lang.Integer.parseInt;
import static java.lang.Character.*;
import static java.lang.Long.parseLong;
import static java.lang.Math.*;
import static java.lang.System.arraycopy;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.util.stream.Collectors.*;
public final class Main {
void solve() {
int t = ni();
var colorMap = Map.of('R', 1, 'G', 2, 'B', 2);
while (t-- > 0) {
int n = ni();
var row1 = line();
var row2 = line();
boolean correct = true;
for (int i = 0, j = 0; i < n && j < n; i++, j++) {
if (colorMap.get(row1.charAt(i)) != colorMap.get(row2.charAt(j))) {
correct = false;
break;
}
}
if (correct) {
outln("YES");
} else {
outln("NO");
}
}
}
/*@fmt:off*/public static void main(String[]args){Main s=new Main();s.solve();s.flush();}
int BUFF_SZ=32768;DataInputStream din=new DataInputStream(System.in);
PrintWriter pw=new PrintWriter(new BufferedOutputStream(System.out));StringBuilder sb=new StringBuilder();
byte[]buff=new byte[BUFF_SZ];int bptr=0,bread=0;int ni(){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;}int[]nia(int n){int[]arr=new int[n];for(int i=0;i<n;i++){arr[i]=ni();}return arr;}
long nl(){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;}long[]nla(int n){long[]arr=new long[n];
for(int i=0;i<n;i++){arr[i]=nl();}return arr;}char nc(){byte c=read();while(isWhitespace(c)){c=read();}return(char)c;}
void fillBuffer(){try{bread=din.read(buff,bptr=0,BUFF_SZ);}catch(Exception e){throw new RuntimeException(e);}if(bread==-1){buff[0]=-1;}}
byte read(){if(bptr==bread){fillBuffer();}return buff[bptr++];}void flush(){pw.write(sb.toString());pw.flush();}
void out(String s){sb.append(s);}void outln(String s){sb.append(s).append('\n');}String line(){byte[]buf=new byte[120];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);}
void out(char c){sb.append(c);}void out(int n){sb.append(n);}void out(long l){sb.append(l);}void outln(char c){sb.append(c).append('\n');}
void outln(int n){sb.append(n).append('\n');}void outln(long l){sb.append(l).append('\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 17
|
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
|
644f6ec33693541fe6333247fdaaee3f
|
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 {
private void solve(InputReader in, PrintWriter pw) {
int t = in.nextInt();
outer:while (t-- > 0) {
int n = in.nextInt();
char[][] s = new char[2][];
s[0] = in.next().toCharArray();
s[1] = in.next().toCharArray();
for (int i = 0; i < n; i++) {
if (s[0][i] == 'R' && s[1][i] != 'R' || s[0][i] != 'R' && s[1][i] == 'R') {
pw.println("NO");
continue outer;
}
}
pw.println("YES");
}
pw.close();
}
public static void main(String[] args) {
new Main().solve(new InputReader(System.in), new PrintWriter(System.out));
}
}
class InputReader {
private final BufferedReader reader;
private 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 String nextLine() {
String str;
try {
str = reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
return str;
}
public boolean hasNext() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
String nextLine;
try {
nextLine = reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
if (nextLine == null) {
return false;
}
tokenizer = new StringTokenizer(nextLine);
}
return true;
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
}
|
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 17
|
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
|
4f052d82332a18d30eaebae07b77754f
|
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 SecondQuestion {
public static void main(String[] args) {
/*
* for(int i=0;i<n;i++){
if((s1[i]=='R' && s2[i]=='B')||(s1[i]=='B' && s2[i]=='R')){
flag=false;
break;
}
else if((s1[i]=='R' && s2[i]=='G')||(s1[i]=='G' && s2[i]=='R')){
flag=false;
break;
}
}
if(flag==false) cout<<"no"<<endl;
else cout<<"Yes"<<endl;
}*/
Scanner scanner = new Scanner(System.in);
int tc = scanner.nextInt();
while (tc!=0){
int n = scanner.nextInt();
String s = scanner.next();
System.out.println();
String s1 = scanner.next();
boolean flag = true;
for (int i = 0 ; i<n ;i++){
if ((s.charAt(i) == 'R' && s1.charAt(i) == 'B') || (s.charAt(i) == 'B' && s1.charAt(i) == 'R' )){
flag = false;
break;
}else if ((s.charAt(i) == 'R' && s1.charAt(i)=='G') || (s.charAt(i) == 'G' && s1.charAt(i) == 'R')){
flag = false;
break;
}
}
if (flag){
System.out.println("Yes");
}else{
System.out.println("No");
}
tc--;
}
}
}
|
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 17
|
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
|
3c00d7314336bc03e0219d39ccf00756
|
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.Arrays;
public class HelloWorld {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
int te = sc.nextInt();
for(int t = 0; t < te; t++){
int n = sc.nextInt();
int z = 1;
String x = sc.next();
String y = sc.next();
char [] ax = x.toCharArray();
char [] ay = y.toCharArray();
for(int i = 0; i < n; i++){
if((ax[i] == 'R' && ay[i] != 'R') || (ay[i] == 'R' && ax[i] != 'R')){
z = 0;
}
}
if(z == 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 17
|
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
|
3a56ac026ad9b1b30f8a9fb46006146b
|
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.StringTokenizer;
public class Main {
static InputReader r;
static int T;
static char R = 'R';
static StringBuilder answer = new StringBuilder();
private static void solution() throws IOException {
// R G B
// G==B
int col = r.nextInt();
String r1 = r.nextLine();
String r2 = r.nextLine();
for (int i = 0; i < col; i++) {
if (check(r1.charAt(i), r2.charAt(i))) {
continue;
}
answer.append("NO\n");
return;
}
answer.append("YES\n");
}
static boolean check(char a, char b) {
if (a == b) return true;
return a != R && b != R;
}
private static void input() throws IOException {
r = new InputReader();
T = r.nextInt();
}
public static void main(String[] args) throws IOException {
input();
for (int t = 0; t < T; t++) {
solution();
}
System.out.println(answer.toString());
}
private static class InputReader {
StringTokenizer st;
BufferedReader r;
public InputReader(String filePath) throws FileNotFoundException {
this(new FileReader(filePath));
}
public InputReader() {
this(new InputStreamReader(System.in));
}
private InputReader(InputStreamReader reader) {
r = new BufferedReader(reader);
st = new StringTokenizer("");
}
public int nextInt() throws IOException {
if (!st.hasMoreTokens()) st = new StringTokenizer(r.readLine());
return Integer.parseInt(st.nextToken());
}
public char[] nextCharArr() throws IOException {
return r.readLine().toCharArray();
}
public String nextLine() throws IOException {
return r.readLine();
}
}
}
|
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 17
|
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
|
80aaf971b57140214bab55d0f2c0daa8
|
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 Colorblindness {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t=sc.nextInt();
String ans="Yes";
for (int i=0;i<t;i++){
int n=sc.nextInt();
sc.nextLine();
String row1=sc.nextLine();
String row2=sc.nextLine();
// System.out.println(row1);
if (row1.equals(row2)){
ans="yes";
} else{
for (int j=0;j<n;j++){
if (((row1.charAt(j)=='G' && row2.charAt(j)=='B') || (row1.charAt(j)=='B' && row2.charAt(j)=='G'))){
ans="yes";
}
if (((row1.charAt(j)=='R' && row2.charAt(j)=='B') || (row1.charAt(j)=='R' && row2.charAt(j)=='G')) || ((row1.charAt(j)=='B' && row2.charAt(j)=='R') || (row1.charAt(j)=='G' && row2.charAt(j)=='R'))) {
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 17
|
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
|
c5f0b9bc361e3beb31be3140f66f14b0
|
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) {
Scanner sc = new Scanner(System.in);
int testCases = sc.nextInt();
while (testCases > 0){
int n = sc.nextInt();
String str1 = sc.next();
String str2 = sc.next();
boolean check = true;
for (int i = 0; i < n; i++){
boolean fCondition = (str1.charAt(i) == 'G' && str2.charAt(i) == 'B') || (str1.charAt(i) == 'B' && str2.charAt(i) == 'G');
boolean sCondition = str1.charAt(i) == str2.charAt(i);
if (fCondition || sCondition){
check = true;
}
else {
check = false;
break;
}
}
if (check){
System.out.println("YES");
}
else {
System.out.println("NO");
}
testCases--;
}
}
}
|
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 17
|
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
|
1a0d81cc663630372b615ab7ea3e2bbf
|
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 IOException
{
// your code goes here
Scanner sc= new Scanner(System.in);
int x,s;
String y,z;
s=sc.nextInt();
while(s>0)
{
if(sc.hasNextInt())
x=sc.nextInt();
if(sc.hasNext())
y=sc.next();
else
y="";
if(sc.hasNext())
z=sc.next();
else
z="";
y=y.replaceAll("B","G");
z=z.replaceAll("B","G");
if(y.equals(z))
System.out.println("yes");
else
System.out.println("no");
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 17
|
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
|
9003ec22829ef997b60dbe72319db60b
|
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.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
public class Solution {
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int count=0;
int n=sc.nextInt();
String s1=sc.next();
s1= s1.replace("B", "G");
String s2=sc.next();
s2= s2.replace("B", "G");
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 17
|
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
|
c8caaf1bbcfc228ada80c14e0dcbdc89
|
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 codeforces{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int T=sc.nextInt();
for(int h=1;h<=T;h++){
HashSet<Character> set=new HashSet<>();
int n=sc.nextInt();
String s1=sc.next();
String s2=sc.next();
s1=s1.replace('G','B');
s2=s2.replace('G','B');
if(s1.compareTo(s2)==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 17
|
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
|
9207a1ee8b07d044d5501ad4d3096a3d
|
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 Main {
public static void main(String args[])throws Exception{
// Your code goes here
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
while(t-->0){
int n = Integer.parseInt(br.readLine());
String s1 = br.readLine();
String s2 = br.readLine();
boolean flag = true;
int i=0;
while(i<s1.length()){
if(s1.charAt(i) != s2.charAt(i)){
if((s1.charAt(i) =='B'|| s1.charAt(i) == 'G') && (s2.charAt(i) =='B'|| s2.charAt(i) == 'G' )){
// i++;
// continue;
}
else {
flag = false;
}
}
i++;
}
if(flag == false) 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 17
|
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
|
1c0ffbd08fb8816b21972642e5e177aa
|
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 A_Colourblindness{
public static void main(String[] args) {
MyScanner sc = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
// Start writing your solution here. -------------------------------------
/*
int n = sc.nextInt(); // read input as integer
long k = sc.nextLong(); // read input as long
double d = sc.nextDouble(); // read input as double
String str = sc.next(); // read input as String
String s = sc.nextLine(); // read whole line as String
int result = 3*n;
out.println(result); // print via PrintWriter
*/
int t = Integer.parseInt(sc.nextLine());
while (t > 0){
t--;
int len = Integer.parseInt(sc.nextLine());
String line1 = sc.nextLine();
String line2 = sc.nextLine();
boolean yes = true;
for (int i = 0; i < len; i++){
if (line1.charAt(i) != line2.charAt(i)){
// if any of the non equal ones are red then no
if (line1.charAt(i) == 'R' || line2.charAt(i) == 'R'){
yes = false;
break;
}
}
}
if (yes){
System.out.println("yes");
} else {
System.out.println("no");
}
}
// Stop writing your solution here. -------------------------------------
out.close();
}
//-----------PrintWriter for faster output---------------------------------
public static PrintWriter out;
//-----------MyScanner class for faster input----------
public static class MyScanner {
BufferedReader br;
StringTokenizer st;
public MyScanner() {
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 17
|
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
|
5dc365a87ee8b7008859a88ed50bdd8f
|
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.*;
/*
Author: heyharry
Problem Statement: A
*/
public class Main {
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 sc= new Scanner(System.in);
long t=sc.nextLong();
while(t-->0){
long n=sc.nextLong();
sc.nextLine();
String str=sc.nextLine();
char []x= str.toCharArray();
String s= sc.nextLine();
char []y= s.toCharArray();
for(int i=0; i<x.length; i++){
if(x[i]=='G') x[i]='B';
}
for(int i=0; i<y.length; i++){
if(y[i]=='G') y[i]='B';
}
boolean flag=true;
for(int i=0; i<n; i++){
if(x[i]==y[i]) continue;
else {
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 17
|
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
|
a06845ec0205cbd38bfcd9adba4ffcf6
|
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 a1 {
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();
int m = 0;
for(int i = 0; i < n ;i++){
if(s2.charAt(i) == 'R' && s1.charAt(i) == 'R'){
m++;
}else if((s1.charAt(i) == 'B' || s1.charAt(i)=='G') && (s2.charAt(i) == 'B' || s2.charAt(i) == 'G')){
m++;
}
}
if(m == n){
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 17
|
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
|
4cd223af80083decba85bc55f3fb2d7e
|
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 k = sc.nextInt(), b;
for (int i = 0; i < k; i++) {
b = sc.nextInt();
String s1 = sc.next().replaceAll("[GB]", "1"), s2 = sc.next().replaceAll("[GB]", "1");
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 17
|
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
|
138874f8f4857b856abcfc0cd6f7da3a
|
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 Main {
static FastReader in=new FastReader();
static final Random random=new Random();
static long mod=1000000007L;
static HashMap<String,Integer>map=new HashMap<>();
public static void main(String args[]) throws IOException {
int t=in.nextInt();
while(t-->0){
int n=in.nextInt();
String s=in.nextLine();
String s1=in.next();
boolean flag=true;
for(int i=0;i<n;i++){
if(s.charAt(i)==s1.charAt(i))continue;
else if(s.charAt(i)=='B' && s1.charAt(i)=='G')continue;
else if(s1.charAt(i)=='B' && s.charAt(i)=='G')continue;
else{
flag=false;
break;
}
}
if(flag)print("YES");
else print("NO");
}
}
static int max(int a, int b)
{
if(a<b)
return b;
return a;
}
static void ruffleSort(int[] a) {
int n=a.length;
for (int i=0; i<n; i++) {
int oi=random.nextInt(n), temp=a[oi];
a[oi]=a[i]; a[i]=temp;
}
Arrays.sort(a);
}
static < E > void print(E res)
{
System.out.println(res);
}
static int gcd(int a,int b)
{
if(b==0)
{
return a;
}
return gcd(b,a%b);
}
static int lcm(int a, int b)
{
return (a / gcd(a, b)) * b;
}
static int abs(int a)
{
if(a<0)
return -1*a;
return a;
}
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;
}
}
}
|
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 17
|
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
|
7d6ce6dabd6638e3224caee2ec348ae9
|
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.BufferedInputStream;
import java.util.Arrays;
import java.util.Scanner;
public class B {
public static boolean isOk(String a, String b) {
int n = a.length();
for (int i = 0; i < n; i++) {
char c1 = a.charAt(i);
char c2 = b.charAt(i);
if (c1 == 'G') c1 = 'B';
if (c2 == 'G') c2 = 'B';
if (c1 != c2) return false;
}
return true;
}
public static void main(String[] args) {
Scanner sc = new Scanner(new BufferedInputStream(System.in));
int kase = sc.nextInt();
while (kase-- > 0) {
int n = sc.nextInt();
String a = sc.next();
String b = sc.next();
System.out.println(isOk(a, b) ? "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 17
|
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
|
e3cd44827f35d33139572948e52ae57a
|
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.math.*; // BigInteger, BigDecimal
import java.util.*;
public final class Main extends Solution {
final int mod = 1000000007;
void init() {
}
void solve() {
int n = sc.nextInt();
String a = sc.next(), b = sc.next();
if (a.replace("G", "B").equals(b.replace("G", "B")))
print("YES");
else
print("NO");
}
void main() {
// oneCase();
tcases();
// stresstest();
pw.flush();
pw.close();
}
void stresstest() {
}
void tcases() {
int t = sc.nextInt();
init();
while (t-- > 0) {
solve();
// print();
}
}
void oneCase() {
init();
solve();
}
Scanner sc;
PrintWriter pw;
File file;
Main() {
sc = new Scanner(System.in);
pw = new PrintWriter(System.out);
}
Main(String filename) throws IOException {
sc = new Scanner(System.in);
file = new File(filename);
if (file.exists())
file.delete();
file.createNewFile();
pw = new PrintWriter(file);
}
void print() {
pw.write("\n");
}
void print(char[][] a) {
for (int i = 0; i < a.length; i++)
pw.write(new String(a[i]) + "\n");
}
void print(int[][] a) {
for (int i = 0; i < a.length; i++)
pw.write(Arrays.toString(a[i]) + "\n");
}
void print(int... a) {
for (int i = 0; i < a.length - 1; i++)
pw.write(a[i] + " ");
pw.write(a[a.length - 1] + "\n");
}
void print(List a) {
for (int i = 0; i < a.size() - 1; i++)
pw.write(a.get(i) + " ");
pw.write(a.get(a.size() - 1) + "\n");
}
void print(char... a) {
for (int i = 0; i < a.length - 1; i++)
pw.write(a[i] + " ");
pw.write(a[a.length - 1] + "\n");
}
void print(long... a) {
for (int i = 0; i < a.length - 1; i++)
pw.write(a[i] + " ");
pw.write(a[a.length - 1] + "\n");
}
void print(double... a) {
for (int i = 0; i < a.length - 1; i++)
pw.write(a[i] + " ");
pw.write(a[a.length - 1] + "\n");
}
void print(String... a) {
for (int i = 0; i < a.length - 1; i++)
pw.write(a[i] + " ");
pw.write(a[a.length - 1] + "\n");
}
void print(Iterator<int[]> a) {
StringBuilder sb = new StringBuilder();
while (a.hasNext()) {
sb.append(Arrays.toString(a.next()));
}
print(sb.toString());
}
String toString(int[] arr) {
return Arrays.toString(arr);
}
int[][] scanMatrix(int n, int m) {
int[][] mat = new int[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
mat[i][j] = sc.nextInt();
}
}
return mat;
}
int[][] scanMatrix(int n) {
int[][] mat = new int[n][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
mat[i][j] = sc.nextInt();
}
}
return mat;
}
int[] scanArray(int n) {
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
return arr;
}
int[] randArray(int n, Random rand, int l, int r) {
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = l + rand.nextInt(r - l + 1);
}
return arr;
}
Graph scanGraph(int n, int m, boolean directed) {
Graph g = new Graph(n);
if (directed)
for (int i = 0; i < m; i++)
g.addEdge(sc.nextInt(), sc.nextInt());
else
for (int i = 0; i < m; i++)
g.addBiEdge(sc.nextInt(), sc.nextInt());
return g;
}
Tree scanTree(int n) {
Tree g = new Tree(n);
for (int i = 1; i < n; i++)
g.addBiEdge(sc.nextInt(), sc.nextInt());
return g;
}
public static void main(String[] args) {
Main ob = new Main();
ob.main();
}
}
class Solution {
long pow(long a, long b, long mod) {
long res = 1;
while (b > 0) {
if ((b & 1) == 1)
res = (res * a) % mod;
a = (a * a) % mod;
b >>= 1;
}
return res;
}
int pow(int a, long b, int mod) {
int res = 1;
while (b > 0) {
if ((b & 1) == 1)
res = (int) (((long) res * a) % mod);
a = (int) (((long) a * a) % mod);
b >>= 1;
}
return res;
}
int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
int gcd(int... a) {
int g = a[0];
for (int i = 1; i < a.length; i++)
g = gcd(g, a[i]);
return g;
}
long gcd(long... a) {
long g = a[0];
for (int i = 1; i < a.length; i++)
g = gcd(g, a[i]);
return g;
}
long lcm(int a, int b) {
return ((long) a * b) / gcd(a, b);
}
long lcm(int... a) {
long g = a[0];
for (int i = 1; i < a.length; i++)
g = lcm(g, a[i]);
return g;
}
long lcm(long... a) {
long g = a[0];
for (int i = 1; i < a.length; i++)
g = lcm(g, a[i]);
return g;
}
long lcm(long a, long b) {
return (a * b) / gcd(a, b);
}
long gcd(long a, long b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
long modInverse(long a, long mod) {
return pow(a, mod - 2, mod);
}
int ceilLog2(long x) {
int c = 0;
if ((x & -x) == x)
c--;
while (x != 0) {
x >>= 1;
c++;
}
return c;
}
int max(int... a) {
int m = Integer.MIN_VALUE;
for (int i : a) {
if (i > m)
m = i;
}
return m;
}
long max(long... a) {
long m = Long.MIN_VALUE;
for (long i : a) {
if (i > m)
m = i;
}
return m;
}
double max(double... a) {
double m = Double.MIN_VALUE;
for (double i : a) {
if (i > m)
m = i;
}
return m;
}
int min(int... a) {
int m = Integer.MAX_VALUE;
for (int i : a) {
if (i < m)
m = i;
}
return m;
}
long min(long... a) {
long m = Long.MAX_VALUE;
for (long i : a) {
if (i < m)
m = i;
}
return m;
}
double min(double... a) {
double m = Double.MAX_VALUE;
for (double i : a) {
if (i < m)
m = i;
}
return m;
}
long sum(int... a) {
long s = 0L;
for (int i : a) {
s += i;
}
return s;
}
long sum(long... a) {
long s = 0;
for (long i : a) {
s += i;
}
return s;
}
int sum(int[] a, int l, int r) {
int s = 0;
for (int i = l; i <= r; i++) {
s += a[i];
}
return s;
}
long sum(long[] a, int l, int r) {
long s = 0;
for (int i = l; i <= r; i++) {
s += a[i];
}
return s;
}
double sum(double... a) {
double s = 0;
for (double i : a) {
s += i;
}
return s;
}
double sum(double[] a, int l, int r) {
double s = 0;
for (int i = l; i <= r; i++) {
s += a[i];
}
return s;
}
int modPos(int a, int b) {
return (a % b + b) % b;
}
long modPos(long a, long b) {
return (a % b + b) % b;
}
void print() {
System.out.println();
}
void print(int... a) {
for (int i = 0; i < a.length - 1; i++)
System.out.print(a[i] + " ");
System.out.println(a[a.length - 1]);
}
void print(char... a) {
for (int i = 0; i < a.length - 1; i++)
System.out.print(a[i] + " ");
System.out.println(a[a.length - 1] + "\n");
}
void print(long... a) {
for (int i = 0; i < a.length - 1; i++)
System.out.print(a[i] + " ");
System.out.println(a[a.length - 1]);
}
void print(double... a) {
for (int i = 0; i < a.length - 1; i++)
System.out.print(a[i] + " ");
System.out.println(a[a.length - 1]);
}
void print(String... a) {
for (int i = 0; i < a.length - 1; i++)
System.out.print(a[i] + " ");
System.out.println(a[a.length - 1]);
}
void print(char[][] a) {
for (int i = 0; i < a.length - 1; i++)
System.out.println(new String(a[i]));
System.out.println(new String(a[a.length - 1]));
}
void print(int[][] a) {
System.out.println(Arrays.deepToString(a));
}
void print(Iterator<int[]> a) {
StringBuilder sb = new StringBuilder();
while (a.hasNext()) {
sb.append(Arrays.toString(a.next()));
}
print(sb.toString());
}
void sort(int[] arr, int l, int r) {
Arrays.sort(arr, l, r + 1);
}
int[] sorted(int[] arr) {
int[] brr = arr.clone();
Arrays.sort(brr);
return brr;
}
boolean isSorted(int[] arr, int l, int r) {
while (l < r) {
if (arr[l] > arr[l + 1])
return false;
l++;
}
return true;
}
List<Integer> sorted(List<Integer> arr) {
List<Integer> brr = new ArrayList<>(arr);
Collections.sort(brr);
return brr;
}
List<Integer> sorted(Set<Integer> arr) {
List<Integer> brr = new ArrayList<>(arr);
Collections.sort(brr);
return brr;
}
String sorted(String S) {
char[] s = S.toCharArray();
Arrays.sort(s);
return new String(s);
}
boolean allSame(int[] arr) {
for (int i : arr)
if (i != arr[0])
return false;
return true;
}
List<Integer> range(int l, int r) {
List<Integer> list = new ArrayList<>();
while (l <= r)
list.add(l++);
return list;
}
int mergeSortCountInversions(int[] arr, int l, int r) {
if (l < r) {
int m = (l + r) / 2;
int[] A = new int[m - l + 1], B = new int[r - m];
for (int i = l; i <= m; i++)
A[i - l] = arr[i];
for (int i = m + 1; i <= r; i++)
B[i - m - 1] = arr[i];
return mergeSortCountInversions(A, 0, A.length - 1) +
mergeSortCountInversions(B, 0, B.length - 1) +
merge(arr, A, B, l, m, r);
}
return 0;
}
int bisectRight(int[] A, int x) {
int l = 0, r = A.length - 1;
while (l <= r) {
int m = (l + r) / 2;
if (A[m] > x && (m == 0 || A[m - 1] <= x)) {
return m;
} else if (A[m] > x) {
r = m - 1;
} else {
l = m + 1;
}
}
return A.length;
}
int merge(int[] arr, int[] A, int[] B, int l, int m, int r) {
int swaps = 0;
for (int j = 0; j < B.length; j++) {
swaps += A.length - bisectRight(A, B[j]);
}
int i = 0, j = 0, k = l;
while (i < A.length && j < B.length) {
if (A[i] < B[j]) {
arr[k++] = A[i++];
} else {
arr[k++] = B[j++];
}
}
while (i < A.length) {
arr[k++] = A[i++];
}
while (j < B.length) {
arr[k++] = B[j++];
}
return swaps;
}
int minSwapsToSort(int arr[]) {
int[] brr = sorted(arr);
Map<Integer, Integer> reqPos = new Hashtable<>();
for (int i = 0; i < brr.length; i++) {
reqPos.put(brr[i], i);
}
byte[] vis = new byte[arr.length];
int ans = 0;
for (int i = 0; i < arr.length; i++) {
if (vis[i] == 0) {
int x = 0;
Queue<Integer> q = new LinkedList<>();
q.add(i);
while (!q.isEmpty()) {
int u = q.remove();
x++;
if (vis[u] == 1)
continue;
vis[u] = 1;
if (vis[reqPos.get(arr[u])] == 0)
q.add(reqPos.get(arr[u]));
}
ans += x - 1;
}
}
return ans;
}
void cyclicFlip(int[] arr, int n) {
for (int i = 0; i < n; i++)
arr[i]++; // for 0-based indexing
for (int i = 0; i < n; i++) {
if (arr[i] > 0) {
int j = i, t = arr[i];
while (j >= 0 && arr[j] >= 0) {
int y = arr[j];
arr[j] = -arr[y - 1];
if (arr[j] > 0)
arr[j] = -t;
j = y - 1;
}
}
}
for (int i = 0; i < n; i++)
arr[i]--;
}
int findPeak(int arr[], int low, int high, int n) {
int mid = low + (high - low) / 2;
if ((mid == 0 || arr[mid - 1] <= arr[mid]) && (mid == n - 1 || arr[mid + 1] <= arr[mid]))
return mid;
else if (mid > 0 && arr[mid - 1] > arr[mid])
return findPeak(arr, low, (mid - 1), n);
else
return findPeak(arr, (mid + 1), high, n);
}
int[] computePrefixFunction(char[] P) {
int[] s = new int[P.length];
s[0] = 0;
int border = 0;
for (int i = 1; i < P.length; i++) {
while (border > 0 && P[i] != P[border])
border = s[border - 1];
if (P[i] == P[border])
border++;
else
border = 0;
s[i] = border;
}
return s;
}
public List<Integer> KMP(String pattern, String text) {
ArrayList<Integer> result = new ArrayList<Integer>();
int[] s = computePrefixFunction((pattern + "$" + text).toCharArray());
int pn = pattern.length();
for (int i = pn + 1; i < s.length; i++) {
if (s[i] == pn)
result.add(i - 2 * pn);
}
return result;
}
}
class Graph {
List<Integer>[] adj;
int n;
@SuppressWarnings("unchecked")
Graph(int n) {
this.n = n;
adj = new List[n + 1];
for (int i = 0; i < n + 1; i++) {
adj[i] = new ArrayList<Integer>();
}
}
int[] dijkstra(int start) {
int[] dist = new int[n + 1];
boolean[] vis = new boolean[n + 1];
Arrays.fill(dist, -1);
dist[start] = 0;
PriorityQueue<int[]> pq = new PriorityQueue<>((a, b) -> {
if (a[1] != b[1])
return a[1] - b[1];
else
return a[0] - b[0];
});
pq.add(new int[] { start, 0 });
while (!pq.isEmpty()) {
int u = pq.remove()[0];
if (!vis[u]) {
vis[u] = true;
for (int v : adj[u]) {
if (dist[v] == -1 || dist[u] + 1 < dist[v]) {
dist[v] = 1 + dist[u];
System.out.println(u + " " + v + " " + dist[v]);
pq.add(new int[] { v, dist[v] });
}
}
}
}
return dist;
}
void addEdge(int u, int v) {
adj[u].add(v);
}
void addBiEdge(int u, int v) {
adj[u].add(v);
adj[v].add(u);
}
}
class Tree extends Graph {
int[] parent;
Tree(int n) {
super(n);
}
void makeRoot(int root) {
if (parent == null)
parent = new int[n + 1];
dfsMakeRoot(root, root);
}
void dfsMakeRoot(int u, int p) {
parent[u] = p;
for (int v : adj[u]) {
if (v != p)
dfsMakeRoot(v, u);
}
}
}
class SubMatrixSum {
int[][] dp;
SubMatrixSum(int mat[][]) {
int n = mat.length, m = mat[0].length;
dp = new int[n][m];
dp[0][0] = mat[0][0];
for (int i = 1; i < n; i++)
dp[i][0] = mat[i][0] + dp[i - 1][0];
for (int i = 1; i < m; i++)
dp[0][i] = mat[0][i] + dp[0][i - 1];
for (int i = 1; i < n; i++) {
for (int j = 1; j < m; j++) {
dp[i][j] = mat[i][j] + dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
}
}
System.out.println(Arrays.deepToString(dp));
}
int query(int rs, int cs, int re, int ce) {
if (rs > 0 && cs > 0)
return dp[re][ce] - dp[rs - 1][ce] - dp[re][cs - 1] + dp[rs - 1][cs - 1];
else if (rs > 0)
return dp[re][ce] - dp[rs - 1][ce];
else if (cs > 0)
return dp[re][ce] - dp[re][cs - 1];
else
return dp[re][ce];
}
}
class GCDExceptSelf {
int[] arr, left, right;
GCDExceptSelf(int[] arr) {
this.arr = arr;
left = new int[arr.length];
right = new int[arr.length];
left[0] = arr[0];
right[arr.length - 1] = arr[arr.length - 1];
for (int i = 1; i < arr.length; i++) {
left[i] = gcd(left[i - 1], arr[i]);
}
for (int i = arr.length - 2; i >= 0; i--) {
right[i] = gcd(right[i + 1], arr[i]);
}
}
int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
int get(int i) {
if (i > 0 && i < arr.length - 1) {
return gcd(left[i - 1], right[i + 1]);
} else if (i > 0)
return left[i - 1];
else if (i < arr.length - 1)
return right[i + 1];
else
return 1;
}
}
class SuffixTreeNode {
SuffixTreeNode parent;
TreeMap<Character, SuffixTreeNode> children;
Integer stringDepth, edgeStart, edgeEnd;
byte vis;
SuffixTreeNode(SuffixTreeNode parent, Integer stringDepth, Integer edgeStart, Integer edgeEnd) {
this.parent = parent;
this.stringDepth = stringDepth;
this.edgeStart = edgeStart;
this.edgeEnd = edgeEnd;
this.children = new TreeMap<>();
this.vis = 0;
}
}
class SuffixArray {
int[] suffixarray;
char[] S;
SuffixTreeNode getSuffixTree() {
return STfromSA(suffixarray, computeLCPArray());
}
SuffixTreeNode STfromSA(int[] order, int[] lcpArray) {
SuffixTreeNode root = new SuffixTreeNode(null, 0, -1, -1);
int lcpPrev = 0;
SuffixTreeNode curNode = root;
for (int i = 0; i < S.length; i++) {
int suffix = order[i];
while (curNode.stringDepth > lcpPrev) {
curNode = curNode.parent;
}
if (curNode.stringDepth == lcpPrev) {
curNode = createNewLeaf(curNode, suffix);
} else {
int edgeStart = order[i - 1] + curNode.stringDepth,
offset = lcpPrev - curNode.stringDepth;
SuffixTreeNode midNode = breakEdge(curNode, edgeStart, offset);
curNode = createNewLeaf(midNode, suffix);
}
if (i < S.length - 1) {
lcpPrev = lcpArray[i];
}
}
return root;
}
SuffixTreeNode createNewLeaf(SuffixTreeNode node, int suffix) {
SuffixTreeNode leaf = new SuffixTreeNode(node, S.length - suffix, suffix + node.stringDepth, S.length);
node.children.put(S[leaf.edgeStart], leaf);
leaf.parent = node;
return leaf;
}
SuffixTreeNode breakEdge(SuffixTreeNode node, int start, int offset) {
char startChar = S[start],
midChar = S[start + offset];
SuffixTreeNode midNode = new SuffixTreeNode(node, node.stringDepth + offset, start, start + offset);
midNode.children.put(midChar, node.children.get(startChar));
node.children.get(startChar).parent = midNode;
node.children.get(startChar).edgeStart += offset;
node.children.put(startChar, midNode);
return midNode;
}
int lcpOfSuffixes(int i, int j, int equal) {
int lcp = Math.max(0, equal);
while (i + lcp < S.length && j + lcp < S.length && S[i + lcp] == S[j + lcp]) {
lcp++;
}
return lcp;
}
int[] invertSuffixArray() {
int[] pos = new int[suffixarray.length];
for (int i = 0; i < suffixarray.length; i++) {
pos[suffixarray[i]] = i;
}
return pos;
}
int[] computeLCPArray() {
int[] lcpArray = new int[S.length - 1];
int lcp = 0;
int[] posInOrder = invertSuffixArray();
int suffix = suffixarray[0];
for (int i = 0; i < S.length; i++) {
int orderIndex = posInOrder[suffix];
if (orderIndex == S.length - 1) {
lcp = 0;
suffix = (suffix + 1) % S.length;
continue;
}
int nextSuffix = suffixarray[orderIndex + 1];
lcp = lcpOfSuffixes(suffix, nextSuffix, lcp - 1);
lcpArray[orderIndex] = lcp;
suffix = (suffix + 1) % S.length;
}
return lcpArray;
}
int[] sortCharacters() {
int[] order = new int[S.length];
TreeMap<Character, Integer> count = new TreeMap<>();
for (int i = 0; i < S.length; i++) {
count.put(S[i], count.getOrDefault(S[i], 0) + 1);
}
Character[] keys = count.keySet().toArray(new Character[0]);
for (int i = 1; i < keys.length; i++) {
count.put(keys[i], count.get(keys[i]) + count.get(keys[i - 1]));
}
for (int i = S.length - 1; i >= 0; i--) {
count.put(S[i], count.get(S[i]) - 1);
order[count.get(S[i])] = i;
}
return order;
}
int[] computeCharClasses(int[] order) {
int[] classes = new int[S.length];
classes[order[0]] = 0;
for (int i = 1; i < S.length; i++) {
if (S[order[i]] != S[order[i - 1]]) {
classes[order[i]] = classes[order[i - 1]] + 1;
} else {
classes[order[i]] = classes[order[i - 1]];
}
}
return classes;
}
int[] sortDoubled(int L, int[] order, int[] classes) {
int[] count = new int[S.length];
int[] newOrder = new int[S.length];
for (int i = 0; i < S.length; i++)
count[classes[i]]++;
for (int i = 1; i < S.length; i++)
count[i] += count[i - 1];
for (int i = S.length - 1; i >= 0; i--) {
int start = (order[i] - L + S.length) % S.length;
int cl = classes[start];
count[cl]--;
newOrder[count[cl]] = start;
}
return newOrder;
}
int[] updateClasses(int[] newOrder, int[] classes, int L) {
int n = newOrder.length;
int[] newClasses = new int[n];
newClasses[newOrder[0]] = 0;
for (int i = 1; i < n; i++) {
int cur = newOrder[i];
int prev = newOrder[i - 1];
int mid = (cur + L) % n;
int midPrev = (prev + L) % n;
if (classes[cur] != classes[prev] || classes[mid] != classes[midPrev]) {
newClasses[cur] = newClasses[prev] + 1;
} else {
newClasses[cur] = newClasses[prev];
}
}
return newClasses;
}
SuffixArray(String text) {
char[] S = text.toCharArray();
int[] order = sortCharacters();
int[] classes = computeCharClasses(order);
int L = 1;
while (L < S.length) {
order = sortDoubled(L, order, classes);
classes = updateClasses(order, classes, L);
L *= 2;
}
suffixarray = order;
}
}
class LazySegmentTreeAdd {
int[] tree, lazy;
LazySegmentTreeAdd(int max) {
tree = new int[4 * max];
lazy = new int[4 * max];
}
void updateRangeUtil(int si, int ss, int se, int us,
int ue, int diff) {
if (lazy[si] != 0) {
tree[si] += (se - ss + 1) * lazy[si];
if (ss != se) {
lazy[si * 2 + 1] += lazy[si];
lazy[si * 2 + 2] += lazy[si];
}
lazy[si] = 0;
}
if (ss > se || ss > ue || se < us)
return;
if (ss >= us && se <= ue) {
tree[si] += (se - ss + 1) * diff;
if (ss != se) {
lazy[si * 2 + 1] += diff;
lazy[si * 2 + 2] += diff;
}
return;
}
int mid = (ss + se) / 2;
updateRangeUtil(si * 2 + 1, ss, mid, us, ue, diff);
updateRangeUtil(si * 2 + 2, mid + 1, se, us, ue, diff);
tree[si] = tree[si * 2 + 1] + tree[si * 2 + 2];
}
void updateRange(int n, int us, int ue, int diff) {
updateRangeUtil(0, 0, n - 1, us, ue, diff);
}
int getSumUtil(int ss, int se, int qs, int qe, int si) {
if (lazy[si] != 0) {
tree[si] += (se - ss + 1) * lazy[si];
if (ss != se) {
lazy[si * 2 + 1] += lazy[si];
lazy[si * 2 + 2] += lazy[si];
}
lazy[si] = 0;
}
if (ss > se || ss > qe || se < qs)
return 0;
if (ss >= qs && se <= qe)
return tree[si];
int mid = (ss + se) / 2;
return getSumUtil(ss, mid, qs, qe, 2 * si + 1) +
getSumUtil(mid + 1, se, qs, qe, 2 * si + 2);
}
int getSum(int n, int qs, int qe) {
return getSumUtil(0, n - 1, qs, qe, 0);
}
void constructSTUtil(int arr[], int ss, int se, int si) {
if (ss > se)
return;
if (ss == se) {
tree[si] = arr[ss];
return;
}
int mid = (ss + se) / 2;
constructSTUtil(arr, ss, mid, si * 2 + 1);
constructSTUtil(arr, mid + 1, se, si * 2 + 2);
tree[si] = tree[si * 2 + 1] + tree[si * 2 + 2];
}
void constructST(int arr[], int n) {
constructSTUtil(arr, 0, n - 1, 0);
}
}
class LazySegmentTreeOR {
int[] tree, lazy;
LazySegmentTreeOR(int max) {
tree = new int[4 * max];
lazy = new int[4 * max];
}
void updateRangeUtil(int si, int ss, int se, int us,
int ue, int newVal) {
if (lazy[si] != 0) {
tree[si] |= lazy[si];
if (ss != se) {
lazy[si * 2 + 1] |= lazy[si];
lazy[si * 2 + 2] |= lazy[si];
}
lazy[si] = 0;
}
if (ss > se || ss > ue || se < us)
return;
if (ss >= us && se <= ue) {
tree[si] = newVal;
if (ss != se) {
lazy[si * 2 + 1] = newVal;
lazy[si * 2 + 2] = newVal;
}
return;
}
int mid = (ss + se) / 2;
updateRangeUtil(si * 2 + 1, ss, mid, us, ue, newVal);
updateRangeUtil(si * 2 + 2, mid + 1, se, us, ue, newVal);
tree[si] = tree[si * 2 + 1] | tree[si * 2 + 2];
}
void updateRange(int n, int us, int ue, int newVal) {
updateRangeUtil(0, 0, n - 1, us, ue, newVal);
}
int getSumUtil(int ss, int se, int qs, int qe, int si) {
if (lazy[si] != 0) {
tree[si] |= lazy[si];
if (ss != se) {
lazy[si * 2 + 1] |= lazy[si];
lazy[si * 2 + 2] |= lazy[si];
}
lazy[si] = 0;
}
if (ss > se || ss > qe || se < qs)
return 0;
if (ss >= qs && se <= qe)
return tree[si];
int mid = (ss + se) / 2;
return getSumUtil(ss, mid, qs, qe, 2 * si + 1) |
getSumUtil(mid + 1, se, qs, qe, 2 * si + 2);
}
int getSum(int n, int qs, int qe) {
return getSumUtil(0, n - 1, qs, qe, 0);
}
void constructSTUtil(int arr[], int ss, int se, int si) {
if (ss > se)
return;
if (ss == se) {
tree[si] = arr[ss];
return;
}
int mid = (ss + se) / 2;
constructSTUtil(arr, ss, mid, si * 2 + 1);
constructSTUtil(arr, mid + 1, se, si * 2 + 2);
tree[si] = tree[si * 2 + 1] | tree[si * 2 + 2];
}
void constructSTUtil(char arr[], int ss, int se, int si) {
if (ss > se)
return;
if (ss == se) {
tree[si] = 1 << (arr[ss] - 'a');
return;
}
int mid = (ss + se) / 2;
constructSTUtil(arr, ss, mid, si * 2 + 1);
constructSTUtil(arr, mid + 1, se, si * 2 + 2);
tree[si] = tree[si * 2 + 1] | tree[si * 2 + 2];
}
void constructST(int arr[], int n) {
constructSTUtil(arr, 0, n - 1, 0);
}
void constructST(char arr[], int n) {
constructSTUtil(arr, 0, n - 1, 0);
}
}
class RangeMinQuery {
class Node {
int l, r;
int[] min;
Node left, right;
Node() {
}
Node(int l, int r) {
this.l = l;
this.r = r;
this.min = new int[] { Integer.MAX_VALUE, Integer.MAX_VALUE, -1 };
}
}
Node root;
public RangeMinQuery(int l, int r) {
root = new Node(l, r);
}
void update(int index, int[] val) {
update(root, index, val);
}
int[] getMin(int l, int r) {
return getMin(root, l, r);
}
void update(Node root, int index, int[] val) {
if (root == null)
return;
// System.out.println(index+" "+root.l+" "+root.r);
if (root.l == root.r && root.l == index) {
root.min = val;
return;
}
int m = (root.l + root.r) / 2;
if (index > m) {
if (root.right == null)
root.right = new Node(m + 1, root.r);
update(root.right, index, val);
} else {
if (root.left == null)
root.left = new Node(root.l, m);
update(root.left, index, val);
}
root.min = new int[] { Integer.MAX_VALUE, Integer.MAX_VALUE, -1 };
if (root.left != null)
root.min = min(root.min, root.left.min);
if (root.right != null)
root.min = min(root.min, root.right.min);
}
int[] getMin(Node root, int l, int r) {
if (root == null || l > r || r < root.l || l > root.r)
return new int[] { Integer.MAX_VALUE, Integer.MAX_VALUE, -1 };
if (l <= root.l && r >= root.r)
return root.min;
return min(getMin(root.left, l, r), getMin(root.right, l, r));
}
void printLeaves(Node root) {
if (root != null) {
if (root.left == null && root.right == null) {
System.out.println("[" + (root.l) + "," + (root.r) + "] -> min = " + Arrays.toString(root.min));
}
printLeaves(root.left);
printLeaves(root.right);
}
}
int[] min(int[] a, int[] b) {
for (int i = 0; i < a.length && i < b.length; i++) {
if (a[i] > b[i])
return b;
else if (a[i] < b[i])
return a;
}
if (a.length < b.length)
return a;
return 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 17
|
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
|
b4388c9c92e3367bf3ee81c3dfc1abcc
|
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.tdorosz._1722;
import java.util.Scanner;
public class Colourblindness {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int testCases = scanner.nextInt();
scanner.nextLine();
for (int i = 0; i < testCases; i++) {
handleTestCase(scanner);
}
}
private static void handleTestCase(Scanner scanner) {
int numberOfColumns = scanner.nextInt();
scanner.nextLine();
String row1 = scanner.nextLine();
String row2 = scanner.nextLine();
row1 = row1.replaceAll("G", "B");
row2 = row2.replaceAll("G", "B");
System.out.println(row1.equals(row2) ? "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 17
|
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
|
462ff979414ed750d24bc0f66edc0848
|
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) {
Scanner sc =new Scanner(System.in);
int t = sc.nextInt();
for(int i=0;i<t;i++){
int n = sc.nextInt();
String A = sc.next();
String B = sc.next();
boolean flag = false;
for(int j=0;j<n;j++){
if(A.charAt(j) == 'R'){
if(B.charAt(j) == 'R')
continue;
else{
System.out.println("NO");
flag = true;
break;
}
}
else{
if(B.charAt(j) == 'R'){
System.out.println("NO");
flag = true;
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 17
|
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
|
f79c8b75ddf97ee524e397e3f5f687b3
|
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 p2 {
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();
boolean flag = true;
if (str1.equals(str2)) {
System.out.println("YES");
continue;
}
for (int i = 0; i < n; i++) {
if (str1.charAt(i) != str2.charAt(i)) {
if ((str1.charAt(i) == 'G' && str2.charAt(i) == 'B') || (str1.charAt(i) == 'B' && str2.charAt(i) == 'G')) {
continue;
} else {
flag = false;
}
}
}
if(flag == false) {
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 17
|
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
|
5b29bb7a06b34ce4700be2fce29a792b
|
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();
while(t>0){
int a = sc.nextInt();
int[] c1 = new int[a];
int[] c2 = new int[a];
String s1 = sc.next();
String s2 = sc.next();
for(int i=0;i<a;i++){
char x =s1.charAt(i);
if(x=='R'){
c1[i]=1;
}
else c1[i]=0;
}
for(int i=0;i<a;i++){
char x = s2.charAt(i);
if(x=='R'){
c2[i]=1;
}
else c2[i]=0;
}
int m = check(a,c1,c2);
if(m==1) System.out.println("YES");
else System.out.println("NO");
t--;
}
}
public static int check(int a,int[] c1,int c2[]){
for(int i = 0;i<a;i++){
if(c1[i]!=c2[i]){
return 0;
}
}
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 17
|
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
|
2dccd3fd0ffe4149c61075fb39572044
|
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.*;
//min
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();
sc.nextLine();
char[][] mat =new char[2][n];
for(int i=0;i<2;i++)
{ String in= sc.nextLine();
for(int j=0;j<n;j++) {
char c=in.charAt(j);
if (c == 'B' || c == 'G') mat[i][j] = 'B';
else mat[i][j]=c;
}
}
//solve
//BG
StringBuilder str1= new StringBuilder();
StringBuilder str2= new StringBuilder();
for(int j=0;j<n;j++)
{
str1.append(mat[0][j]);
str2.append(mat[1][j]);
}
System.out.println(str1.toString().equals(str2.toString())?"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 17
|
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
|
f649cf98cfbf7a6492422956475b8a35
|
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 Colour {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t= sc.nextInt();
for(int i=0;i<t;i++)
{
boolean ans=false;
int n=sc.nextInt();
String S1= sc.next();
String S2= sc.next();
for(int j=0;j<n;j++)
{
if(S1.charAt(j)==S2.charAt(j))
ans=true;
else
{
if((S1.charAt(j)=='G'&&S2.charAt(j)=='B')||(S1.charAt(j)=='B'&&S2.charAt(j)=='G'))
ans=true;
else
{
ans=false;
break;
}
}
}
System.out.println(ans?"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 17
|
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
|
8824dc6c82d348d69dcbe735b26e3f9c
|
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 {
private static Scan sc = new Scan();
public static void main(String[] args) {
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
solve();
}
}
private static void solve() {
int c = sc.nextInt();
String a = sc.next();
String b = sc.next();
for (int i = 0; i < c; i++) {
if (a.charAt(i) == 'R' && b.charAt(i) != 'R' || a.charAt(i) != 'R' && b.charAt(i) == 'R') {
System.out.println("NO");
return;
}
}
System.out.println("YES");
}
private static class Scan {
BufferedReader br;
StringTokenizer st;
public Scan() {
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());
}
String nextLine() {
String line = "";
try {
line = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return line;
}
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 17
|
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
|
7681168f784f77d035207e6b66abfd8d
|
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 colourblindnessCF {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int testCases = scanner.nextInt();
for (int i = 0; i < testCases; i++) {
scanner.nextInt();
scanner.nextLine();
String one = scanner.nextLine().replaceAll("G", "B");
String two = scanner.nextLine().replaceAll("G", "B");
System.out.println(one.equals(two) ? "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 17
|
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
|
66a51ad0f4c8d5f4bf8abd1d178da478
|
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.ArrayList;
import java.util.Collections;
import java.util.Arrays;
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 s1=sc.next();
String s2=sc.next();
char s3[]=new char[n];
char s4[]=new char[n];
for(int i=0;i<n;i++)
{
if(Character.compare(s1.charAt(i),s2.charAt(i))==0)
{
s3[i]=s1.charAt(i);
s4[i]=s2.charAt(i);
}
else if(Character.compare(s1.charAt(i),'B')==0&&Character.compare(s2.charAt(i),'G')==0||Character.compare(s1.charAt(i),'G')==0&&Character.compare(s2.charAt(i),'B')==0)
{
s3[i]='B';
s4[i]='B';
}
else
{
s3[i]=s1.charAt(i);
s4[i]=s2.charAt(i);
}
}
if(Arrays.equals(s3,s4))
{
System.out.println("YES");
}
else
{
System.out.println("NO");
}
t--;
}
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 17
|
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
|
50c95c0c05771053af9fde205c39a4c7
|
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 _1722B_ColorBlindness {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int test = input.nextInt();
while (test-- > 0) {
int len = input.nextInt();
String first = input.next().replace("G", "B");
String second = input.next().replace("G", "B");
System.out.println(first.equals(second) ? "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 17
|
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
|
d2c59dab58650ec205c99bbc3be43158
|
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 Colorblind {
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();
String s1,s2;
s1 = sc.next(); s2 = sc.next();
s1 = s1.replace('G','B');
s2 = s2.replace('G','B');
if(s1.equals(s2)) System.out.print("YES\n");
else System.out.print("NO\n");
}
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 17
|
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
|
a33fb751acfa0113436ac0992fa1dbb2
|
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 R817B {
public static String solve(String s1, String s2) {
for(int i = 0; i < s1.length(); i++) {
char c1 = s1.charAt(i);
char c2 = s2.charAt(i);
if(c1 == 'G') c1 = 'B';
if(c2 == 'G') c2 = 'B';
if(c1 != c2) return "NO";
}
return "YES";
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
in.nextLine();
for(int i = 0; i < t; i++) {
int len = in.nextInt();
in.nextLine();
String s1 = in.nextLine();
String s2 = in.nextLine();
System.out.println(solve(s1, s2));
System.out.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 17
|
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
|
5a19f55efd61f52a1a42108803ade6b9
|
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 Main817B {
public static void main(String[] args) throws IOException {
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
int numberOfCases = Integer.parseInt(input.readLine());
for (int i = 0; i < numberOfCases; i++) {
input.readLine();
String row1 = input.readLine().replaceAll("G", "B");
String row2 = input.readLine().replaceAll("G", "B");
System.out.println(row1.equals(row2) ? "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 17
|
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
|
27db86950c0859590c42a0c55e7a85e4
|
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.awt.*;
import java.util.ArrayList;
import java.util.Scanner;
public class test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
for (int i = 0; i < x; i++) {
int n = sc.nextInt();
String a=sc.next();
String b=sc.next();
boolean flag=false;
for(int j=0;j<n;j++)
if((a.charAt(j)=='R'&&(b.charAt(j)=='B'||b.charAt(j)=='G'))||(b.charAt(j)=='R'&&(a.charAt(j)=='B'||a.charAt(j)=='G'))){
System.out.println("NO");
flag=true;
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 17
|
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
|
d969b2d614cb69c3044886681343588c
|
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 ProblemB {
private static final Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
int skip = sc.nextInt();
String s1 = sc.next();
String s2 = sc.next();
System.out.println(equals(s1, s2) ? "YES" : "NO");
}
}
private static boolean equals(String s1, String s2) {
for (int i = 0; i < s1.length(); i++) {
if (s1.charAt(i) != s2.charAt(i) && (s1.charAt(i) == 'R' || s2.charAt(i) == 'R')) 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 17
|
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
|
aa6b8033d0afbc42137e4d030d03e0ff
|
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 codeforces {
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();
int cnt=0;
for(int i=0;i<n;i++){
if(s1.charAt(i)=='B' && s2.charAt(i)=='G'){
cnt++;
} else if (s1.charAt(i)=='G' && s2.charAt(i)=='B') {
cnt++;
} else if (s1.charAt(i)==s2.charAt(i)) {
cnt++;
}
}
if(cnt==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 17
|
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
|
a04355d50dbfb338144e4dab2c34b9bb
|
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 tc = sc.nextInt();
while(tc-- > 0) {
int n = sc.nextInt();
String s1 = sc.next();
String s2 = sc.next();
boolean flag = true;
for(int i = 0; i < s1.length(); i++) {
if((s1.charAt(i) == 'R' && s2.charAt(i) == 'B') || (s1.charAt(i) == 'R' && s2.charAt(i) == 'G') || (s1.charAt(i) == 'G' && s2.charAt(i) == 'R') || (s1.charAt(i) == 'B' && s2.charAt(i) == 'R')) {
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 17
|
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
|
9998d14f9b1a39a5c5024f26e3739d98
|
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.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
/*
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
HashMap<Character,Integer> map = new HashMap<Character,Integer>();
map.put('T',0);
map.put('i',0);
map.put('m',0);
map.put('u',0);
map.put('r',0);
int t = sc.nextInt();
while(t>0)
{
int flag = 0,flag2=0;
int l = sc.nextInt();
String n = sc.next();
for(int i=0;i<n.length();++i)
{
if(n.charAt(i)=='T') flag=1;
if(map.containsKey(n.charAt(i)))
{
map.replace(n.charAt(i),map.get(n.charAt(i))+1);
}
}
for(char i:map.keySet())
{
if(map.get(i)!=1){
flag2=1;
break;
}
}
if(flag==1&&flag2==0&&l==5){
System.out.println("Yes");
}
else {
System.out.println("No");
}
for(char i:map.keySet())
{
map.replace(i,0);
}
--t;
}
}
}
*/
public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t>0)
{
int flag=0;
int n = sc.nextInt();
String a = sc.next();
String b = sc.next();
for(int i=0;i<n;++i)
{
if(a.charAt(i)=='R'&&b.charAt(i)=='G' || a.charAt(i)=='R'&&b.charAt(i)=='B')
{
flag = 1;
break;
}
if(a.charAt(i)=='G'&&b.charAt(i)=='R' || a.charAt(i)=='B'&&b.charAt(i)=='R')
{
flag = 1;
break;
}
}
if(flag==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 17
|
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
|
350ffa7898c4484d3493a883afd427a3
|
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;
/* The pain you feel today will be the strength you feel tomorrow */
public class Bb {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
for (int z = 0; z < t; z++) {
int n = in.nextInt();
String s = in.next();
String ss = in.next();
boolean f = true;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == 'R') {
if (ss.charAt(i) != 'R') {
f = false;
break;
}
} else if (s.charAt(i) == 'B' || s.charAt(i) == 'G') {
if (ss.charAt(i) != 'B' && ss.charAt(i) != 'G') {
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 17
|
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
|
e009890ee36482115600192214556615
|
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 Codeforces
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while(t > 0)
{
boolean f =true;
int n = in.nextInt();
String s1 = in.next();
String s2 = in.next();
for(int i = 0 ; i < s1.length() ; i++)
{
if(s1.charAt(i)=='R')
{
if(s2.charAt(i)=='R')
{
f=true;
}
else if(s2.charAt(i)!='R')
{
f=false;
break;
}
}
else if(s1.charAt(i)=='B' || s1.charAt(i)=='G' )
{
if(s2.charAt(i)=='B' || s2.charAt(i)=='G')
{
f=true;
}
else if(s2.charAt(i)=='R')
{
f=false;
break;
}
}
}
if(f==false)
System.out.println("NO");
else
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 17
|
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
|
cfa4ead169345f925dd21120061cb331
|
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
|
//...........................tesla12........................................//
import java.util.*;
public class sec{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int t= sc.nextInt();
while(t-->0){
{
int size=sc.nextInt();
String S1=sc.next();
String S2=sc.next();
int count=0;
for(int i=0;i<size;i++){
if(S1.charAt(i)=='R' && (S2.charAt(i)=='B'|| S2.charAt(i)=='G')){
count++;
} else if(S2.charAt(i)=='R' && (S1.charAt(i)=='B'|| S1.charAt(i)=='G')) {
count++;
}}
if(count>0){
System.out.println("NO");
}
else System.out.println("YES");
}
}
}
}
//.........................tesla12........................................//
|
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 17
|
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
|
06c673d3e4843a1cc1f5deaf19b7c04d
|
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); // green and blue is same
int t=sc.nextInt();
for(int q=0; q<t; q++)
{ int n=sc.nextInt();
String s=sc.next();
String s1=sc.next();
boolean nice=true;
for(int z=0; z<n; z++)
{ if(s.charAt(z)==s1.charAt(z)){continue;}
else if(s.charAt(z)=='G' && s1.charAt(z)=='B') {continue; }
else if(s.charAt(z)=='B' && s1.charAt(z)=='G') {continue; }
else{nice=false; }
}
if(nice){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 17
|
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
|
c5e34193d2c6a2d23743e5bfdec0a130
|
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.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
public class Colorblindness {
public static void main(String[] args) {
Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int t = in.nextInt();
for (int a = 0; a < t; a++) {
int n = in.nextInt();
in.nextLine();
String s1 = in.nextLine();
String s2 = in.nextLine();
boolean same = true;
for (int i = 0; i < n; i++) {
if (s1.charAt(i)=='R' ^ s2.charAt(i)=='R') {
same = false;
break;
}
}
System.out.println((same)?"YES":"NO");
}
in.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 17
|
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
|
ad594c8d92c5deee2355a16a332ced1c
|
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 trial {
// For fast input output
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
try {
br = new BufferedReader(
new FileReader("input.txt"));
PrintStream out = new PrintStream(new FileOutputStream("output.txt"));
System.setOut(out);
} catch (Exception e) {
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;
}
}
// end of fast i/o code
public static void main(String[] args) {
FastReader in = new FastReader();
int t = in.nextInt();
while (t > 0) {
int n = in.nextInt();
String str = in.nextLine();
String ptr = in.nextLine();
boolean flag = false;
for (int i = 0; i < n; i++) {
if (str.charAt(i) != ptr.charAt(i)) {
if (!((str.charAt(i) == 'B' && ptr.charAt(i) == 'G')
|| (str.charAt(i) == 'G' && ptr.charAt(i) == 'B')))
flag = true;
}
}
if (flag)
System.out.println("NO");
else
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 17
|
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
|
0a889f784fd83f7260ed07c73bffca26
|
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 BColourblindness {
// For fast input output
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{ try {br = new BufferedReader(
new FileReader("input.txt"));
PrintStream out = new PrintStream(new FileOutputStream("output.txt"));
System.setOut(out);}
catch(Exception e) { 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;
}
}
// end of fast i/o code
public static void main(String[] args) {
FastReader reader = new FastReader();
long t = reader.nextLong();
while (t > 0) {
int n = reader.nextInt();
String str1 = reader.nextLine();
String str2 = reader.nextLine();
boolean same = true;
for(int i = 0; i < n; i++) {
char ch1 = str1.charAt(i);
char ch2 = str2.charAt(i);
if(ch1 == ch2 || (ch1 == 'B' && ch2 == 'G') || (ch1 == 'G' && ch2 == 'B'))
continue;
else
same = false;
}
if(same) 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 17
|
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
|
eed83db917bf3b018ac67b84ad720997
|
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 myScanner = new Scanner(System.in);
int t = Integer.parseInt(myScanner.nextLine());
while(t-->0){
int len = Integer.parseInt(myScanner.nextLine());
char[] r1 = myScanner.nextLine().toCharArray();
char[] r2 = myScanner.nextLine().toCharArray();
for(int i=0; i<len; i++){
if(r1[i]=='G'){
r1[i] = 'B';
}
if(r2[i]=='G'){
r2[i] = 'B';
}
}
String temp = new String(r1), temp2 = new String(r2);
if(temp.equals(temp2)){
System.out.println("YES");
} else {
System.out.println("NO");
}
}
myScanner.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 17
|
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
|
3c6d61f161ac3466b2df39691a7ce8e7
|
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 cf;
import java.util.Arrays;
import java.util.Scanner;
public class Prob1647C {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = Integer.parseInt(sc.next());
while(T != 0) {
int n = Integer.parseInt(sc.next());
String r1 = sc.next();
String r2 = sc.next();
r1 = r1.replace('B', 'G');
r2 = r2.replace('B', 'G');
// System.out.print(r1+ " " + r2);
if (r1.equals(r2)) {
System.out.println("YES");
}else {
System.out.println("NO");
}
T--;
}
}
}
////package cf;
//
//import java.util.Arrays;
//import java.util.Scanner;
//
//public class Prob1647C {
// public static void main(String[] args) {
// Scanner sc = new Scanner(System.in);
// int T = Integer.parseInt(sc.next());
//
// while(T != 0) {
// int n = Integer.parseInt(sc.next());
// String s = sc.next();
// char[] sarr = s.toCharArray();
// Arrays.sort(sarr);
// String original = "Timur";
//
// if (n == 5) {
// char[] oarr = original.toCharArray();
// Arrays.sort(oarr);
// boolean flag = true;
// for(int i = 0; i<s.length();i++) {
// if (sarr[i] != oarr[i])
// flag = false;
// }
// if (flag) {
// System.out.println("YES");
// }else {
// System.out.println("NO");
// }
// }
// 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 17
|
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
|
9b9616ce1295c7f8559114fa7bece906
|
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 boolean isCheck(String str,String str2,int i){
if(i==str.length()){
return true;
}
if(str.charAt(i)==str2.charAt(i)){
return isCheck(str,str2,i+1);
}
else if(str.charAt(i)=='B' && str2.charAt(i)=='G'){
return isCheck(str,str2,i+1);
}
else if(str.charAt(i)=='G' && str2.charAt(i)=='B'){
return isCheck(str,str2,i+1);
}
else{
return false;
}
}
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int x;
String str;
String str2;
while(n>0){
x=sc.nextInt();
sc.nextLine();
str=sc.nextLine();
str2=sc.nextLine();
boolean isTrue=isCheck(str,str2,0);
if(isTrue){
System.out.println("Yes");
}
else{
System.out.println("No");
}
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 17
|
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
|
e4cb88fdee4e8ebfdd82df5460116a4c
|
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 Colourblindness {
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();
s1 = s1.replace("G", "B");
s1 = s1 .substring(0, n);
String s2 = sc.next();
s2 = s2.replace("G", "B");
s2 = s2 .substring(0, n);
if(s1.compareTo(s2) == 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 17
|
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
|
8d8a38f61d7765d69267e1cfb3df8610
|
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 guess {
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 ss =sc.next();
int c=0;
int x ='G';
x+='B';
for(int i=0;i<n;i++)
if(s.charAt(i)==ss.charAt(i)||s.charAt(i)+ss.charAt(i)==x) {
c++;
}
if(c!=n )
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 17
|
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
|
fd450d01b1186b0abf0ba27cfa83109c
|
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 Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int Times = in.nextInt();
while(Times-- > 0){
int length = in.nextInt();
String str1 = in.next();
String str2 = in.next();
int flag = -1;
HashMap<Integer,Character> hMap = new HashMap<>();
for(int i = 0;i < str1.length();i++){
hMap.put(i,str1.charAt(i));
}
for (int i = 0;i < str2.length();i++){
if(hMap.get(i) != str2.charAt(i)){
if((hMap.get(i) == 'G' && str2.charAt(i) == 'B') || (hMap.get(i) == 'B' && str2.charAt(i) == 'G')){
continue;
}else{
flag = 1;
break;
}
}
}
if(flag == -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 17
|
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
|
77deedd5c85cb67d1587b989c41a7433
|
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 Colourblindness {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int n=input.nextInt();
for(int j=0;j<n;j++){
int t=input.nextInt(),x=0;
String s1=input.next(),s2=input.next();
for (int i = 0; i < s1.length(); i++)
if((s1.charAt(i)==s2.charAt(i))||(s1.charAt(i)=='G'&&s2.charAt(i)=='B')||(s1.charAt(i)=='B'&&s2.charAt(i)=='G'))
x++;
System.out.println((x==s1.length())?"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 17
|
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
|
fd3e50b9770720b110f20890faf02d6a
|
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 boolean colourBlind(String str1 , String str2) {
for(int i=0 ; i< str1.length() ; i++){
if(str1.charAt(i) == 'R'){
if(str2.charAt(i) != 'R'){
return false ;
}
}else{
if(str2.charAt(i) == 'R'){
return false ;
}
}
}
return true ;
}
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();
boolean ans = colourBlind(str1 , str2) ;
if(ans == true) {
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 17
|
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
|
f092bbeb0b56514d619fdd8ef470bacf
|
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 class Pair {
int x;
int y;
public Pair(int x, int y) {
this.x = x;
this.y = y;
}
}
private static final int modulo = 1000000007;
public static Scanner scan = new Scanner(System.in);
public static void main(String[] args){
int testCase = scan.nextInt();
for (int vedant = 0; vedant < testCase; vedant++) {
solve();
}
// out.println(5);
}
private static void solve() {
// ******************** S O L V E M E T H O D *****************
// ************* M A I N L O G I C G O E S H E R E **********
int size = scan.nextInt();
String firstStr = scan.next();
String secondStr = scan.next();
firstStr = firstStr.replaceAll("G", "B");
secondStr = secondStr.replaceAll("G", "B");
boolean isSame = true;
for (int i = 0; i < size; i++) {
if (firstStr.charAt(i) != secondStr.charAt(i)) {
// System.out.println("firstStr.charAt(i) = " + firstStr.charAt(i));
isSame = false;
break;
}
}
if (isSame) {
printYES();
} else {
printNO();
}
// **************************** S O L U T I O N E N D S H E R E ****************************
}
private static void printArray(int[] arr) {
StringBuilder output = new StringBuilder();
for (int j : arr) {
output.append(j).append(" ");
}
System.out.println(output);
}
private static void printYES() {
System.out.println("YES");
}
private static void printNO() {
System.out.println("NO");
}
private static long getMaximumFromList(List<Long> arr) {
long max = Long.MIN_VALUE;
for (Long aLong : arr) {
max = Math.max(max, aLong);
}
return max;
}
public static int binarySearch(int[] arr, int target) {
int starting = 0;
int ending = arr.length - 1;
while (starting < ending) {
int mid = starting + (ending - starting) / 2;
if (arr[mid] == target) {
return mid;
}
if (arr[mid] > target) {
ending = mid - 1;
} else {
starting = mid + 1;
}
}
return -1;
}
public static int binarySearch(long[] arr, long target) {
int starting = 0;
int ending = arr.length - 1;
while (starting < ending) {
int mid = starting + (ending - starting) / 2;
if (arr[mid] == target) {
return mid;
}
if (arr[mid] > target) {
ending = mid - 1;
} else {
starting = mid + 1;
}
}
return -1;
}
public static int gcd(int a, int b) {
// Everything divides 0
if (a == 0)
return b;
if (b == 0)
return a;
// base case
if (a == b)
return a;
// a is greater
if (a > b)
return gcd(a-b, b);
return gcd(a, b-a);
}
public static long gcd(long a, long b) {
// Everything divides 0
if (a == 0)
return b;
if (b == 0)
return a;
// base case
if (a == b)
return a;
// a is greater
if (a > b)
return gcd(a-b, b);
return gcd(a, b-a);
}
private static int[] readIntArray(int size) {
int[] arr = new int[size];
for (int i = 0; i < size; i++) {
arr[i] = scan.nextInt();
}
return arr;
}
private static long[] readLongArray(int size) {
long[] arr = new long[size];
for (int i = 0; i < size; i++) {
arr[i] = scan.nextLong();
}
return arr;
}
private static boolean isVowel(char charAt) {
charAt = Character.toLowerCase(charAt);
return charAt == 'a' ||
charAt == 'e' ||
charAt == 'i' ||
charAt == 'o' ||
charAt == 'u';
}
}
|
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 17
|
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
|
df8d254cea68dccf41e6406e1bbe3491
|
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 B1722 {
public static void main(String[] args) throws Exception {
final Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int i = 0; i < t; i++) {
fn(sc);
}
}
private static void fn(Scanner sc) {
int n = sc.nextInt();
var xs = sc.next();
var ys = sc.next();
for (int i = 0; i < n; i++) {
char x = xs.charAt(i);
char y = ys.charAt(i);
if (x == y) {
continue;
}
if (x == 'G' && y == 'B') {
continue;
}
if (x == 'B' && y == 'G') {
continue;
}
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 17
|
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
|
8ea447efc4c49fd302bd7757fd587f64
|
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 New{
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();
String garb = sc.nextLine();
String a = sc.nextLine();
String b = sc.nextLine();
int flag = 0;
for(int j=0;j<n;j++){
if(a.charAt(j)=='R'){
if( b.charAt(j)!='R'){
System.out.println("NO");
flag+=1;
break;
}
}
else if(b.charAt(j)=='R'){
if( a.charAt(j)!='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 17
|
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
|
3eb97d4ffbce54a0f39d07cc4fc46cb4
|
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 sc = new Scanner(System.in);
int t = sc.nextInt();
Outer : while(t-- > 0){
int n = sc.nextInt();
String one = sc.next();
String two = sc.next();
for(int i = 0;i<n;++i){
if(one.charAt(i) != two.charAt(i) && (one.charAt(i) == 'R' || two.charAt(i) == 'R')){
System.out.println("no");
continue Outer;
}
}
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 17
|
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
|
bd5c0af3e0cd9153b2c52e6d790d0b60
|
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 HelloWorld {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
while(n>0){
int x=sc.nextInt();
String s1=sc.next();
char c1[]=s1.toCharArray();
for(int i=0;i<s1.length();i++){
if(c1[i]=='G')
c1[i]='B';
}
String s2=sc.next();
char c2[]=s2.toCharArray();
for(int i=0;i<s2.length();i++){
if(c2[i]=='G')
c2[i]='B';
}
boolean fl=true;
for(int i=0;i<s1.length();i++){
if(c1[i]!=c2[i])
fl=false;
}
if(fl==true)
System.out.println("YES");
else
System.out.println("NO");
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 17
|
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
|
5813722362242a786f51d56289de880c
|
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 Abai {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
byte t = sc.nextByte();
while (t-- > 0){
byte n = sc.nextByte();
sc.nextLine();
String a = sc.nextLine();
String b = sc.nextLine();
byte temp = 1;
for (int i = 0; i < n; i++) {
if(a.charAt(i) == 'R' && b.charAt(i)!='R'){
temp = -1;
break;
}else if(a.charAt(i) != 'R' && b.charAt(i) == 'R'){
temp = -1;
break;
}
}
if(temp==-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 17
|
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
|
56a30b5512b65aed30037b8a41547df6
|
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 Solve {
private static void solve(Scanner sc) {
int len = sc.nextInt();
String s1 = new String(sc.next());
String s2 = new String(sc.next());
boolean flag = true;
for (int i = 0; i < len; i++) {
if (s1.charAt(i) == 'R') {
if (s2.charAt(i) != 'R') {
flag = false;
}
} else if (s1.charAt(i) == 'B') {
if (s2.charAt(i) == 'R') {
flag = false;
}
} else if (s1.charAt(i) == 'G') {
if (s2.charAt(i) == 'R') {
flag = false;
}
}
}
if (flag == true) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int tt = scanner.nextInt();
while (tt-- > 0) {
solve(scanner);
}
}
}
|
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 17
|
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
|
fcb90aa899e08cb457271ec3ab307b57
|
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 Solution {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int testCase = Integer.parseInt(br.readLine());
for (int i = 0; i < testCase; i++) {
br.readLine();
String x = br.readLine();
String y = br.readLine();
x = x.replace('G', 'B');
y = y.replace('G', 'B');
if (x.equals(y)) 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 17
|
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
|
d4d4bfaf0e54462873f2f1e5bd8864f4
|
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 scan=new Scanner (System.in);
int cases;
int colnum;
String s1;
String s2;
char[] c1;
char[] c2;
cases=scan.nextInt();
for (int i=0; i<cases; i++){
colnum=scan.nextInt();
s1=scan.next();
s2=scan.next();
s1=s1.replace("G","B");
s2=s2.replace("G", "B");
c1=s1.toCharArray();
c2=s2.toCharArray();
if (s1.length()==colnum && s2.length()==colnum){
if( Arrays.equals(c1, c2))
res("y");
else
res("n");
}
}
}
static void res(String r){
if (r=="y")
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 17
|
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
|
b729eeb9f713e8f9feb23e25fbb08a79
|
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.ArrayList;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class B_Colourblindness {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int testCase=input.nextInt();
for(int i=0;i<testCase;i++){
int col=input.nextInt();
String word1=input.next();
String word2=input.next();
boolean enter=true;
for(int w=0;w<col;w++){
if((word1.charAt(w)=='R' && word2.charAt(w)!='R') || (word2.charAt(w)=='R' && word1.charAt(w)!='R')){
enter=false;
break;
}
}
if(enter)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
|
04ff75de24627155122fe8727ecea446
|
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 colourblindess {
public static void main(String[]args){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
int count = 0;
int counter =0;
String [] ans = new String[t];
while(t-- >0){
counter = 0;
int n = sc.nextInt();
String s1 = sc.next();
String s2 = sc.next();
for(int i = 0; i<n;i++){
char c1 = s1.charAt(i);
char c2 = s2.charAt(i);
if(c1 != 'R' && c2!='R')//1
{
continue;
} else if (c1 == 'R' && c2=='R')//2
{
continue;
}else {
ans[count] = "NO";
count++;
counter++;
break;
}}
if(counter==0){
ans[count] ="YES";
count++;
counter = 0;
}
}
for(int i = 0;i<ans.length;i++){
System.out.println(ans[i]);
}
}
}
|
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
|
6ab40cdda3b8b35190b12a37321442e9
|
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 colourblindess {
public static void main(String[]args){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
int count = 0;
int counter =0;
String [] ans = new String[t];
while(t-- >0){
counter = 0;
int n = sc.nextInt();
String s1 = sc.next();
String s2 = sc.next();
for(int i = 0; i<n;i++){
char c1 = s1.charAt(i);
char c2 = s2.charAt(i);
if(c1 != 'R' && c2!='R')//1
{
continue;
} else if (c1 == 'R' && c2=='R')//2
{
continue;
}else {
ans[count] = "NO";
count++;
counter++;
break;
}}
if(counter==0){
ans[count] ="YES";
count++;
counter = 0;
}
}
for(int i = 0;i<ans.length;i++){
System.out.println(ans[i]);
}
}
}
|
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
|
abe3a34181b511ed929fb68e1c4d2d68
|
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 sol{
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();
String s1=sc.next();
String s2=sc.next();
int c=0;
for(int j=0;j<n;j++){
if(s1.charAt(j)==s2.charAt(j))
c++;
else if(s1.charAt(j)=='B' && s2.charAt(j)=='G')
c++;
else if(s2.charAt(j)=='B' && s1.charAt(j)=='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 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
|
65e5c29a36481ab1ecd9b641411e3b0a
|
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'); // loại bỏ một chữ cái B, thay vào G
String str4=str2.replace('B', 'G'); // loại bỏ một chữ cái B, thay vào G
if(str3.equals(str4) == true){
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 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
|
169fcff6254768efc012320b2f63d8f3
|
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 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
|
00efdad07c14906a79131b089c846843
|
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 Solve {
static final int MOD = 1000000007;
static int count = 0;
public static void main(String[] args) {
Reader in = new Reader();
PrintWriter out = new PrintWriter(System.out);
int t = in.readInt();
while (t-- > 0)
solve(in, out);
out.close();
}
private static void solve(Reader in, PrintWriter out) {
int n = in.readInt();
String s = in.readLine();
String s2 = in.readLine();
var isDifferent = false;
for (int i = 0; i < n; i++) {
if ((s.charAt(i) == 'R' && s2.charAt(i)!= 'R') || s2.charAt(i) == 'R' && s.charAt(i)!='R'){
isDifferent = true;
break;
}
}
if (isDifferent) out.println("no");
else out.println("yes");
}
private static int lowerBound(int[] nums, int target) {
int low = 0;
int high = nums.length - 1;
int ans = -1;
while (low <= high) {
int mid = low + (high - low) / 2;
if (nums[mid] == target) {
ans = mid;
high = mid - 1;
} else {
if (nums[mid] > target) {
high = mid - 1;
} else {
low = mid + 1;
}
}
}
return ans;
}
private static int upperBound(int[] nums, int target) {
int low = 0;
int high = nums.length - 1;
int ans = -1;
while (low <= high) {
int mid = low + (high - low) / 2;
if (nums[mid] == target) {
ans = mid;
low = mid + 1;
} else {
if (nums[mid] > target) {
high = mid - 1;
} else {
low = mid + 1;
}
}
}
return ans;
}
private static long power(long n, long p, long m) {
long result = 1;
while (p > 0) {
if (p % 2 == 1)
result = (result * n) % m;
n = (n * n) % m;
p >>= 1;
}
return result;
}
private int gcd(int a, int b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
private static void sort(int a[], int n) {
List<Integer> list = new ArrayList<>();
for (int i : a)
list.add(i);
Collections.sort(list);
for (int i = 0; i < n; i++)
a[i] = list.get(i);
}
private static void sieve(int n) {
boolean[] prime = new boolean[n];
for (int i = 0; i < n; i++)
prime[i] = true;
for (int i = 2; i * i < n; i++) {
if (prime[i]) {
for (int j = i * i; j < n; j += i)
prime[j] = false;
}
}
for (int i = 2; i < prime.length; i++) {
if (prime[i])
System.out.print(i + " ");
}
}
private static void segmentedSieve(int low, int high) {
int sqrt = (int) Math.sqrt(high);
int[] prime = new int[sqrt + 1];
boolean[] arr = new boolean[sqrt + 1];
for (int i = 0; i <= sqrt; i++)
arr[i] = true;
int k = 0;
for (int i = 2; i <= sqrt; i++) { // generate all prime numbers till square root of high
if (arr[i]) {
prime[k] = i;
k++;
for (int j = i * i; j <= sqrt; j += i)
arr[j] = false;
}
}
// System.out.println(Arrays.toString(prime));
int diff = high - low + 1; // arr size of required length
arr = new boolean[diff];
for (int i = 0; i < diff; i++)
arr[i] = true;
for (int i = 0; i < k; i++) { // mark false to multiple of prime numbers in the range of low to high
int div = (low / prime[i]) * prime[i]; // It gives multiple of prime[i] nearest to low
if (div < low || div == prime[i])
div += prime[i];
for (int j = div; j <= high; j += prime[i]) {
if (j != prime[i])
arr[j - low] = false;
}
}
for (int i = 0; i < diff; i++) { // print prime numbers in the given segment
if (arr[i] && (i + low) != 1) {
System.out.print(i + low + " ");
}
}
System.out.println();
}
static class Pair implements Comparable<Pair> {
int a;
int b;
public Pair(int a, int b) {
this.a = a;
this.b = b;
}
@Override
public int compareTo(Pair o) {
if (this.a > o.a)
return this.a - o.a;
else if (this.a < o.a)
return this.b - o.b;
else
return 0;
}
}
static class Reader {
BufferedReader br;
StringTokenizer st;
public Reader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String read() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int readInt() {
return Integer.parseInt(read());
}
String readLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
long readLong() {
return Long.parseLong(read());
}
double readDouble() {
return Double.parseDouble(read());
}
int[] readIntArray(int n) {
int[] arr = new int[n];
for (int i = 0; i < n; i++)
arr[i] = readInt();
return arr;
}
long[] readLongArray(int n) {
long[] arr = new long[n];
for (int i = 0; i < n; i++)
arr[i] = readLong();
return arr;
}
}
}
|
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
|
34e2ae369624f5e736cd9f721d76f6cc
|
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 Codecheaf
{
public static void main(String args[] ) throws Exception {
// Write your code here
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();
char[] ch1=str1.toCharArray();
char[] ch2=str2.toCharArray();
boolean f=false;
for(int i=0;i<str1.length();i++) {
if(ch1[i]=='R' && ((ch2[i]=='G') || (ch2[i]=='B')) ) {
System.out.println("NO");
f=true;
break;}
else if(((ch1[i]=='G') || (ch1[i]=='B')) && ch2[i]=='R') {
System.out.println("NO");
f=true;
break;
}
}
if(f==false)
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
|
1dfd89f1b8b0eb52f2806f2c71cb17b8
|
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 Main {
static FastReader in=new FastReader();
static final Random random=new Random();
static long mod=1000000007L;
static HashMap<String,Integer>map=new HashMap<>();
public static void main(String args[]) throws IOException {
int t=in.nextInt();
StringBuilder res=new StringBuilder();
loop:
while(t-->0)
{
int n= in.nextInt();
String str1=in.nextLine();
String str2= in.nextLine();
for (int i = 0; i < n; i++) {
if (str1.charAt(i) == 'B'){
str1 = str1.substring(0, i) + 'G' + str1.substring(i + 1);
}
if (str2.charAt(i) == 'B') {
str2 = str2.substring(0, i) + 'G' + str2.substring(i + 1);
}
}
if (str1.equals(str2)){
res.append("YES"+"\n");
}else{
res.append("NO"+"\n");
}
}
print(res);
}
static int max(int a, int b)
{
if(a<b)
return b;
return a;
}
static void ruffleSort(int[] a) {
int n=a.length;
for (int i=0; i<n; i++) {
int oi=random.nextInt(n), temp=a[oi];
a[oi]=a[i]; a[i]=temp;
}
Arrays.sort(a);
}
static < E > void print(E res)
{
System.out.println(res);
}
static int gcd(int a,int b)
{
if(b==0)
{
return a;
}
return gcd(b,a%b);
}
static int lcm(int a, int b)
{
return (a / gcd(a, b)) * b;
}
static int abs(int a)
{
if(a<0)
return -1*a;
return a;
}
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;
}
}
}
|
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
|
3ffd5b8a4cfa3e8563a280c3cf690b0e
|
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 CodeForces31_8 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
for (int i = 0; i < t ; i++) {
int s = in.nextInt();
String s1 = in.next();
String s2 = in.next();
boolean x = true;
for (int j = 0; j < s; j++) {
if (s1.charAt(j) == 'R' && (s2.charAt(j) == 'G' || s2.charAt(j) == 'B')){
x = false;
break;
}
if (s2.charAt(j) == 'R' && (s1.charAt(j) == 'G' || s1.charAt(j) == 'B')){
x = false;
break;
}
}
if (x) 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
|
2e1217f11ca5d9cee276e38da444f846
|
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 Div2 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int count=0;
for (int i = 0; i < n; i++) {
int num=sc.nextInt();
String str1=sc.next();
String str2=sc.next();
String str3=str1.replace('B', 'G');
String str=str2.replace('B', 'G');
for (int j = 0; j < num; j++) {
if(str3.charAt(j)==str.charAt(j)){
count ++;
}
}
if(count ==num){
System.out.println("YES");
}
else{
System.out.println("NO");
}
count=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
|
d4e4a043fb92be6ad386b1f8de1d8eaa
|
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 CodeforcesB {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc =new Scanner(System.in);
int t=sc.nextInt();
for(int k=0;k<t;k++) {
int col = sc.nextInt();
String row1 = sc.next();
String row2=sc.next();
solve(row1,row2);
}
}
public static void solve(String row1,String row2) {
//Scanner sc =new Scanner(System.in);
boolean flag=true;
if(row1.equals(row2))
flag=true;
// if(!(countR(row1,row2)))
// return false;
else
{
for(int i=0;i<row1.length();i++)
{
if( (row1.charAt(i)=='B'&& row2.charAt(i)=='G') ||(row1.charAt(i)=='G' && row2.charAt(i)=='B') || (row1.charAt(i)==row2.charAt(i)))
continue;
else
{ flag=false;
System.out.println("NO");
break;
}
}
}
if(flag)
System.out.println("YES");
}
// public static boolean countR(String s,String x) {
// int count1=0,count2=0;
// for(int i=0;i<s.length();i++)
// {
// if(s.charAt(i)=='R')
// count1++;
// }
// for(int i=0;i<x.length();i++)
// {
// if(x.charAt(i)=='R')
// count2++;
//
// }
// return count1==count2;
// }
}
|
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
|
32a7d5dbe2695da6f6cd1db0f8ceab33
|
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[] 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();
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
|
828231a33d4d46d851ac3d2c79fb9895
|
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) throws Exception {
Scanner in = new Scanner(System.in);
int testCases = in.nextInt();
for (int i = 0; i < testCases; i++) {
int l = in.nextInt();
String w1 = in.next();
String w2 = in.next();
isTheSame(w1, w2);
}
in.close();
}
public static void isTheSame(String a, String b) {
String A = "", B = "";
int LOA = a.length(), LOB = b.length();
for (int i = 0; i < LOA; i++) {
if (a.charAt(i) == 'G') {
A += 'B';
} else {
A += a.charAt(i);
}
}
for (int i = 0; i < LOB; i++) {
if (b.charAt(i) == 'G') {
B += 'B';
} else {
B += b.charAt(i);
}
}
if (A.equals(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
|
fedf43c607959efdd98b81e30cb1e077
|
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 ColorBlindness {
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 r1 = 0, g1 = 0, b1 = 0;
int r2 = 0, g2 = 0, b2 = 0;
int c = sc.nextInt();
String s1 = sc.next();
String s2 = sc.next();
boolean check = false;
for (int i = 0; i < c; i++) {
char a = s1.charAt(i);
char b = s2.charAt(i);
if (a == 'R') {
if (a != b) {
break;
}
} else {
if (a == 'G') {
if (b == 'R') {
break;
}
} else if (a == 'B') {
if (b == 'R') {
break;
}
}
}
if (i == c - 1) {
check = true;
}
}
if (check == 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
|
dbf8d97e2e77c20c8ec25fe9158a4c04
|
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 cons {
public static void main(String [] args){
Scanner in =new Scanner (System.in);
int t=in.nextInt();
String r1,r2;
for(int i=0;i<t;i++){
int size=in.nextInt();
r1=in.next();
r2=in.next();
r1=r1.replace('B', 'G');
r2=r2.replace('B', 'G');
if(r1.equals(r2))
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
|
cb8981ea1184b36f9db29f6706f56189
|
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 Main{
public static void main(String[] args)throws Exception{
BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(b.readLine());
while(t-->0){
int n = Integer.parseInt(b.readLine());
String s = b.readLine();
String s1 = b.readLine();
int i;
for(i=0;i<n;i++){
if((s.charAt(i)=='R' && s1.charAt(i)!='R') || (s.charAt(i)!='R' && s1.charAt(i)=='R')){
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
|
8cbe6d239fddf5c91d49a2114132128f
|
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 PatternsProblems{
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();
StringBuilder sb1 = new StringBuilder("");
StringBuilder sb2 = new StringBuilder("");
for(int i = 0;i<str1.length();i++){
if(str1.charAt(i) == 'R'){
sb1.append(str1.charAt(i));
}
else if(str1.charAt(i) == 'G' ){
sb1.append("B");
}
else{
sb1.append(str1.charAt(i));
}
}
for(int i = 0;i<str2.length();i++){
if(str2.charAt(i) == 'R'){
sb2.append(str2.charAt(i));
}
else if(str2.charAt(i) == 'G' ){
sb2.append("B");
}
else{
sb2.append(str2.charAt(i));
}
}
// System.out.println(sb1.toString());
// System.out.println(sb1.toString());
if(sb1.toString().equals(sb2.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 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
|
71b6c384997dcd170a8f1822ee8f96f9
|
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 Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int test = sc.nextInt();
while(test --> 0){
int n = sc.nextInt();
String s1 = sc.next();
String s2 = sc.next();
int status = 0;
for(int i = 0; i < n;i++){
char c1 = s1.charAt(i);
char c2 = s2.charAt(i);
if((c1 == 'R' && c2 == 'G')){
status = 1;
}else if((c1 == 'R' && c2 == 'B')){
status = 1;
}else if((c1 == 'G' && c2 == 'R')){
status = 1;
}else if( (c1 == 'B' && c2 == 'R')){
status = 1;
}
}
System.out.println(status == 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
|
38278aeba2e14fc64b534a4664a8d339
|
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 Qb {
static int mod = (int) (1e9 + 7);
static void solve() {
int n = i();
char[] a = s().toCharArray();
char[] b = s().toCharArray();
for (int i = 0; i < a.length; i++) {
if (a[i] == 'B') {
a[i] = 'G';
}
}
for (int i = 0; i < b.length; i++) {
if (b[i] == 'B') {
b[i] = 'G';
}
}
for(int i=0;i<n;i++){
if(a[i]!=b[i]){
System.out.println("NO");
return;
}
}
System.out.println("YES");
}
public static char[] sortChar(char[] a2) {
ArrayList<Character> l = new ArrayList<>();
for (char i : a2)
l.add(i);
Collections.sort(l);
for (int i = 0; i < l.size(); i++)
a2[i] = l.get(i);
return a2;
}
public static void main(String[] args) {
int test = i();
while (test-- > 0) {
solve();
}
}
// ------> swap(long[]arr,int idx1,int idx2)<---- swap int
// ------>compareInt,compareLong,compareChar// return 0 if a==b, pos a>b
// neg a<b
// ------>compareStrng,comapareStringBuilder return true and false
// ----->segmentTree--> segTree as class
// ----->lazy_Seg_tree --> lazy_Seg_tree as class
// -----> Trie --->Trie as class
// ----->fenwick_Tree ---> fenwick_Tree
// -----> POWER ---> long power(long x, long y) <----
// -----> LCM ---> long lcm(long x, long y) <----
// -----> GCD ---> long gcd(long x, long y) <----
// -----> SIEVE --> ArrayList<Integer> sieve(int N) <-----
// -----> NCR ---> long ncr(int n, int r) <----
// -----> BINARY_SEARCH ---> int binary_Search(long[]arr,long x) <----
// -----> (SORTING OF LONG, CHAR,INT) -->long[] sortLong(long[] a2)<--
// ----> DFS ---> void dfs(ArrayList<ArrayList<Integer>>edges,int child,int
// parent)<---
// ---> NODETOROOT --> ArrayList<Integer>
// node2Root(ArrayList<ArrayList<Integer>>edges,int child,int parent,int tofind)
// <--
// ---> LEVELS_TREE -->levels_Trees(ArrayList<HashSet<Integer>> edges, int
// child, int parent,int[]level,int currLevel) <--
// ---> K_THPARENT --> int k_thparent(int node,int[][]parent,int k) <---
// ---> TWOPOWERITHPARENTFILL --> void twoPowerIthParentFill(int[][]parent) <---
// -----> (INPUT OF INT,LONG ,STRING) -> int i() long l() String s()<-
// tempstart
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int read() {
if (numChars == -1)
throw new InputMismatchException();
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0)
return -1;
}
return buf[curChar++];
}
public int Int() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int 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 String() {
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 boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public String next() {
return String();
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
static InputReader in = new InputReader(System.in);
public static int i() {
return in.Int();
}
public static long l() {
String s = in.String();
return Long.parseLong(s);
}
public static String s() {
return in.String();
}
}
|
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
|
22bfcf579ad37c84ad66c3383be75055
|
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
|
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
*/
//package javacodetester;
import java.util.*;
/**
*
* @author vishrut
*/
public class JavaCodeTester {
/**
* @param args the command line arguments
*/
static long power(long n,long ans){
if(n==0)return ans;
return ans=power(n-1,ans)*2;
}
static boolean prime(int n){
for(int i=2;i*i<=n;i++){
if(n%i==0)return false;
}
return true;
}
static long power(long x, int y, int p)
{
long res = 1; // Initialize result
x = x % p; // Update x if it is more than or
// equal to p
if (x == 0)
return 0; // In case x is divisible by p;
while (y > 0)
{
// If y is odd, multiply x with result
if ((y & 1) != 0)
res = (res * x) % p;
// y must be even now
y = y >> 1; // y = y/2
x = (x * x) % p;
}
return res;
}
static int gcd(int a,int b)
{
if(b%a==0)
return a;
return gcd(b%a,a);
}
static int sum (int a){
if(a==0)return 0;
return a%10+sum(a/10);
}
static long power (int a,int b){
if(b==0)return 1;
return a*power(a, b-1);
}
static String binary (long decimal){
if(decimal==0) return "";
return binary(decimal/2)+ Long.toString((decimal%2));
}
static boolean isPalindrome ( String a , int n){
if(a.charAt(n)!=a.charAt(a.length()-n-1))return false;
if(n==0) return true;
return isPalindrome (a, n-1);
}
static int fibonacci (int n){
if(n==1)return 0;
if(n==2)return 1;
return fibonacci(n-1)+fibonacci(n-2);
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
StringBuilder sb=new StringBuilder();
int t=sc.nextInt();
while(t-->0){
int n = sc.nextInt();
char a[][]=new char[2][n];
for(int i=0;i<2;i++){
String temp = sc.next();
for(int j=0;j<temp.length();j++){
a[i][j] = temp.charAt(j);
}
}
String ans = "YES";
for(int i=0;i<n;i++){
if(a[0][i] != a[1][i]){
if(a[0][i]=='R' || a[1][i]=='R'){
ans = "NO";
break;
}
}
}
System.out.println(ans);
//sb.append(ans);
//if(t!=0)sb.append("\n");
}
System.out.println(sb);
}
}
|
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
|
6d7f042158014a2118671faeb7e66749
|
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 Hello {
public static void main(String[] args) throws Exception{
Scanner sc=new Scanner(System.in);
int tc=sc.nextInt();
for(int j=0;j<tc;j++)
{
int n=sc.nextInt();
char[] s1=sc.next().toCharArray();
char[] s2=sc.next().toCharArray();
int x=0;
for(int i=0;i<n;i++)
{
if(s1[i]=='R' && s2[i]!='R' || s2[i]=='R' && s1[i]!='R')
{
x++;
System.out.println("NO");
break;
}
}
if(x==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
|
7dd86dddab3a8175ba7667ae38a7cde7
|
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.*;
/* 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
{
Scanner in = new Scanner(System.in);
int testcase = in.nextInt();
while(testcase --> 0){
int n = in.nextInt();
String var1 = "";
String var2 = "";
char arr[][] = new char[2][n];
for (int i = 0; i < 2; i++) {
String data = "";
if (in.hasNext()) { // input from user
data = in.next();
}
else {
break;
}
for (int j = 0; j < n; j++){
arr[i][j] = data.charAt(j);
if(arr[i][j] == 'G' || arr[i][j] == 'B'){
arr[i][j] = 'V';
}
if(i == 0){
var1 = var1+arr[i][j];
}
else{
var2 = var2+arr[i][j];
}
}
}
if(var1.equals(var2)){
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
|
e44c694897eb3c058fcf5b6c400a2c1b
|
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 Main
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
for(int i=0;i<n;i++)
{
int k=sc.nextInt();
String s=sc.next();
String s1=sc.next();
int sum2=check(s,s1);
if(sum2==1)
System.out.println("Yes");
else
System.out.println("No");
}
}
public static int check(String s,String s1)
{
int sum=0;
for(int i=0;i<s.length();i++)
{
if(s.charAt(i)==s1.charAt(i) )
sum++;
else if((s.charAt(i)=='B'&&s1.charAt(i)=='G')||(s.charAt(i)=='G'&&s1.charAt(i)=='B'))
sum++;
}
if(sum==s.length())
return 1;
else
return 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
|
6f31ec6382d4aa60e3b0acbf1f6d0019
|
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 CodeForces {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
while (t-- > 0) {
int n = Integer.parseInt(br.readLine());
String s1 = br.readLine();
String s2 = br.readLine();
boolean ans = true;
for (int i = 0; i < n; i++) {
if ( (s1.charAt(i) == 'R' && s2.charAt(i) != 'R') || (s1.charAt(i) != 'R' && s2.charAt(i) == 'R')) {
ans = false;
break;
}
}
if (ans)
System.out.println("YES");
else
System.out.println("NO");
}
br.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
|
564fa3fe1085079925b6127dd239bc95
|
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 contests.round817div4;
import java.util.*;
public class ColourBlindness {
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();
boolean flag = true;
for (int i = 0; i < str1.length(); i++) {
if (str1.charAt(i) == str2.charAt(i) || (str1.charAt(i) == 'B' && str2.charAt(i) == 'G')
|| (str1.charAt(i) == 'G' && str2.charAt(i) == 'B'))
continue;
else {
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
|
b13e5f7cb1774f28c10ec914f3efaa30
|
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 Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
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();
int check=0;
for(int i=0;i<n;i++)
{
if(s1.charAt(i)!=s2.charAt(i))
{
if(s1.charAt(i)=='R' || s2.charAt(i)=='R')
{
check=1;
break;
}
}
}
if(check==1)
System.out.println("NO");
else
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
|
4e394a9fe54bb63ac0e5b62a2e8665ce
|
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 CodeForces {
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();
boolean flag=true;
for (int i = 0; i <n ; i++) {
int s1Red=0,s2Red=0;
if(s1.charAt(i)=='R')
{
if(s2.charAt(i)!='R'){
flag=false;
break;
}
}
if(s2.charAt(i)=='R')
{
if(s1.charAt(i)!='R'){
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
|
e10720c6627bd636842d0a16c2511836
|
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.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.stream.IntStream;
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
// public static boolean areSame(ArrayList<Integer> list)
// {
// Integer first = list.get(0);
// for (int i=1; i<list.size(); i++)
// if (list.get(i) != first)
// return false;
// return true;
// }
// public static int maxOfArray( int[] array, int idx, int max ) {
// if ( idx == array.length ) {
// return max;
// }
// if ( array[idx] > max ) {
// max = array[idx];
// }
// return maxOfArray( array, idx + 1, max );
// }
// public static int minOfArray( int[] array, int idx, int min ) {
// if ( idx == array.length ) {
// return min;
// }
// if ( min > array[idx] ) {
// min = array[idx];
// }
// return minOfArray( array, idx + 1, min );
// }
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;
}
}
static int[] rev(int a[], int n)
{
int[] b = new int[n];
int j = n;
for (int i = 0; i < n; i++) {
b[j - 1] = a[i];
j = j - 1;
}
return b;
}
public static String sortString(String inputString)
{
char tempArray[] = inputString.toCharArray();
Arrays.sort(tempArray);
return new String(tempArray);
}
public static void main(String[] args) throws IOException
{
// your code goes here
FastReader sc = new FastReader();
Scanner sca=new Scanner(System.in);
int t=sc.nextInt();
BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out));
while(t--!=0){
int n=sc.nextInt();
String row1=sc.next();
String row2=sc.next();
int ans=0;
for(int i=0;i<n;i++){
if(row1.charAt(i) == row2.charAt(i)){
ans++;
}else if(row1.charAt(i)=='G' && row2.charAt(i)=='B'){
ans++;
}else if(row1.charAt(i)=='B' && row2.charAt(i)=='G'){
ans++;
}
}
if(ans==n) System.out.println("yes");
else System.out.println("no");
// 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
|
9d236b618152fc43cd706f98cd585932
|
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 Problem{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a = 0;
outer:
while(n--!=0){
a = sc.nextInt();
String s = sc.next();
String s1 = sc.next();
for(int i = 0;i<a;i++){
int c = 0;
if(s.charAt(i) == 'R' ) c++;
if(s1.charAt(i) == 'R' ) c++;
if(c==1){
System.out.println("NO");
continue outer;
}
}
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
|
96833d5a9a7101a493aac2a6dccd3e8e
|
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();
for(int k=0;k<t;k++){
int n=sc.nextInt();
String s=sc.next();
String g=sc.next();
int c=0;
for(int i=0;i<n;i++){
if(s.charAt(i)=='R'&&g.charAt(i)=='R'||s.charAt(i)=='G'&&g.charAt(i)=='G'||s.charAt(i)=='B'&&g.charAt(i)=='B'||s.charAt(i)=='B'&&g.charAt(i)=='G'||s.charAt(i)=='G'&&g.charAt(i)=='B'){
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 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
|
e63f998be05f41a5f2f66e93fecac725
|
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
|
// 17-05 //
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class E {
public static void main(String[] args) {
Scanner sc = new Scanner();
int t = sc.nextInt();
o: while (t-- > 0) {
int n = sc.nextInt();
char a[][] = new char[2][n];
for (int i = 0; i < 2; i++) {
a[i] = sc.nextLine().toCharArray();
}
for (int i = 0; i < 2; i++) {
for (int j = 0; j < n; j++) {
if (a[i][j] == 'B') {
a[i][j] = 'G';
}
}
}
if (String.valueOf(a[0]).equals(String.valueOf(a[1]))) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
static HashSet<String> set = new HashSet<>();
static void permute(String s, String answer) {
if (s.length() == 0) {
set.add(answer);
return;
}
for (int i = 0; i < s.length(); i++) {
char ch = s.charAt(i);
String left_substr = s.substring(0, i);
String right_substr = s.substring(i + 1);
String rest = left_substr + right_substr;
permute(rest, answer + ch);
}
}
static class pp implements Comparable<pp> {
int a;
int b;
pp(int a, int b) {
this.a = a;
this.b = b;
}
public int compareTo(pp o) {
return this.a - o.a;
}
}
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());
}
String str = "";
String nextLine() {
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[] readLongArray(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
long nextLong() {
return Long.parseLong(next());
}
}
static void sort(int[] a) {
int n = a.length;
Random r = new Random();
for (int i = 0; i < a.length; i++) {
int oi = r.nextInt(n), temp = a[i];
a[i] = a[oi];
a[oi] = temp;
}
Arrays.sort(a);
}
static final int M = 1_000_000_007;
static final int inf = Integer.MAX_VALUE;
static final int ninf = inf + 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
|
136f51854511afa18b259f3cc08d8ea7
|
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.*;
public class Main {
public static void main(String[] args) {
FastScanner fs = new FastScanner();
int testCase = fs.nextInt();
for (int test = 0; test < testCase; test++) {
int n = fs.nextInt();
String row1 = fs.next();
String row2 = fs.next();
boolean diff = false;
for(int i=0; i<n; i++){
if((row1.charAt(i) == 'R' && row2.charAt(i) != 'R') || (row2.charAt(i) == 'R' && row1.charAt(i) != 'R')){
diff = true;
break;
}
}
if(diff){
System.out.println("NO");
}
else {
System.out.println("YES");
}
}
}
public static String sortString(String original) {
char[] chars = original.toCharArray();
Arrays.sort(chars);
return new String(chars);
}
static class FastScanner {
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());
}
int[] readArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++) a[i] = nextInt();
return a;
}
long nextLong() {
return Long.parseLong(next());
}
}
}
|
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
|
1b8cb739973379e954390076fb9db36f
|
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 java.lang.*;
import java.math.*;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
public class x {
static FastInput scn;
static PrintWriter out;
final static int MOD = (int) (1e9 + 7);
final static int MAX = Integer.MAX_VALUE;
final static int MIN = Integer.MIN_VALUE;
// MAIN
public static void main(String[] args) throws IOException {
scn = new FastInput();
out = new PrintWriter(System.out);
int t = 1;
t = scn.nextInt();
while (t-- > 0) {
solve();
}
out.flush();
}
private static void solve() throws IOException {
int n = scn.nextInt();
char[] c1 = scn.next().toUpperCase().toCharArray();
char[] c2 = scn.next().toUpperCase().toCharArray();
int k = 0;
for(int i = 0;i<n;i++){
if(c1[i] == c2[i]){
k++;
}
else if(c1[i] == 'B' && c2[i] == 'G'){
k++;
}
else if(c1[i] == 'G' && c2[i] == 'B'){
k++;
}
}
out.println(k == n ? "YES" : "NO");
}
// CLASSES
static class Pair implements Comparable<Pair> {
int first, second;
Pair(int first, int second) {
this.first = first;
this.second = second;
}
Pair(Pair o) {
this.first = o.first;
this.second = o.second;
}
public int compareTo(Pair o) {
return this.first - o.first;
}
}
// CHECK IF STRING IS NUMBER
private static boolean isInteger(String s) {
try {
Integer.parseInt(s);
} catch (NumberFormatException e) {
return false;
} catch (NullPointerException e) {
return false;
}
return true;
}
private static boolean isLong(String s) {
try {
Long.parseLong(s);
} catch (NumberFormatException e) {
return false;
} catch (NullPointerException e) {
return false;
}
return true;
}
// FASTER SORT
private static void fastSort(int[] arr) {
int n = arr.length;
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);
}
private static void fastSortReverse(int[] arr) {
int n = arr.length;
List<Integer> list = new ArrayList<>();
for (int i = 0; i < n; i++)
list.add(arr[i]);
Collections.sort(list, Collections.reverseOrder());
for (int i = 0; i < n; i++)
arr[i] = list.get(i);
}
private static void fastSort(long[] arr) {
int n = arr.length;
List<Long> 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);
}
private static void fastSortReverse(long[] arr) {
int n = arr.length;
List<Long> list = new ArrayList<>();
for (int i = 0; i < n; i++)
list.add(arr[i]);
Collections.sort(list, Collections.reverseOrder());
for (int i = 0; i < n; i++)
arr[i] = list.get(i);
}
// QUICK MATHS
private static void swap(int[] a,int i,int j){
int t = a[i];
a[i] = a[j];
a[j] = t;
}
private static void swap(long[] a,int i,int j){
long t = a[i];
a[i] = a[j];
a[j] = t;
}
private static void swap(char[] a,int i,int j){
char t = a[i];
a[i] = a[j];
a[j] = t;
}
private static int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
private static long gcd(long a, long b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
private static int lcm(int a, int b) {
return (a / gcd(a, b)) * b;
}
private static long lcm(long a, long b) {
return (a / gcd(a, b)) * b;
}
private static long power(long a, long b) {
if (b == 0)
return 1L;
long ans = power(a, b / 2);
ans *= ans;
if ((b & 1) == 1)
ans *= a;
return ans;
}
private static int mod_power(int a, int b) {
if (b == 0)
return 1;
int temp = mod_power(a, b / 2);
temp %= MOD;
temp = (int) ((1L * temp * temp) % MOD);
if ((b & 1) == 1)
temp = (int) ((1L * temp * a) % MOD);
return temp;
}
private static int multiply(int a, int b) {
return (int) ((((1L * a) % MOD) * ((1L * b) % MOD)) % MOD);
}
private static boolean isPrime(int n) {
for (int i = 2; i * i <= n; i++)
if (n % i == 0)
return false;
return true;
}
private static boolean isPrime(long n) {
for (long i = 2; i * i <= n; i++)
if (n % i == 0)
return false;
return true;
}
// STRING FUNCTIONS
private static boolean isPalindrome(String str) {
int i = 0, j = str.length() - 1;
while (i < j)
if (str.charAt(i++) != str.charAt(j--))
return false;
return true;
}
private static String reverseString(String str) {
StringBuilder sb = new StringBuilder(str);
return sb.reverse().toString();
}
private static String sortString(String str) {
int[] arr = new int[256];
for (char ch : str.toCharArray())
arr[ch]++;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 256; i++)
while (arr[i]-- > 0)
sb.append((char) i);
return sb.toString();
}
// LONGEST INCREASING AND NON-DECREASING SUBSEQUENCE
private static int LIS(int arr[]) {
int n = arr.length;
List<Integer> list = new ArrayList<>();
for (int i = 0; i < n; i++) {
int idx = find1(list, arr[i]);
if (idx < list.size()) {
list.set(idx, arr[i]);
} else {
list.add(arr[i]);
}
}
return list.size();
}
private static int find1(List<Integer> list, int val) {
int ret = list.size(), i = 0, j = list.size() - 1;
while (i <= j) {
int mid = (i + j) / 2;
if (list.get(mid) >= val) {
ret = mid;
j = mid - 1;
} else {
i = mid + 1;
}
}
return ret;
}
private static int LNDS(int[] arr) {
int n = arr.length;
List<Integer> list = new ArrayList<>();
for (int i = 0; i < n; i++) {
int idx = find2(list, arr[i]);
if (idx < list.size()) {
list.set(idx, arr[i]);
} else {
list.add(arr[i]);
}
}
return list.size();
}
private static int find2(List<Integer> list, int val) {
int ret = list.size(), i = 0, j = list.size() - 1;
while (i <= j) {
int mid = (i + j) / 2;
if (list.get(mid) <= val) {
i = mid + 1;
} else {
ret = mid;
j = mid - 1;
}
}
return ret;
}
// DISJOINT SET UNION
private static int find(int x, int[] parent) {
if (parent[x] == x) {
return x;
}
parent[x] = find(parent[x], parent);
return parent[x];
}
private static boolean union(int x, int y, int[] parent, int[] rank) {
int lx = find(x, parent), ly = find(y, parent);
if (lx == ly) {
return true;
} else if (rank[lx] > rank[ly]) {
parent[ly] = lx;
} else if (rank[lx] < rank[ly]) {
parent[lx] = ly;
} else {
parent[lx] = ly;
rank[ly]++;
}
return false;
}
// TRIE
static class Trie {
class Node {
Node[] children;
boolean isEnd;
Node() {
children = new Node[26];
}
}
Node root;
Trie() {
root = new Node();
}
public void insert(String word) {
Node curr = root;
for (char ch : word.toCharArray()) {
if (curr.children[ch - 'a'] == null) {
curr.children[ch - 'a'] = new Node();
}
curr = curr.children[ch - 'a'];
}
curr.isEnd = true;
}
public boolean find(String word) {
Node curr = root;
for (char ch : word.toCharArray()) {
if (curr.children[ch - 'a'] == null) {
return false;
}
curr = curr.children[ch - 'a'];
}
return curr.isEnd;
}
}
// INPUT
static class FastInput {
BufferedReader br;
StringTokenizer st;
FastInput() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(nextLine());
return st.nextToken();
}
long nextLong() throws IOException {
return Long.parseLong(next());
}
int nextInt() throws IOException {
return Integer.parseInt(next());
}
double nextDouble() throws IOException {
return Double.parseDouble(next());
}
char nextCharacter() throws IOException {
return next().charAt(0);
}
String nextLine() throws IOException {
return br.readLine().trim();
}
int[] nextIntArray(int n) throws IOException {
int[] arr = new int[n];
for (int i = 0; i < n; i++)
arr[i] = nextInt();
return arr;
}
int[][] next2DIntArray(int n, int m) throws IOException {
int[][] arr = new int[n][m];
for (int i = 0; i < n; i++)
arr[i] = nextIntArray(m);
return arr;
}
long[] nextLongArray(int n) throws IOException {
long[] arr = new long[n];
for (int i = 0; i < n; i++)
arr[i] = nextLong();
return arr;
}
long[][] next2DLongArray(int n, int m) throws IOException {
long[][] arr = new long[n][m];
for (int i = 0; i < n; i++)
arr[i] = nextLongArray(m);
return arr;
}
List<Integer> nextIntList(int n) throws IOException {
List<Integer> list = new ArrayList<>();
for (int i = 0; i < n; i++)
list.add(nextInt());
return list;
}
List<Long> nextLongList(int n) throws IOException {
List<Long> list = new ArrayList<>();
for (int i = 0; i < n; i++)
list.add(nextLong());
return list;
}
char[] nextCharArray(int n) throws IOException {
return next().toCharArray();
}
char[][] next2DCharArray(int n, int m) throws IOException {
char[][] mat = new char[n][m];
for (int i = 0; i < n; i++)
mat[i] = nextCharArray(m);
return mat;
}
}
// OUTPUT
private static void printIntList(List<Integer> list) {
for (int i = 0; i < list.size(); i++)
out.print(list.get(i) + " ");
out.println(" ");
}
private static void printLongList(List<Long> list) {
for (int i = 0; i < list.size(); i++)
out.print(list.get(i) + " ");
out.println(" ");
}
private static void printIntArray(int[] arr) {
for (int i = 0; i < arr.length; i++)
out.print(arr[i] + " ");
out.println(" ");
}
private static void print2DIntArray(int[][] arr) {
for (int i = 0; i < arr.length; i++)
printIntArray(arr[i]);
}
private static void printLongArray(long[] arr) {
for (int i = 0; i < arr.length; i++)
out.print(arr[i] + " ");
out.println(" ");
}
private static void print2DLongArray(long[][] arr) {
for (int i = 0; i < arr.length; i++)
printLongArray(arr[i]);
}
}
|
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
|
31d81216b3173b66b70b97bf4555758c
|
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.*;
import java.util.*;
public class Solution{
static Scanner sc=new Scanner(System.in);
static void solve(){
int n=sc.nextInt();
String str1=sc.next();
String str2=sc.next();
boolean ans=true;
for(int i=0;i<n;i++){
if(str1.charAt(i)!=str2.charAt(i)){
if(!(str1.charAt(i)!='R'&&str2.charAt(i)!='R')) ans=false;
}
if(!ans) break;
}
if(ans) System.out.println("YES");
else System.out.println("NO");
}
public static void main(String[] args){
int t=sc.nextInt();
while(t-->0){
solve();
}
}
}
|
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
|
c7509c2c186751dcc137893fef3df0e8
|
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
|
//۰۪۫A۪۫۰۰۪۫B۪۫۰۰۪۫D۪۫۰۰۪۫-۪۫۰۰۪۫A۪۫۰۰۪۫L۪۫۰۰۪۫L۪۫۰۰۪۫A۪۫۰۰۪۫H۪۫۰
import java.util.*;
public class JavaApplication36 {
static Scanner z = new Scanner(System.in);
public static void main(String[] args){
int N =z.nextInt();
while(N-->0){
int s=z.nextInt();
int counter=0;
int counter1=0;
String k =z.next();
String o=z.next();
for (int i = 0; i < k.length(); i++) {
if(k.charAt(i)!=o.charAt(i)){
if(k.charAt(i)=='R'||o.charAt(i)=='R'){
counter=2;
counter=1;
}
}
}
System.out.println(counter==counter1?"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
|
94880cb6e0f445597ef42b74bd099e3c
|
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 Main
{
public static void main(String args[]) throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PrintWriter out=new PrintWriter(System.out);
Scanner sc=new Scanner(System.in);
// String testcases[]=br.readLine().split(" ");
// int t=Integer.parseInt(testcases[0]);
int t=sc.nextInt();
for(int i=0;i<t;i++)
{
// String input[]=br.readLine().split(" ");
// int n=Integer.parseInt(input[0]);
int n=sc.nextInt();
char[] first=new char[n];
char[] second=new char[n];
first=sc.next().toCharArray();
second=sc.next().toCharArray();
for(int j=0;j<n;j++)
{
if(first[j]=='G')
first[j]='B';
if(second[j]=='G')
second[j]='B';
}
int f=0;
for(int j=0;j<n&&f==0;j++)
if(first[j]!=second[j])
{
System.out.println("NO");
f=1;
}
if(f==0)
System.out.println("YES");
}
}
// private static boolean checkSquare(long n)
// {
// if (Math.ceil((double)Math.sqrt(n)) ==
// Math.floor((double)Math.sqrt(n)))
// return true;
// else
// return false;
// }
// private static long floorSqrt(long x)
// {
// if (x == 0 || x == 1)
// return x;
// long start = 1, end = x / 2, ans = 0;
// while (start <= end) {
// long mid = (start + end) / 2;
// if (mid * mid == x)
// return (int)mid;
// if (mid * mid < x) {
// start = mid + 1;
// ans = mid;
// }
// else
// end = mid - 1;
// }
// return (long)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
|
d6aae3f4b42ed889a190fe70ac55e8c4
|
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 Test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int testcases = sc.nextInt();
while(testcases-->0){
int n = sc.nextInt();
String s = sc.next();
String s1 = sc.next();
Colourblindness(s,s1,n);
}
}
public static void Colourblindness(String s,String s1,int n) {
int countCols = 0;
for(int i=0;i<n;i++){
if(s.charAt(i)==s1.charAt(i)){
countCols++;
}
else if((s.charAt(i)=='B' && s1.charAt(i)=='G') || (s.charAt(i)=='G' && s1.charAt(i)=='B')){
countCols++;
}
}
if(countCols==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
|
f92b5198592373d1dd6152b075cd1339
|
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 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();
}
}
static class SortingString {
int oldIndex;
int ch;
public SortingString(int oldIndex, int ch) {
this.oldIndex = oldIndex;
this.ch = ch;
}
}
static class SortingComparator implements Comparator<SortingString> {
public int compare(SortingString a, SortingString b) {
return a.oldIndex - b.oldIndex;
}
}
public static void main(String[] args) throws IOException {
Reader s = new Reader();
Scanner sc = new Scanner(System.in);
try {
int t = sc.nextInt();
// BufferedReader bu = new BufferedReader(new InputStreamReader(System.in));
// StringBuilder sb = new StringBuilder();
// String[] str = bu.readLine().split(" ");
//
// int t = Integer.parseInt(str[0]);
while (t-- > 0) {
// str = bu.readLine().split(" ");
// solve(str[0],str[1]);
// }
//
int n = sc.nextInt();
// String ss = sc.next();
// String ss2 = sc.next();
solve(n,sc.next(),sc.next());
}
} catch (Exception e) {
return;
}
}
public static void solve(int n, String s1, String s2) {
for(int i=0;i<n;i++){
char c1 = s1.charAt(i);
char c2 = s2.charAt(i);
if((c1==c2)|| (c1=='B'&&c2=='G') || (c2=='B'&&c1=='G')){
continue;
}else{
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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.