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
c9c12a45536ab5e74264261b192f7f06
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; public class A { public static void main(String[] args) { new A().solve(); } Scanner in; private void solve() { in = new Scanner(System.in); int t = in.nextInt(); while (t-- > 0) { boolean red = false; b...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
384831b9b0fd7abc884b3ae9321500d9
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.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.Arrays; public class Cv { //==========================Solution============================// public static voi...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
cb0df3d0304b171b75e18643fb8ed0da
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
/* I am dead inside Do you like NCT, sKz, BTS? 5 4 3 2 1 Moonwalk Imma knock it down like domino Is this what you want? Is this what you want? Let's ttalkbocky about that :() */ import static java.lang.Math.*; import java.util.*; import java.io.*; public class x1644A { public static void main(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 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
1de9495fd9368068b61ac6ff06f1a8eb
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class solution{ public static void main(String[] args) throws java.lang.Exception{ Scanner scan = new Scanner(System.in); int t; t=scan.nextInt(); while(t-->0){ String s = scan.next(); ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
0dfab85348171c5a855df72ceb0a1bc6
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.*; import java.util.Arrays; /* 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 { Sca...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
28270a32fed9bcbf6ee3b36d83773f7d
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 A1644 { public static void main(String[]args){ Scanner sc=new Scanner(System.in); int cases=sc.nextInt(); for(int i=0;i<cases;i++){ String st=sc.next(); if(st.indexOf('r')<st.indexOf('R') & st.indexOf('b')<st.indexOf...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
b348250d12d6df6e0d139c867eb6d73e
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.HashSet; import java.util.Scanner; public class DoorsAndKeys { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int a= Integer.parseInt(sc.nextLine()); for(int i=0; i<a; i++) { String string = sc.nextLine(); String outpu...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
8c4ca31c708184627f3c484772b8732c
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 { try { Scanner sc=new 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 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
29bcb6be3ee6559a5cedce4eb3624682
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ String str = sc.next(); int n = str.length(); int c=0; int r=0; int g=0;...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
72eab00eb3d2fd3415236461684ddefc
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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
816ebd32240dcb978a65cd550c21a3e4
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 { static class FastReader { BufferedReader br; StringTokenizer st; publ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
cf7f61e597025cdaeae180cacad8bdf2
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 A1644 { public static void main(String[] args) { char[] keys = new char[] {'r', 'g', 'b'}; Scanner in = new Scanner(System.in); int T = in.nextInt(); for (int t=0; t<T; t++) { String S = in.next(); boolean pos...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
fb85e3646748cd68ac7a8c480e4022e8
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.Math.*; public class Inheritance{ static int highestPowerOf2(int n) { return (n & (~(n - 1))); } public static void main(String[] args){ Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t-->0...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
1268bbbfe189c5403c9ee26f855b99f2
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
/*package whatever //do not write package name here */ import java.util.*; public class 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 r=0,g=0,b=0; boolean f=true; for(int i=...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
7c9336b82614a4519b3e705dc20dea00
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.awt.*; import java.io.IOException; import java.util.*; import java.util.List; public class test { public static void main(String[] args) { Scanner inputul = new Scanner(System.in); long t = inputul.nextInt(); for (int i = 0; i < t; i++) { String text...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
b150d6286761f14ea99a978d8e93a195
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.*; import javafx.scene.layout.Priority; public class Main { public static void main(String args[]) { FastScanner input = new FastScanner(); int tc = input.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 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
f1199a9a4600a0956a74a9b5d98ba76a
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class DoorsAndKeys { public static boolean yesOrNo(String s){ HashMap<Character,Integer>hashMap = new HashMap<>(); for (int i = 0; i < s.length(); i++) { if(Character.isLowerCase(s.charAt(i))){ hashMap.pu...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
03f08cb9751eadb353ea1f89eba3bb5f
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.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
331b66e96b7bb20aaebbf6af421d062d
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 Problem_1644A { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); boolean hasR, hasG, hasB, isSuccess; for (int i = 0; i < t; i++) { hasR = false; hasG = 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 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
1bcafdfe6500e063a903dc7cfb96b017
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; /** * * <a href = "https://codeforces.com/problemset/problem/1644/A"> Link </a>. * @author Bris * @version 1.0 * @since 8:32:51 PM - Mar 31, 2022 */ public class A1644 { /** * The main method. * @param args Unused. */ public static void main(String[] args) { S...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
215c8e3bb13811905c63759431d43352
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 n=sc.nextInt(); String s[]=new String[n]; for(int i=0;i<n;i++) { s[i]=sc.next(); } sc.close(); int arr[]=new int[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 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
e75ac5231b0a43c58021ee85c1dc45a5
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader(){ try {br = new BufferedReader( ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
2b810244c4ec82cb48d529318ed29d1e
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 contest { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-->0) { String s = sc.next(); ArrayList<Character> l = new ArrayList<>(); for (int i = 0;i<s.length();i++) { l.add(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 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
5dd03bfcbdffdc2b6a83245abdc63c34
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 Test { public static void main(String[] args) { Scanner in=new Scanner(System.in); int t=in.nextInt(); ArrayList<Character>arr=new ArrayList<>(); for (int i = 0; i < t; i++) { String s=in.next(); boolean ans=true; for (int j = 0; j ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
f0dc128354033b33dfed585a059a5aaa
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.net.URI; import java.net.URISyntaxException; import java.sql.Array; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.uti...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
b825307bfaa21d2bcc3be4d9ff7d1e49
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 in = new Scanner(System.in); int t = in.nextInt(); for (int i = 0; i < t; i++) { boolean result = true; boolean rKey = false , gKey = false , bKey = 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 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
1a3277f700deef55e5f01e576e42822b
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.awt.*; import java.util.*; import java.io.*; public class Codeforces { static FScanner sc = new FScanner(); static PrintWriter out = new PrintWriter(System.out); static final Random random = new Random(); static long mod = 1000000007L; static HashMap<String, Integer> map = 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 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
a87c67135c1a8a0215756f2422afdebb
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 CpTemplate { //Avinash template public static void main(String[] args) { FastScanner sc = new FastScanner(); PrintWriter out = 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 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
95f6894f8db0437049df376b958d8c17
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 { static void log(int[] a) { System.out.println(Arrays.toString(a)); } static void log(double[] a) { System.out.println(Arrays.toString(a)); } static void log(long[] a) { System.out.println(Arrays.toString(a)); } stati...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
28fd3373bf4528d0e79454429221cd56
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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.HashSet; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
b10b48c024b002718566ae0ba8f34dfb
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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.HashSet; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * ...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
036b3a3d6be1abc9b38690460c9672cd
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 MainSolve { public static void main(String[] args) throws IOException { BufferedReader reader=new BufferedReader(new InputStreamReader(System.in)); BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out)); int test...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
e7379a45de6ebbbf4e91c19c5102af69
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.*; public class DoorsAndKeys { public static void main(String []args)throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int tc = Integer.parseInt(in.readLine()); for(int i=0; i<tc; i++) { String s[] = new String[1]; s = in.r...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
cd9cb824f0f2392aea6b2d11ccb09c67
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.List; public class P1644A { public static void main(String[] args) throws IOException{ BufferedReader io = new BufferedReader(new InputStreamReader(System.in...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
ba68fcc0938860e56f24d78572111e32
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 { private static void solve(String s){ Map<Character, Integer> count = new HashMap<>(); count.put('r', 0); count.put('g', 0); count.put('b', 0); for(int i = 0; i < s.length(); i++){ char ch = s...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
318276f0330ca58acf26a21f144179e0
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) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int m = sc.nextInt(); while (m-- > 0) { String s = sc.next(); char [] c = s.toCharArray(); 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 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
95a963e77fb90d75470ca2db1165432d
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 String openAllDoors(String s,int n) { boolean r,g,b; r = g = b = false; for(int i=0;i<n;i++) { char c = s.charAt(i); if(c=='r') r = true; else if(c=='g') g = 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 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
7caba960d4d2f67ebde95fe98d3bb974
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class Solution{ public static void main(String[] args)throws java.lang.Exception { Scanner sc=new Scanner(System.in); int t; t=sc.nextInt(); while(t-->0) { String s=sc.next(); if(s.indexOf('B')>s.indexOf('b')&&s.indexOf('G')>s.indexOf('g')&&s.indexOf('R')>s.indexOf('r')) Sy...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
dcb3a405a70514d37979f8d6cc444b03
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 archive.a.hundred.h17; import java.util.*; public class A1644 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); GAME: for (int i = 0; i < n; i++) { String level = scan.next(); Map<Characte...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 8
standard input
[ "implementation" ]
60eb29b2dfb4d6b136c58b33dbd2558e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 720$$$) — the number of testcases. Each testcase consists of a single string. Each character is one of R, G, B (for the doors), r, g, b (for the keys), and each of them appears exactly once.
800
For each testcase, print YES if the knight can open all doors. Otherwise, print NO.
standard output
PASSED
64fac24ba2d30e41a5687f8676e4ce66
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 file { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { String s=sc.next(); if((s.indexOf('b')<s.indexOf('B'))&&(s.indexOf('g')<s.indexOf('G'))&&(s.ind...
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 17
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
3899993e717b526330dbbf201ab46513
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.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
["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 17
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
473461748e9466bebe688c0473c917d9
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 ARestoringThreeNumbers { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t=in.nextInt(); while(t>0){ int r=0,g=0,b=0; String s=in.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 17
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
6475e6c7a044b5b39339f2c8e2dda2f5
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){ t--; String s=sc.next(); int r=0,g=0,b=0,count=0; for(int i=0;i<6;i++){ if(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 17
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
71c22db977a0929f11f4c62451d412e1
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(); int r=0,b=0,g=0,R=0,B=0,G=0; for(int i=0;i<t;i++){ String s = sc.next(); for(int j=0;j<s.leng...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 17
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
19ca2a36088a418f08d951a39b1efefa
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 sn = new Scanner(System.in); int n = sn.nextInt(); sn.nextLine(); for(int i=0; i<n; i++) { String sent = sn.nextLine(); // System.out.println(sent); int r=0, g=0, b=0; boolean poss = 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 17
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
57cd4698b1fa4c9b74281b7b81385202
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
//https://codeforces.com/problemset/problem/1644/A import java.util.Scanner; public class Doors_and_Keys { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int testcase = sc.nextInt(); while (testcase != 0) { testcase--; boolea...
Java
["4\n\nrgbBRG\n\nRgbrBG\n\nbBrRgG\n\nrgRGBb"]
2 seconds
["YES\nNO\nYES\nNO"]
NoteIn the first testcase, the knight first collects all keys, then opens all doors with them.In the second testcase, there is a red door right in front of the knight, but he doesn't have a key for it.In the third testcase, the key to each door is in front of each respective door, so the knight collects the key and use...
Java 17
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
d79205586f343035f9e21dde4e8ab64d
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner sc =new Scanner(System.in); int tc = sc.nextInt(); while(tc-- > 0){ String s = sc.next(); boolean gotr = false; boolean gotg = false; boolean gotb = 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 17
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
6f606a6b77e9b95c19e245bc4a3b91c0
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 17
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
609009351bb516c2b4a6c016ad1d507b
train_108.jsonl
1645540500
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it.In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the d...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { FastReader sc = new FastReader(); Scanner st = new Scanner(System.in); int t = 1; t = sc.nextInt(); while (t-- > 0) { String s = sc.next(); if(s.inde...
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 17
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
630bfedbf629e808bdc87ab051b2ee33
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.text.MessageFormat; import java.util.*; /** * Provide prove of correctness before implementation. Implementation can cost a lot of time. * Anti test that prove that it's wrong. * <p> * Do not confuse i j k g indexes, upTo and length. Do extra methods!!! Write more informative ...
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 17
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
0916d50f6e1c155486bf7ad64042df69
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.util.function.*; import java.io.*; // you can compare with output.txt and expected out public class RoundEdu123A { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final static String 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 17
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
883835e979054de4244bddcfb4dd2b37
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.text.MessageFormat; import java.util.Arrays; import java.util.HashSet; import java.util.InputMismatchException; import java.util.Set; /** * Provide prove of correctness before implementation. Implementation can cost a lot of time. * Anti test that prove that it's wrong. * <p>...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 17
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
88459d1003ee3a94084a92053a4f79c8
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.util.*; import java.util.Map.Entry; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.lang.reflect.Array; import java.math.*; public class Simple{ public static ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 17
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
ffd93d54190dc358e7640e7de6b5b530
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class p4 { BufferedReader br; StringTokenizer st; BufferedWriter bw; public static void main(String[] args)throws Exception { new p4().run(); } void run()throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); bw=new Bu...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 17
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
68e6a7a053d2489a7a111d9c3ce0ce2b
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.util.*; import java.util.function.*; import java.io.*; // you can compare with output.txt and expected out public class RoundEdu123D { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final static String I...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 17
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
04e9761ff739af872f600cad6d40c5bc
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class CrossColoring { private static final int START_TEST_CASE = 1; private static final int MOD = 998244353; public static void solveCase(FastIO io, int testCase) { final int N = io.nextInt(); final int M = io.nextInt(); final int K = io.nextInt(); ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
4e5f14e48af11b387bca013a21954de8
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class CrossColoring { private static final int START_TEST_CASE = 1; private static final int MOD = 998244353; public static void solveCase(FastIO io, int testCase) { final int N = io.nextInt(); final int M = io.nextInt(); final int K = io.nextInt(); ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
d9d3eb9af9de12c33c2de592158d4ac6
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class CrossColoring { private static final int START_TEST_CASE = 1; private static final int MOD = 998244353; public static void solveCase(FastIO io, int testCase) { final int N = io.nextInt(); final int M = io.nextInt(); final int K = io.nextInt(); ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
8b39164ea862b6509e55b0b31ca911f9
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class CrossColoring { private static final int START_TEST_CASE = 1; private static final int MOD = 998244353; public static void solveCase(FastIO io, int testCase) { final int N = io.nextInt(); final int M = io.nextInt(); final int K = io.nextInt(); ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
0e9d0a6402861a8be16395c5f4804437
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class CrossColoring { private static final int START_TEST_CASE = 1; private static final int MOD = 998244353; public static void solveCase(FastIO io, int testCase) { final int N = io.nextInt(); final int M = io.nextInt(); final int K = io.nextInt(); ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
9465bb31016ba112d7fbebf436c4727e
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class CrossColoring { private static final int START_TEST_CASE = 1; private static final int MOD = 998244353; public static void solveCase(FastIO io, int testCase) { final int N = io.nextInt(); final int M = io.nextInt(); final int K = io.nextInt(); ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
ceee66f4cd53a5ec8ac011a2582cd331
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class CrossColoring { private static final int START_TEST_CASE = 1; private static final int MOD = 998244353; public static void solveCase(FastIO io, int testCase) { final int N = io.nextInt(); final int M = io.nextInt(); final int K = io.nextInt(); ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
bf819c75456a25c4283b7fdd4262d520
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class CrossColoring { private static final int START_TEST_CASE = 1; private static final int MOD = 998244353; public static void solveCase(FastIO io, int testCase) { final int N = io.nextInt(); final int M = io.nextInt(); final int K = io.nextInt(); ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
8a425ea7e4fad30386a3a7b7eaf8b947
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class CrossColoring { private static final int START_TEST_CASE = 1; private static final int MOD = 998244353; public static void solveCase(FastIO io, int testCase) { final int N = io.nextInt(); final int M = io.nextInt(); final int K = io.nextInt(); ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
836506d26de4b05e143cef94596666e7
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class CrossColoring { private static final int START_TEST_CASE = 1; private static final int MOD = 998244353; public static void solveCase(FastIO io, int testCase) { final int N = io.nextInt(); final int M = io.nextInt(); final int K = io.nextInt(); ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
8a981bbf428af99debd9475fc57b7998
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.util.*; import java.lang.*; import java.math.BigInteger; import java.io.*; @SuppressWarnings("unchecked") public class Main implements Runnable { static FastReader in; static PrintWriter out; static int bit(long n) { return (n == 0) ? 0 : (1 + bit(n & (n - 1))); } ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
71a4a46398bd728ff4bf1ecd14e5b61e
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class p4 { BufferedReader br; StringTokenizer st; BufferedWriter bw; public static void main(String[] args)throws Exception { new p4().run(); } void run()throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); bw=new Bu...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
12e100ddfec3beb542b444da1599077b
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public final class Main { //int 2e9 - long 9e18 static PrintWriter out = new PrintWriter(System.out); static FastReader in = new FastReader(); static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(0, 1), new Pair(1, 0), new Pair(0, -1)}; static...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
6a39c9a8924ba1582a950c805a156ff5
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; import java.math.BigInteger; public class A { public static void main(String[] args) { new A().run(); } BufferedReader br; PrintWriter out; long mod = (long) (1e9 + 7), inf = (long) (3e18); class pair { int F, S; ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
59f68c14c6056fc988c1df4eda563976
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.math.BigInteger; public final class A { static PrintWriter out = new PrintWriter(System.out); static StringBuilder ans=new StringBuilder(); static FastReader in=new FastReader(); static int g[][]; static long mod=(long) ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
b23044fb04423d2135fe0cf7d05f8a3b
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
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
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
42a7c9196be59d1b8cbd60a2ee96470f
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; //import java.text.DecimalFormat; import java.util.*; public class B { static int mod= 998244353 ; // static int arr[]; public static void main(String[] args) throws Exception { ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
610ba4f6f4d8230d8f86c2ac049fca4c
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class D1644 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(Syste...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
ca88df7278787602aef9d5465ad596b4
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
//package codeforces.edu123; import java.io.*; import java.util.*; import static java.lang.Math.*; public class D { static InputReader in; static PrintWriter out; public static void main(String[] args) { //initReaderPrinter(true); initReaderPrinter(false); solve(in.nextInt()); ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
2d165f64219c4acadb0e1adab48a04cd
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; /* */ public class D{ 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(),m=sc.nextInt(),k=sc.nextInt(),q=sc.nextInt(); boolean ru[]...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
b32192e99180c8312cfbebee8cc093d4
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; public class Main { public static void main(String args[]) throws IOException { BufferedRead...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
4d37cf556bec3267c741a375a1f681b3
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; public class CF1{ public static void main(String[] args) { FastScanner sc=new FastScanner(); int T=sc.nextInt(); for (int tt=0; tt<T; tt++)...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
f67f879b17fc1f148759366de67e042e
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; //import java.math.BigInteger; import java.util.*; public class CF1{ public static void main(String[] args) { FastScanner sc=new FastScanner(); int T=sc.nextInt(); for (int tt=0; tt<T; tt+...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
38471b197edfb442718a89366518f65f
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; public class CF1{ public static void main(String[] args) { FastScanner sc=new FastScanner(); int T=sc.nextInt(); for (int tt=0; tt<T; tt++)...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
e17e538961dbcbf351f76b103ed7f926
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class D { public static void main(String[] args) { FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); long MOD = 998244353L; int T = in.nextInt(); for(int ttt = 1; ttt <= T; ttt++) { ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
afe7404bff80f7fe2feeae8f8c730aa6
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class CodeChef2 { static boolean lazy[]; static int val[]; static boolean colupd[]; static int mod = 998244353; public static void main(String args[]) throws Exception { FastReader fr = new FastReader(); int t = fr.nextIn...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
d75723b3371cbdb34d725d00aea87fb2
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.util.*; import java.io.*; public class D { static class Q { public int x, y; public Q(int a, int b) {x = a; y = b;} } public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new Prin...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
d1e0ccc09f159170a1e6264a3b74fb72
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.util.*; import java.io.*; public class Main { static long startTime = System.currentTimeMillis(); // for global initializations and methods starts here // global initialisations and methods end here static void run() { boolean tc = true; AdityaFastIO r = new...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
9382e0cbba5f7fca24e40daea03d4336
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.util.*; import java.io.*; public class Main { static long startTime = System.currentTimeMillis(); // for global initializations and methods starts here // global initialisations and methods end here static void run() { boolean tc = true; AdityaFastIO r = new...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
716e9e5e9367e7cc468cfc45ada50aef
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); static int N = 100010, M = N, INF = Integer.MAX_VALUE; static int MOD = 998244353; static double EPS = 1e-7; static int dx[] = {-1, 0, 1, 0}, dy[] = {0,...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
bd8e9211b2d959b0986118bb608dec5b
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
// OM NAMAH SHIVAY //import jdk.jshell.execution.JdiDefaultExecutionControl; import java.math.BigInteger; import java.util.*; import java.io.*; //import java.util.logging.LogManager; public class Vaibhav { static long bit[]; static boolean prime[]; //static PrintWriter out = new PrintWriter(S...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
6747451701ddf457a86e896b349c4c36
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class CrossColoring{ static long mod = 1000000007L; static MyScanner sc = new MyScanner(); static void solve() { int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.nextInt(); int q = sc.nextInt(); long mod = 9...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
6735a6ad50799c3e74e59eac9b7fbd86
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; public class CrossColoring { static MScanner mScanner = new MScanner(); sta...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
c452ed2899147480dee7a49f2f4eb687
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.util.*; import java.io.*; //import java.math.BigInteger; public class code{ public static class Pair{ int a; int b; Pair(int i,int j){ a=i; b=j; } } public static int GCD(int a, int b) { if (b == 0) return a; return GCD(b, a % b); }...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
f93cee835536bc75ebc402dd4691a9ec
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
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 in = new Scanner(Syst...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
5f801d5bcbc50dc62309d2a32cfd66b0
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
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 = 998244353; static void init() { fans[0] = 1; inv[0] = 1; fans[1] = 1; inv[1] = 1; for (int i = 2; i < 200001; i++...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
b1947ecfc564b4b6d19bf5c4c593f918
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.util.*; import java.io.*; public class D1644 { static int mod = 998244353; public static long modPow(long a, long e) { if (e == 0) return 1; long prev = modPow(a, e / 2); if (e % 2 == 1) { return a * prev % mod * prev % mod; } ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
3373d30e98f266bba5154b4e3f3bf807
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; /** * @author Naitik * */ public class Main { static FastReader sc=new FastReader(); static long dp[]; // static boolean v[][][]; static int mod=998244353;; // static int mod=1000000007; static int max; static int bit[]; ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
c2cde8e626b0894860098029e850e24a
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
/* * Created by cravuri on 2/22/22 */ import java.util.Scanner; public class D { static final long MOD = 998244353; static long pow(long a, long b) { if (b == 0) return 1; if (b == 1) return a; long p = pow(a, b / 2); long p2 = (p * p) % MOD; if (b ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
ed3c38d60641a69b03f3628432364826
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class Main { static PrintWriter pw; static Scanner sc; static final int inf = (int) 1e9, mod = inf + 7; static final long infL = inf * 1l * inf; static final double eps = 1e-9; public static void main(String[] args) throws Exception { ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
138d878f1f4a76b91ad22b897c9203fb
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader bf; static PrintWriter out; static Scanner sc; static StringTokenizer st; // static long mod = (long)(1e9+7); static long mod = 998244353; static long fact[]; static long inverse[]; public static void main (String...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
7594f139447ff850ea626c6e2f9822c1
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.*; import java.util.*; public class CrossColoring { public static PrintWriter out; static ArrayList<ArrayList<Integer>>al; static int ans; static int min[]; static int max[]; static int MOD=998244353; public static void main(String[] args)throws IOException { JS sc=new JS(); out ...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
008f71cb429e3cd4d4761cd99c4844a0
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
/* I am dead inside Do you like NCT, sKz, BTS? 5 4 3 2 1 Moonwalk Imma knock it down like domino Is this what you want? Is this what you want? Let's ttalkbocky about that :() */ import static java.lang.Math.*; import java.util.*; import java.io.*; public class x1644D { static final long MOD = 998244...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
9191937ad872f0c9be6e5fc5c96762b3
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.ArrayList; import java.u...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output
PASSED
58caa3975344670693029e9d2fad8c79
train_108.jsonl
1645540500
There is a sheet of paper that can be represented with a grid of size $$$n \times m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially.$$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$ — choose one of $$$k$$$...
256 megabytes
import java.util.*; import java.util.concurrent.TimeUnit; import java.io.*; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; public class D_Cross_Coloring{ public static void main(String args[])throws IOException, ParseException{ Reader sc=new Rea...
Java
["2\n\n1 1 3 2\n\n1 1\n\n1 1\n\n2 2 2 3\n\n2 1\n\n1 1\n\n2 2"]
2 seconds
["3\n4"]
null
Java 8
standard input
[ "data structures", "implementation", "math" ]
623a373709e4c4223fbbb9a320f307b1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of the testcase contains four integers $$$n, m, k$$$ and $$$q$$$ ($$$1 \le n, m, k, q \le 2 \cdot 10^5$$$) — the size of the sheet, the number of non-white colors and the number of operations. The $$$i$$$...
1,700
For each testcase, print a single integer — the number of different colorings modulo $$$998\,244\,353$$$.
standard output