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
035fbdb3a124f6b2f28d11bcdb58df21
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
//<———My cp———— //https://takeuforward.org/interview-experience/strivers-cp-sheet/?utm_source=youtube&utm_medium=striver&utm_campaign=yt_video import java.util.*; import java.io.*; public class Solution{ static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) throws...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
7f22bc10c9e0cdc50bb699f68e7baf0e
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; import java.io.*; public class codeforceb { //ArrayList<Integer> arr2=new ArrayList<Integer>(); static ArrayList<Long> arr1=new ArrayList<Long>(); //Map<Integer,Integer> hm=new HashMap<Integer,Integer>(); //static Set<Integer> st1=new HashSet<Integer>(); static Set<In...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
d217d5f8d0d4576742ac3dc6d682d6d5
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner kb = new Scanner(System.in); int t = kb.nextInt(); while(t-- > 0) { String str = kb.next(); HashSet<Character> hs = new HashSet<>(); boolean flag = true; ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
5e0cb4e16ed3ed6ef811108e7f92ea68
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.*; import java.util.*; public class A { static FastScanner scan = new FastScanner(); static Scanner scanner = new Scanner(System.in); static PrintWriter printWriter = new PrintWriter(System.out); public static void main(String[] args) { int t = scan.nextInt(); wh...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
3ef7e8029aed4145c7f67c4fafc5f955
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) throws Exception { // write your code here r.init(System.in); int t = r.nextInt...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
ded16ebd2d549ccf909d6c67d8a064b8
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; import java.io.*; public class A { static boolean equal(char[] a, char[] b) { for (int i = 0; i < a.length; i++) { if (a[i] != b[i]) return false; } return true; } public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); Str...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
4e8609c3e31f0c7ea47384af8fba467d
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class Class1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t =sc.nextInt(); for(int q=0;q<t;q++){ boolean pass=true; String s=sc.next(),keys=""; for(int i=0;i<6;i++){ if(s.ch...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
1e0acc87c2261cdc7d8c0eeb769c3d90
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; import java.util.stream.Collectors; public class coding { static class Fas...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
8aa35b5c19b9a10e59680d66ba6eec60
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
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(); boolean c; String s; while(t -- > 0){ c = true; s = sc.next(); for(int i = 0; i < 5...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
85ca3f106a09ffc93dc0d1f23391f94b
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.sort; public class Round12 { public static void main(String[] args) { FastReader fastRead...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
60085a3fba8593359ef412c0bf24b388
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int count = sc.nextInt(); while (count > 0) { char[] chars = sc.next().toCharArray(); int posr = 0, posg = 0, posb = 0; ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
fe641ef7c1577e54334876dd29dcc8ac
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int numberOfCases = sc.nextInt(); HashMap<Character, Boolean> doors = new HashMap<>(); for (int i = 0; i < numberOfCases;...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
e026d12b97102cca0ea6235c18245980
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
//package com.company; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class Solution { public static String ques1(String s){ boolean r = false; boolean g = false; boolean b = fa...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
02fe6b02ea662ef238cc440d8c291ec9
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class Main { static Scanner sc = new Scanner (System.in); public static void main(String[] args) { int test = sc.nextInt(); for ( int t=0; t<test; t++){ String str = sc.next(); int r,g,b,R,G,B; r = str.indexOf("r"); g ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
7af77f17d5819e206ce19e2164da3c15
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.security.cert.X509CRL; import java.util.*; import java.lang.*; import java.util.stream.Collector; import java.util.stream.Co...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
a09e7d08e72f398436a95f795654cd38
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; public class A_Doorsandkey { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for(int f=1; f<=T; f++) { int r = 0; int R = 0; int g = 0; int G = 0; int b = 0; int B = 0; String s = sc.ne...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
c3f2300aa23d321fee94c056c3e88467
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; import java.util.Stack; public class DoorsandKeys { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); while(t-->0){ String s = scn.next(); Stack<Character> stk = new Stack<>(); ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
d63408023fceb5eb3cf21ac08dfdb5a5
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in) ; int t = sc.nextInt() ; while(t--!=0){ String str = sc.next(); int count = 0; if(str.indexOf('r') < str.indexOf('R')) ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
31f0953a53bcf0a7fa1e480d84b8e04e
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Codeforces { public static void main(String[] args) { Scanner Input = new Scanner(System.in); int t = Input.nextInt(); boolean a,b,c; String s; ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
46c03764f3d900f32cd898df5c8ac732
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; public class Knights { public static void main(String[] args) { Scanner input = new Scanner(System.in); int antal = input.nextInt(); while (antal-- > 0) { String str = input.next(); char[] arr = str.toCharArray(); boolea...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
bdf97b1f1269d8fdb041f682d64e5db8
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.math.BigInteger; import java.util.*; import static java.lang.Math.abs; import static java.lang.Math.sqrt; public class Main{ public static void main(String[] args) { Scanner in = new Scanner(System.in); boolean ifb = false; int n = in.nextInt(); for (int i = ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
2487e3ae6e7bab22c0d3c0072761eb79
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; import java.io.*; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.math.BigInteger; public final class Main{ static class Reader { ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
dafdf84c424df39cc4beec251896bfe3
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Submit { public static void main(String[] args) { try (FastReader reader = new FastReader()) { int t = reader.nextInt(); while (t-- > 0) { char[] chars = ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
bca14f055dd5b295f045f8f3604be7ae
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; import java.util.stream.IntStream; import java.util.stream.Stream; public class Main { public static void main(String[] args) { in = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); try { ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
95dec60884fb1d5b39e5ee71403c46e6
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; import java.io.*; public class Codechef { static boolean multipleTC = true; final static int Mod = 1000000007; final static int Mod2 = 998244353; final double PI = 3.14159265358979323846; int MAX = 1000000007; void pre() throws Exception { } long cntBit(long n){ ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
71e6ac6050c508663689ab840da56b73
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.ArrayList; import java.util.Locale; import java.util.Scanner; public class Dirver { static Scanner input; public static void main(String[] args) { input = new Scanner(System.in); int t = 1; t = input.nextInt(); while (t-- > 0) { solve();...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
0f99fdd98f4afead628f88f149af601f
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; public class Jyu1644ADoorsKeys { public static void main(String[] args) { Scanner sc = new Scanner(System.in); //Capture total # of test cases int t = sc.nextInt(); String[] output = new String[t]; for (int i=0; i<t; i++) { String input = sc.ne...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
d0dbfb3803bbf3a37406c64e24460fa3
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class LockAndKey { public static void main(String[] args) { Scanner inp=new Scanner(System.in); int t=inp.nextInt(); inp.nextLine(); while(t>0) { int s=1; String st=inp.nextLine(); char[] c=st.toCharArray(); ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
e761010f8b14caf3c998f5ca343c4445
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.*; import java.util.*; public class Q1644A { static int mod = (int) (1e9 + 7); static void solve() { String str=s(); boolean chk=true; HashSet<Character>set=new HashSet<>(); l:for(char ch:str.toCharArray()){ if(ch=='r' || ch=='g' || ch=='b'){ ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 11
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
50811a327de710c9f9c0a7fce4acdc49
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc =new Scanner(System.in); int t=sc.nextInt(); Main m=new Main(); List<String> ans=new ArrayList<String>(); while(sc.hasNext()) { t--; Stri...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
897d9b3f7a696ad05d1ff7b6fb1147f2
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
//package CodeForces; import java.util.*; public class Main { public static void main(String[] arg) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0) { String s = sc.next(); if(Character.isUpperCase(s.charAt(0))) Syst...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
5c309569ef8bd3dec6b99d6f0a1bd958
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; public class prac { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t; t=sc.nextInt(); for (int i = 1; i <=t; i++) { String str=sc.next(); if(str.indexOf('r')< str.indexOf('R')...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
88fe72ea07e9223348d6bb42542c08ff
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
// package CodeForcesEduRound220222; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; import java.util.StringTokenizer; public class Did { public static class FastScanner { BufferedReader br = new BufferedReader(new InputStreamReader(Sys...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
7330fe947dd167c4afbed5a4aaed37eb
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class Test { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int t = scan.nextInt(); while(t-->0) { System.out.println(f(scan.next())); } } public static String f(String a) { ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
3b34691b0fac4b60aae645da21808825
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class NewClass_1644_A{ public static void main(String arg[]){ Scanner ob=new Scanner(System.in); int tt=ob.nextInt(); out: for(int t=0;t<tt;t++){ String s=ob.next(); HashSet<Character> hs=new HashSet(); for(int i=0;i<s.length();i++){ hs.add(s.charAt(i)); ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
9e1820dc16c35f61d13d9c39dd2387fe
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class NewClass_1644_A{ public static void main(String arg[]){ Scanner ob=new Scanner(System.in); int tt=ob.nextInt(); out: for(int t=0;t<tt;t++){ String s=ob.next(); Map<Character,Integer> mp=new HashMap(); mp.put('r',0); mp.put('b',0); mp.put('g',0); ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
c9b1ebf0c3091d2e51bd9bf70075dfe7
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class NewClass_1644_A{ public static void main(String arg[]){ Scanner ob=new Scanner(System.in); int tt=ob.nextInt(); out:for(int t=0;t<tt;t++){ String s=ob.next(); Vector<Character> v=new Vector(); //System.out.println(v); for(int j=0;j<s.length();j++){ ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
e98748ed911c2406aebb8d50caf51baa
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; public class DoorsAndKeys { public static void main(String[] args) { Scanner input = new Scanner(System.in); int r=0; int g=0; int b=0; int t=input.nextInt(); for (int i = 0; i < t; i++) { String st= input.nex...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
9905215158a0465169775196fd6a5654
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; public class DoorsAndKeys { public static void main(String[] args) { Scanner input = new Scanner(System.in); int r=0; int g=0; int b=0; int t=input.nextInt(); for (int i = 0; i < t; i++) { String st= input.nex...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
f9d9edb6546d639bf25e537bf120aace
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.System.out; import java.util.*; import java.io.*; import java.math.*; public class Main { public static void main (String[] args) throws java.lang.Exception { ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
7d630814d40db9d6594108704a8c9ab5
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.System.out; import java.util.*; import java.io.*; import java.math.*; public class A_Doors_and_Keys { public static void main (String[] args) throws java.lang.Exception { ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
906f0161f27ff17bcdbf07dde7cb5d72
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class Solution{ public static void main(String[] args)throws java.lang.Exception { Scanner sc=new Scanner(System.in); int t; t=sc.nextInt(); while(t-->0) { String s=sc.next(); if(s.indexOf('B')>s.indexOf('b')&&s.indexOf('G')>s.indexOf('g')&&s.indexOf('R')>s.indexOf('r')) Sy...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
fd5b6f4c241c7a236ea694caf431723b
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class EDA { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Scanner sc1 = new Scanner(System.in); int t = sc.nextInt(); // sc.close(); while(t-->0) { String str = sc.next(); boolean...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
0b9be8811bc440ef0c6f4bb3d49e98ff
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class A { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int n = sc.nextInt(); for( int i = 0; i < n; i++ ) { Map<Character, Integer> map = new HashMap<>(); ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
e1e4bc7417773df2c99119c16bf7219a
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
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 i=0;i<t;i++){ String s = sc.next(); int a=0,b=0,c=0,d=0,e=0,f=0; for(int j=0;j<s.length();j++){ if(s.charAt(j)==...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
da408697e90ae84eae6d0647ecb407ad
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int testCasesCount=s.nextInt(); for (int t = 0; t <testCasesCount ; t++) { String input=s.next(); boolean isAllOpen=true; for (in...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
579a0fd63d0e8486ab7e12e2bd35d3b0
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.math.BigInteger; import java.util.*; public class esep { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); while(n-->0) { String s = sc.nextLine(); System.ou...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
d456dafb6b0e69a784740a4b3ac29f9d
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.math.BigInteger; import java.util.*; public class esep { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); while(n-->0) { String s = sc.nextLine(); System.ou...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
66fd0bbece1a64e8ad7712f90dc9e543
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int r = 0, g = 0, b = 0, R = 0, G = 0, B = 0; for (int i = 0; i < n; i++) { ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
52a4b7291d2cc57166523d5161e2a014
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; public class DoorsAndKeys { public static void main(String[] args) { Scanner input = new Scanner(System.in); int testCase = Integer.parseInt(input.nextLine()); for(int i=0; i<testCase; i++){ String map = input.nextLine(); ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
0353b57ee880efc2a50d5a0ee6aa6f03
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); sc.nextLine(); while (t-- > 0) { String s = sc.nextLine(); int n = s.length(); if (calculate(s , n) == true) { System.out....
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
246179dccff02f794513ff482840bf67
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class DataStructure{ public static void main(String []args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); String []arr=new String [n]; int i,j=0; for(i=0;i<=n-1;i++){ arr[i]=sc.next(); } for(i=0;i<=n-1...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
1537a89bab24812de21ae254bad2e06a
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class tri { public static void main(String[] args) { Scanner input = new Scanner(System.in); int num1=input.nextInt(); String[] aaa=new String[num1]; for (String x: aaa) { x =input.next(); if (x.indexOf('r')<x.index...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
d93b1132ce9e4ab6d02c13613f19e6cd
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.*; import java.util.*; public final class Main { //int 2e9 - long 9e18 static PrintWriter out = new PrintWriter(System.out); static FastReader in = new FastReader(); static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(0, 1), new Pair(1, 0), new Pair(0, -1)}; static...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
c562bfa8c427f8e5447c33832954abb2
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.*; import java.util.*; public class I { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); while (t-- > 0) { char[] a = sc.next().toCharArray(); int cnt = 0; ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
45048adbdba9198df09da611e0336ba6
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.*; public class Main { 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) { String s = br.readLine(); ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
06d2692686a0c490b4576d553de503db
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; import java.io.*; public class solution { 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...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
f9ec758213529923679f04f4bacac2a8
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class cpSolutions { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasM...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
77e4a936a7d3abfa70d0147412f3684e
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class z1644a { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseIn...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
a7df2d016d37f6a207ff3f1d02bb5884
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class z1644a { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseIn...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
e62dcf6cd2cd728ca2b36cfe156bba99
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.*; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; public class CF { //-----------PrintWriter for faster output--------------------------------- public static PrintWriter out; //-----------MyScanner class for faster input---------- public stat...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
8916d24b8182a3cbba5da65d000672a5
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
/*package whatever //do not write package name here */ import java.util.*; public class GFG { public static void main (String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int o=0;o<t;o++){ boolean flag=true; String s=sc.next(); char[] ch=s.toCharArray(); ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
77d1c86496514943d8b018621891ff73
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
/*package whatever //do not write package name here */ import java.util.*; public class GFG { public static void main (String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int o=0;o<t;o++){ boolean flag=true; String s=sc.next(); char[] ch=s.toCharArray(); ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
d68269dfb5115acf93dd270c2ca81da1
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.HashSet; import java.util.Scanner; public class DoorsAndKeys { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0) { String s = sc.next(); int charCount = 0; HashSet<Character> hs = new HashSet(); for(int ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
f6cd91ded6546e4f62062dcb79e3b3b3
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class A { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); Stack res = new Stack<>(); Stack results = new Stack<>(); for(int i=0;i<n;i++){ String hm...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
0e103ad20ac780ec945cc27765f638f9
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
//package CodeForces; import java.util.*; public class Main { public static void main(String[] arg) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0) { String s = sc.next(); if(Character.isUpperCase(s.charAt(0))) Syst...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
4126ff4ba66138abd739a5198b5ac53f
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class Solution{ public static void main(String[] args)throws java.lang.Exception { Scanner sc=new Scanner(System.in); int t; t=sc.nextInt(); while(t-->0) { String s=sc.next(); if(s.indexOf('B')>s.indexOf('b')&&s.indexOf('G')>s.indexOf('g')&&s.indexOf('R')>s.indexOf('r')) ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
a9e712f4748f04887093aca6bbc860ea
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.lang.*; import java.io.InputStreamReader; import static java.lang.Math.*; import static java.lang.System.out; import java.util.*; import java.io.File; import java.io.PrintStream; import java.io.PrintWriter; import java.math.BigInteger; pu...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
950a23d5ba14083d0e23bf584aec1c6f
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int test_case = scanner.nextInt(); for (int i = 0; i < test_case; i++) { char[] cases = scanner.next().toCharArray(); int pass_door = 0; ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
2f590fb5150c6b3649e9d5ef4559ba94
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class CoinChange { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { String str = sc.next(); int r = 0, g= 0, b= 0; boolean isPossible = true; for(int i = 0; i < str.length(); i++) { if...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
14a673d30a909ff35762d4ab43b5cf2e
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class Doors{ public static boolean check(String s){ for(int j=0;j<6;j++){ if(Character.isLowerCase(s.charAt(j)) && s.indexOf(s.charAt(j))>s.indexOf(Character.toUpperCase(s.charAt(j)))){ return false; } } return true; } public static void m...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
bcf96073f42f716452141a8f3fe84206
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); scanner.nextLine(); for (int i = 0; i < n; i++) { String s = scanner.nextLine(); boolean r...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
d3fe2bc3eee1865492b47439c7b640fc
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; import java.io.*; public class Main{ static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader(){ br=new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(st==null || !st.hasM...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
76d52ba05199829d159a2fb67f94ba56
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; public class T1644A { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = Integer.parseInt(in.nextLine()); for (int i = 0; i < t; i++) { String line = in.nextLine(); if (line.indexOf("r") < line.indexOf(...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
d9432d74d0025dfc4fd5910520ec4e7a
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.*; import java.util.*; public class Largest { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br=new BufferedReader(new InputStreamReader(System.in)); } String next() { ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
4d3e6967ed31bdd3d202fc3c61983124
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
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 Ideone { public static void main (String[] args) throws java.lang.Exception { Scanner s=new Scanner(System.in); int t=s.nextInt(); s.nextLine(); for(int i=0...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
ecbaf80272af3d0c2285452bdc01847e
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
//package r123div2; import java.io.*; public class Main { public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in),30); public static StreamTokenizer in = new StreamTokenizer(br); public static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
0d3c23d28c4556f980659664d29e93f2
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
//package r123div2; import java.io.*; public final class Main { public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in),30); public static StreamTokenizer in = new StreamTokenizer(br); public static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out))...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
9a2dc631b9016b6387ebf61994956946
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); while(n-->0){ String s = sc.next(); int doorR =0 ; int doorG =0; int doorB =0 ; int keyR=0; int keyG=0; int keyB=0; for( int i =0 ; i < s.le...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
fdea65697d64d13e4b8979d8aaed48a0
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.IOException; import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t; t = in.nextInt(); while (t != 0) { int n; // n = in.nextInt(); ArrayList<Integer> a ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
a7f79afba8edd4cf667aa30e350ccea7
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.*; import java.util.*; public class A { public static void main(String args[]){ FScanner in = new FScanner(); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); m: while(t-->0) { String s=in.next(); int r=0,g=0,b=0; for(int i=0;i<s.length();i++) { ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
7b709bea0fb67920a2b1f2ad103184cb
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.*; import java.util.*; import java.math.BigDecimal; import java.math.*; // public class Main{ public static void main(String[] args) { TaskA solver = new TaskA(); // boolean[]prime=seive(3*100001); int t = in.nextInt(); for (int i = 1; i <= t ;...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
bc1121cfd308f046c8804f6db3db33f6
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.*; import java.util.*; import java.math.BigDecimal; import java.math.*; public class Main{ public static void main(String[] args) { TaskA solver = new TaskA(); // boolean[]prime=seive(3*100001); int t = in.nextInt(); for (int i = 1; i <= t ; i+...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
26857ad2eb13468a26f5d6b0e4a1ab4d
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class p { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int t=scan.nextInt(); String temp=scan.nextLine(); for(int z=0;z<t;z++) { String s=scan.nextLine(); int r=0,g=0,b=0; ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
142c5aca4ecf474d947f51789e91b095
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
//Gaurav...... import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; import java.io.*; import java.util.*; import java.util.List; import java.util.stream.Collectors; import...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
ad13b88a45125e4b158c6689754e8269
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; public class E123A { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
cf911bbbbdcc2b97c581eb7900664794
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; public class first { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int t=sc.nextInt(); String result=""; for(int j=0;j<t;j++) { int k=0; String s=sc.next(); for(int i=0;i<s.leng...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
4f84b8bcdcac1827a05791f80ce85dbd
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; public class first { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int t=sc.nextInt(); String result=""; for(int j=0;j<t;j++) { int k=0; String s=sc.next(); for(int i=0;i<s.leng...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
3e9662674f08031b92fa820ca2125a95
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class _1644A_DoorsANdKEys { public static void main(String[] args) { Scanner input = new Scanner(System.in); int test = input.nextInt(); while (test-- > 0) { String str = input.next(); boolean flag = true; LinkedList<Character...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
f2380828bddd32f3bf38858f835164aa
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class Decode { public static void main(String[] args) { Scanner st = new Scanner(System.in); int t = st.nextInt(); while (t-- > 0) { String[] arr = st.next().split(""); Stack<String> stack = new Stack...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
19c4b6422c16e3f8879f2f967d9ac87d
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static int gcd(int a, int b) { if (a < 0 || b < 0) { //求最大公因数 return -1; // 数学上不考虑负数的约数 } if (b == 0) { return a; } return a % b == 0 ? b : gcd(b, a % b); } public...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
de1712caf1a5b8f435dc7eeda87a23a4
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; import java.lang.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 1; i <= t; i++) { String a = sc.next(); if (a.indexOf('r') > a.indexOf('R') || a.indexOf(...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
fb7737474095e161660fe4a22ee46b7a
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); String text = scanner.nextLine(); while(t...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
854d75e3186114a44622148a05b9fc40
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; public class test265 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t=in.nextInt(); for(int j=0;j<t;j++) { boolean a[]=new boolean[3]; boolean y=false; char x[]=in.next().toCharArray(); for(int i=0;i<6;i++) { switch(x[i]...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
56cd6123d9c0601e37eeeb74181f140c
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; public class Doors { int number; public Doors(int number){ this.number=number; } public void input(String s){ boolean ba=true; for (int i=0;i<s.length();i++){ boolean b=false; if(s.charAt(i)>97){ continue; }else { int s...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
377176483295eebc3a3a16d9712f2f54
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; import java.io.*; public class Codeforces{ public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int t = sc.nextInt(); while (t-- > 0) { ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
804f41e2c4472900fe94972fab63e791
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { public static void main(String [] args) { FastScanner fs=new FastScanner(); Scanner in = new Scanner(System.in); PrintWr...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
13afc1478f32bc519c0ea42d70ae31b2
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public final class DoorKeys { public static void solve(String s) { String ans = ""; int g = 0, r = 0, b = 0; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == 'r') r = 1; else if (c == 'b')...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
9c9dfb8148ec5049e839f2ac5f80bb6c
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { FastScanner scanner = new FastScanner(); int t = scanner.nextInt(); for (int p = 0; p < t; p...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
2cf5ffbd3edb8698133fa64a5b5346f2
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
// package com.sameer; import java.util.*; public class Main { private static void solve() { String s = sc.next(); Set<Character> keysList = new HashSet<>(); for (Character ch: s.toCharArray()) { if (Character.isUpperCase(ch)) { if...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output