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
2015b0de422d1279a23b15ae5d0a8881
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Solution { public static void main (String[] args) throws java.lang.Exception { Scanner in = new Scanner(Syst...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
d82f5b61e798ac338d15ff5e964b721e
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
import java.io.*; import java.util.*; public class CodeforcesEdu123{ static long mod = 1000000007L; static MyScanner sc = new MyScanner(); static void solve(){ String str = sc.nextLine(); boolean r = false; boolean g = false; boolean b = false; for(int i = 0;i<...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
b360849b9176442b833ee67c348c0331
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
import java.util.*; import java.io.*; // cd C:\Users\Lenovo\Desktop\New //ArrayList<Integer> a=new ArrayList<>(); //List<Integer> lis=new ArrayList<>(); //StringBuilder ans = new StringBuilder(); //HashMap<Integer,Integer> map=new HashMap<>(); ...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
f53fb557b7271fdcaa1899f079971872
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
import java.util.*; public class main1{ // public static class Pair{ // int sum; // int len; // Pair(int sum,int len){ // this.sum=sum; // this.len=len; // } // } // public static Pair kadaneAlgo(int[] arr){ // int...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
6981e11685d867ee39d61519cafc0d45
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
// Problem: C. Increase Subarray Sums // Contest: Codeforces - Educational Codeforces Round 123 (Rated for Div. 2) // URL: https://codeforces.com/contest/1644/problem/C // Memory Limit: 256 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org) import java.io.*; import java.math.MathCont...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
39a5a200a2dcde2c85b71b543c523aa4
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; public class C { /** * Template @author William Fiset, william.alexandre.fiset@gmail.com * */ static InputReader in = new InputReader(System.in); private...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
3cd24ae179d747fad46685bb26d7f77f
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class IncreaseSubArraySums { public static void main(String[] args)throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int t=...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
39fc6147eda047d02aa02d541e5e989e
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; ...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
aac0bd7f47960f82b189764d9bafc3de
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; import java.util.concurrent.ThreadLocalRandom; //import javax.print.att...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
3dd0eec6bf164615d75a2b496ff04739
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Main { static class pair { long r; long d; public pair(long r , long d) ...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
fb04ec4fd8d9cf9aa080039a3e6fca33
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int test = scanner.nextInt(); while(test --> 0) { int n = scanner.nextInt(), x = scanner.nextInt(); int[] array = new int[n], ans = ...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
f95b402e73f1ebd11b42e02cf9d1a9e7
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
import java.io.*; import java.util.*; /* */ public class C{ static FastReader sc=null; public static void main(String[] args) { sc=new FastReader(); int t=sc.nextInt(); for(int tt=0;tt<t;tt++) { int n=sc.nextInt(),x=sc.nextInt(); int a[]=sc.readArray(n); int dp[][]=ne...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
bfbcbff80d82d899aa654c8212bd1e5b
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
import java.io.*; import java.util.*; public class Temp { static int t,n,arr[],ans[],x; static final BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); static final StreamTokenizer in = new StreamTokenizer(bf); static final PrintWriter out=new PrintWriter(System.out); pub...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
426923821e2420157741e548f9552bac
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
/* TASK: template LANG: JAVA */ import java.io.*; import java.lang.*; import java.lang.reflect.Array; import java.util.*; public class C1644 { public static void main(String[] args) throws IOException{ StringBuffer ans = new StringBuffer(); StringTokenizer st; BufferedRead...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
8eb96b2748f9d1788e13fe04fd1bdcfa
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
import java.util.*; import java.io.*; public class C1644 { static int[] a; static int n, x; static long[][] dp; public static long dp(int idx, int inc) { if (idx == 0) { return Math.max(0, a[idx] + (inc == 0 ? 0 : x)); } if (dp[idx][inc] != -1) { ...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
61a34c9848409bcfc5b5f8eca73d9a54
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
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.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Com...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
52a2fa7f2c8fd07786597045a2036185
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
import java.io.*; import java.util.*; public class a { public static void main(String[] args){ FastScanner sc = new FastScanner(); StringBuilder ans = new StringBuilder(); int t = sc.nextInt(); while(t-- > 0){ int n = sc.nextInt(); int x = sc.nextInt(); ...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
12b13d21fa8023614471515c1e3aba26
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
import java.io.*; import java.util.*; public class habd{ public static long My_maxSubArraySum(long a[]) { int size = a.length; long max_so_far = Long.MIN_VALUE, max_ending_here = 0; for (int i = 0; i < size; i++) { max_ending_here = max_ending_here + a[i]; ...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
afff5f4885314879a41a82e97c087fc2
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Codechef { static long fans[] = new long[200001]; static long inv[] = new long[200001]; static long mod = 1000000007; static void init() { fans[0] = 1; inv[0] = 1; fans[1] = 1; inv[1] = 1; for (int i = 2; i < 200001; i+...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
068263bade08742941714573834ccbe8
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
//package Codeforces; import java.io.*; import java.util.*; public class C { static class Pair { long count; long sum; Pair(long l, long sum) { count = l; this.sum = sum; } Pair(){} @Override public String toStr...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 8
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
162879b89884727045abced9522c30bc
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
/****************************************************************************** Online Java Compiler. Code, Compile, Run and Debug java program online. Write your code in this editor and press "Run" button to execute it. ***********************************************...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 17
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
efe90feef9cd72f6ef30190a83cb0676
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; import static java.lang.System.*; import static java.util.Arrays.*; import static java.util.stream.IntStream.iterate; public class Te...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 17
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
f73c8a6da312138ce1a364a5aba8babe
train_108.jsonl
1645540500
You are given an array $$$a_1, a_2, \dots, a_n$$$, consisting of $$$n$$$ integers. You are also given an integer value $$$x$$$.Let $$$f(k)$$$ be the maximum sum of a contiguous subarray of $$$a$$$ after applying the following operation: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions. An empty subarra...
256 megabytes
import java.util.*; import java.util.function.*; import java.io.*; // you can compare with output.txt and expected out public class RoundEdu123C { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final static String I...
Java
["3\n\n4 2\n\n4 1 3 2\n\n3 5\n\n-2 -7 -1\n\n10 2\n\n-6 -1 -2 4 -6 -1 -4 4 -5 -4"]
2 seconds
["10 12 14 16 18\n0 4 4 5\n4 6 6 7 7 7 7 8 8 8 8"]
NoteIn the first testcase, it doesn't matter which elements you add $$$x$$$ to. The subarray with the maximum sum will always be the entire array. If you increase $$$k$$$ elements by $$$x$$$, $$$k \cdot x$$$ will be added to the sum.In the second testcase: For $$$k = 0$$$, the empty subarray is the best option. For ...
Java 17
standard input
[ "brute force", "dp", "greedy", "implementation" ]
a5927e1883fbd5e5098a8454f6f6631f
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5000$$$) — the number of testcases. The first line of the testcase contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 5000$$$; $$$0 \le x \le 10^5$$$) — the number of elements in the array and the value to add. The second line contains $$$n$$$ inte...
1,400
For each testcase, print $$$n + 1$$$ integers — the maximum value of $$$f(k)$$$ for all $$$k$$$ from $$$0$$$ to $$$n$$$ independently.
standard output
PASSED
5aaed030d1503bdb4a1f2c48fad65cdd
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(); boolean works = true; HashMap<Integer, Integer> vals = new HashMap<Integer, Integer>(); for(int a = 0; a < t; a++) { String ...
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
34832673054cc62edbb94209e1602669
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); // Scanner ch= new Scanner(System.in); int num=sc.nextInt(); while(sc.hasNextLine()) { String s= sc.nextLine(); func(s); } } public 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 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
c6714047cedeb44374366ae3afda87ca
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.*; public class edu_round_123_A { 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 ...
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
5d65fc73b73929a83a0b79ff24223e0a
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) { // write your code here int t; String str; boolean cond=true; Scanner input=new Scanner(System.in); t=input.nextInt(); for(int i=0;i<t;i++) { str=input.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
564734ea620655fb1cd441df322c702b
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) { // Write your code here Scanner scn = new Scanner(System.in); int T = scn.nextInt(); for(int j = 0;j<T ; j++){ String s = scn.next(); int[]arr = new int[2]; int[]arr1 = new int[2]; int[]arr2 =...
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
5d86306166c3255de9bd9cc25fd7849e
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 q1 { 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(); if (s.indexOf('r') < s.indexOf('R')){ if (s.indexO...
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
0fc6f10ee396fbaf378c95ccd22af37d
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
// 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 ...
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
88a5eaf004c6ccee7d35383ce750fd7b
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 s{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); // HashMap<Character,Integer> map=new HashMap<Character,Integer>();//Creating HashMap int rind=0; int Rind=0; int bind=0; int Bind=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
7731040bd732cb5ee170635a4ad6314b
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 force { public static void main(String [] args) { Scanner kb = new Scanner(System.in); int rounds = kb.nextInt(); for(int k = 1; k <= rounds; k++) { String map = kb.next(); boolean red = false; ...
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
a4c767f0d22bae1d2eb120536fecb40a
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 Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); while (tc-- > 0) { String s = sc.next(); int r = 0, g = 0, b = 0, R = 0, G = 0, B = 0; for (int i = 0; i < s.length(); i++) { if (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 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
b4ac5f4c0bc7d81f18120c7d8789d69d
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 go { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int x= sc.nextInt(); go: while (x-- !=0 ) { String s= sc.next(); boolean r=false,b=false,g=false,no=false; for(int i=0; i<6;...
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
db7df211d89b46f3cbdd36f040c4bd56
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 door { 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(); if(s.charAt(0)=='R' || s.charAt(0)=='G' || s.charAt...
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
349f3698947e57e62e6bbe26fe8a8d8b
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 Exception { Buf...
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
77fee1b837f9530cd710460bd3bb6cc4
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_key { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { String s = sc.next(); Map<Character,Integer> map = new HashMap<>(); int i = 0; for(char ...
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
d4253a37d7d98edf4242f1204c33cbbf
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 ExpandThePath { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); String[] s=new String[n]; sc.nextLine(); for(int i=0;i<n;i++) { s[i]=sc.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 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
f4ae9e330266375485df65f48e32128a
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();int r=0,g=0,b=0,r1=0,g1=0,b1=0; while(t--!=0) { String s=sc.next(); 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 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
b8907687bdf2b8668bd61fcfa2d8de8a
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 Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); scanner.nextLine(); for (int i = 1; i <=t;i++) { boolean isP...
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
668436ab82cbe1f2890ff1e75087a27b
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 test { public static void main (String[] args) throws java.lang.Exception { Scanner scanner = new Scanner(System.in); String num = scanner.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 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
87955ac48724c48ae13320739ffd58ec
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 scn=new Scanner(System.in); int t=scn.nextInt(); scn.nextLine(); while(t-->0){ String s=scn.nextLine(); int flag=0; HashMap<Character,Integer> hm=new HashMap<>(); 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 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
bff8c29d02c2091d2649404b5cf34ccd
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(); outer: while(t-->0) { String str=sc.next(); int r=0,g=0,b=0; for(int i=0;i<str.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 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
2a77ec93da21f7d692ff8946191ebde1
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(final String[] args) { final Scanner scanner = new Scanner(System.in); int noTests = scanner.nextInt(); while (noTests-- > 0) { final String map = scanner.next(); boolean hasRedKey ...
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
5d5ad6dfd2273b3e661087f19a502c8e
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 class371 { public static void main(String arg[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int flag=0; String s=sc.next(); int l=s.length(); int i; int a[]=new int[3]; for(i=0;i<l;i++) { if(s.charAt(i)=='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
924ef1a825eb0d571aeeb9192579c887
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.*; public class Main { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { String str = sc.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 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
4253911c6d688625c54f3a905a77905c
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.Arrays; import java.util.Objects; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int dataCount = Integer.parseInt(sc.nextLine()); String[] answerArray = new String[dataCount]; ...
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
0bafbb1b5ef4ae5cb195279d8bc41bea
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; /* The pain you feel today will be the strength you feel tomorrow */ public class Bb { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for (int z = 0; z < t; z++) { String s = in.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 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
6d7e647e2a2f4da99dbf9805089b85dc
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 DoorsAndKeys { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int tc = atoi(reader.readLine()); for (int t = 0; t < tc; 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 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
d84ff6340815d1467a57c44b0357871c
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.HashMap; import java.util.Scanner; public class App { public static void main(String args[]) throws IOException { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); String garb = sc.nextLine(); label: for (int i = 1; i <= t; i++) { String path ...
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
b027d858b6c1389376dcf51e431b0d52
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 sc= new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { String s = sc.next(); int r1 = s.indexOf('r'); int R1 = s.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 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
57b2e66be770822591b3e9ed24928073
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 sc= new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { String s = sc.next(); if (s.indexOf('r') < s.indexOf('R') && s.indexOf('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
e0a8fa34422462667985093848720840
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 jdk.swing.interop.SwingInterOpUtils; import org.w3c.dom.ls.LSOutput; import javax.crypto.spec.PSource; import javax.imageio.metadata.IIOMetadataFormatImpl; import java.math.BigDecimal; import java.math.BigInteger; import java.math.MathContext; import java.util.Arrays; import java.util.Locale; import 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 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
1447af4279d7b0bb666bc059c1278410
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 jdk.swing.interop.SwingInterOpUtils; import org.w3c.dom.ls.LSOutput; import javax.crypto.spec.PSource; import javax.imageio.metadata.IIOMetadataFormatImpl; import java.math.BigDecimal; import java.math.BigInteger; import java.math.MathContext; import java.util.Arrays; import java.util.Locale; import 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 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
0f81322f8b40b7e4df0cbc412f0c67f6
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 { static class JoinSet { int[] fa; JoinSet(int n) { fa = new int[n]; for (int i = 0; i < n; i++) fa[i] = i; } int find(int t) { if (t != fa[t]) fa[t] = find(fa[t]); retu...
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
366f09a60d873871b7ff17a825f8578a
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.HashSet; import java.util.Set; import java.util.StringTokenizer; public class cf1644A { public static void main(String[] args) { FastReader sc = new FastReader(); int t = sc.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
ab16124f5db88e512ef3060e4c354e7c
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.HashSet; import java.util.Set; import java.util.StringTokenizer; public class cf1644A { public static void main(String[] args) { FastReader sc = new FastReader(); int t = sc.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
44f928bc3281a8205e0d4b36ef5f6d00
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 s = new Scanner(System.in); int cases = Integer.parseInt(s.nextLine()); for (int i = 0; i < cases; i++) { String str = s.nextLine(); System.out.println(ca...
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
13a7e6dfe463b688b3fe4e046f59b921
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 Contest1644C { static class InputReader { BufferedReader reader; StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); token...
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
6f107c76274ae7bc3aa662b1f043b588
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 s=sc.next(); int rkey=0,gkey=0,bkey=0,rdr=0,gdr=0,bdr=0; for(int i=0;i<s.length();i++){ if(s.cha...
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
2fd57980f96c36697ffa72f9704085a1
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.List; import java.util.ArrayList; import java.util.Arrays; public class CF1644A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder sb = new StringBuilder(); int n = sc.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
cd54aa37f137bfa857b93357654b62b1
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.math.*; public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); StringBuilder sb = new StringBuilder(""); while(t-- > 0) { String s = scn.next(); Set<Character> hs = new HashSet<>(); boolean f...
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
c9256b51c56981285c4274f548392d7a
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.*; // Compiler version JDK 11.0.2 public class Dcoder { public static void main(String args[]) { Scanner s=new Scanner(System.in); int t=s.nextInt(); s.nextLine(); while(t-->0) { String str=s.nextLine(); Map<Character, Integer> l=new HashMap<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
9973992eaef99cd071b7cfc7ea98bd66
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 P1644A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int bin=0; for(int i=0;i<t;i++){ String s = sc.next(); int a=0,b=0,c=0; for(int j=0;j<s.len...
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
f306998e2efecd59065953cefb34e43d
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 HelloWorld { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i = 0 ;i <t;i++){ boolean ans = true; boolean r = false; boolean g= false; ...
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
6d553b031f008ef6b74da39b345e51af
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 Code_Forces { static final int INT_MAX = Integer.MAX_VALUE; static FastReader in = new FastReader(); static StringBuilder sb = new StringBuilder(); public static void main(String[] args) throws java.lang.Exception { int TestCases = 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
ebaaa7b672f8481eb602f3ae7f31258c
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 Code_Forces { static final int INT_MAX = Integer.MAX_VALUE; public static void main(String[] args) throws java.lang.Exception { FastReader in = new 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
64b672153fd9cb53ea3499303bbab3a4
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 s=new Scanner (System.in); int r=0,g=0,b=0; int ans=0; int t=s.nextInt(); int x=0; String y[]=new String [t]; while (x<t){ ans=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
57e146faf2136d9aa77b9691d40a24ea
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 Princess { public static void main(String[] args) { try (Scanner sc = new Scanner(System.in)) { int n = sc.nextInt(); for(int i = 0 ; i < n ; i++) { String s = sc.next(); check(s); } } } public static void che...
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
c3b8e325a2b8f7bec26fe7ab5bd678a4
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
/***** ---> :) Vijender Srivastava (: <--- *****/ import java.util.*; import java.lang.*; import java.lang.reflect.Array; import java.io.*; public class Main { static FastReader sc =new FastReader(); static PrintWriter out=new PrintWriter(System.out); static long mod...
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
ebe83c87283474d501247c868a85df15
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
/***** ---> :) Vijender Srivastava (: <--- *****/ import java.util.*; import java.lang.*; import java.lang.reflect.Array; import java.io.*; public class Main { static FastReader sc =new FastReader(); static PrintWriter out=new PrintWriter(System.out); static long mod...
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
a2664e577cb8a3d9a2777464d2176002
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.*; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); sc.nextLine(); while(t>0){ t--; char [] k = new char[3]; int key=0; char [] d = new char[3]; ...
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
d6334bf0f7d3128feaddba6303515b20
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 n = sc.nextInt(); while(n>0) { n--; String str = sc.next(); char[] cr = new char[6]; int g = 0, f = 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
fdb4b45219ae74a690f855ece906b514
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 codevita; //import java.io.*; import java.util.*; public class trysample { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++) { String s=sc.next(); if((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 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
627d29de50e5c03170f79012eba3ccd3
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 Door { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc= new Scanner(System.in); int t = sc.nextInt(); HashMap <Character, Integer>mp = new HashMap<>(); while(t-->0) { int count =3; String s = sc.next(); String 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
bb3c6a5415622d89a8ba432eebfb38d5
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 sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ String s=sc.next(); boolean valid=true; int r=0,g=0,b=0; for(char c : 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
3f92fddd94bf7414528c5bf8fcd21ff1
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.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Queue; import java.util.Scanner; import java.util.Set; import java.u...
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
1fff3157a3dfc6a111bdd73695855c04
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 ProblemA { public static void main(String[]args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t--!=0) { String s=sc.next(); int r=0,b=0,g=0,R=0,B=0,G=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 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
92b922ac73885a9dbbb6dffb16ad0f38
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.*; // Compiler version JDK 11.0.2 public class Dcoder { public static void main(String args[]) { Scanner s=new Scanner(System.in); int t=s.nextInt(); s.nextLine(); while(t-->0) { String str=s.nextLine(); Map<Character, Integer> l=new HashMap<Char...
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
bdb31219a4ad7c49f2ec0bc14dd702bb
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 { static class FastScanner { private BufferedReader br; private StringTokenizer st; FastScanner() { 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
453f31e586d67bbe6689cc75b6bea5c7
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.HashSet; 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(); boolean check= false; HashSet<Character> st = new ...
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
1fc918eeda80bb23ac38cc059b19102c
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 Exception{ try { Scanner scan = new Scanner(System.in); int test = scan.nextInt(); scan.nextLine(); for (int t = 0; t < test; t++) { St...
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
3b6c986a209a81f5ca139c4e125a828d
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 codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc=new Scanner(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 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
eadc38a8b84304a135cc38a597f3408d
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.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); StringTokenizer st = new StringTokenizer(r.re...
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
572edb7660fe3c249d78c1357da541e0
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 A123Edu { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t = 1; t = scn.nextInt(); while (t-- > 0) { // char c='A'; 65 - to 90 // a= 97 to 122 // pt(97+25); String s = scn.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 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
d97e3e30a18fd693bb7f1f57baf9774d
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 DoorsAndKeys { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.hasNextInt() ? sc.nextInt() : 0; sc.nextLine(); boolean[] sol = new boolean[t]; for(int j = 0; j < t; j++) { 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
e86939f02de1f5fe789665f082504f3d
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_and_Keys { public static boolean rgb (String s) { boolean r = false, g = false, b = false; for (int i=0;i<6;i++) { char ch = s.charAt(i); if (ch == 'r') { r = 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
a6da10e7a348e05444bc6aa1e418ebb3
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 Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); sc.nextLine(); while (t-- != 0) { String str = sc.nextLine(); if (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
cbf64e875ce2afbfc2f704dfa42efe52
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.time.*; import static java.lang.Math.*; @SuppressWarnings("unused") public class A { static boolean DEBUG = false; static Reader fs; static PrintWriter pw; static void solve() { char a[] = fs.next().toCharArray(); TreeSet<Character>st = new Tree...
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
1469e2afc6578ac5d7d3b695a0b94019
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) { while (N-- > 0) { solve(); } out.close(); } public static void solve() { String s = sc.nextLine(); if (s.indexOf('r') < s.indexOf('R') && s.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 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
3e96942be8376a84f1b9b8987555249b
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 static java.lang.Math.*; public class F{ public static void main(String[] args) throws IOException { // br = new BufferedReader(new FileReader(".in")); // out = new PrintWriter(new FileWriter(".out")); //new Thread(null, new (), "peepee", 1<<28).start(); ...
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
4cb5a7a973f9c3d116ad1d04ff0efae2
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 in = new Scanner(System.in); int t = in.nextInt(); for(int z = 0; z < t; z++){ String s = in.next(); boolean r = false; boolean g = false; boolean b = fal...
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
b656cd8de565569cdac3ce7d2ee58b2b
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 Keys { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader (new InputStreamReader (System.in)); int numberSets = Integer.parseInt(br.readLine()); for (int nos = 0; nos < numberSe...
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
9ecddef828de62c1e6528a3a7ca79542
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.*; public class code { public static void main(String args[]){ Scanner s = new Scanner(System.in); int t = s.nextInt(); while(t-->0){ String str = s.next(); int n = str.length(); boolean open = false; ...
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
1c08bdf1668752f1e8f7d6fbaef48711
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.InputStreamReader; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int tests = scanner.nextInt(); scanner.nextLine(); while (tests-- > 0) { solve(scanner); ...
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
a192513ad90094b39055496cbde104d3
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 CodeForces { public static void main (String[] args) throws java.lang.Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); PrintWriter out=new PrintWriter(System.out); int testCases=Integer.parseInt(br...
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
1f8c04993951ca2b79573c8d60ac1701
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.Scanner; public class q2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n=sc.nextInt(); String arr[] = new String[n]; for (int i=0;i<arr.length;i++) arr[i]=sc.next(); for ...
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
ddac321b26c29de96d323a1d58acf544
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 KeysAndDoors { public static void main(String... strings) { try (Scanner sc = new Scanner(System.in)) { int testCase = sc.nextInt(); for (int i = 0; i < testCase; i++) { String line = sc.next(); char array[] = line.toCharArray(); char[] keys = 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
0329ac129551f6e82ea4f8c36f274c20
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 Solution{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int test_cases = sc.nextInt(); for(int h=0;h<test_cases;h++){ String s = sc.next(); boolean r = false, g=false, b=false, done = false; ...
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
d0e6273137d55b4228f339724e7806bb
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
//codeforces //package someAlgorithms; import java.util.*; import java.io.*; import java.lang.*; public class Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); public st...
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