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
0d695a20a0fbae12a6b0a8312d8827ec
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 { //--------------------------INPUT READER---------------------------------// static class fs { public BufferedReader br; StringTokenizer st = new StringTokenizer(""); public fs() { this(System.in); } public fs(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
3d071832d9e9a1bc0e3ad150c19b9b45
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 Solution { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuffer out = new StringBuffer(); int T = ...
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
2cdcee0cad491217d1fda038006ccf2f
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.IOException; import java.io.*; import java.util.*; public class CrossColoring { static long mod=998244353; static InputReader inputReader=new InputReader(System.in); static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); ...
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
0b56c354c40509d8475a2a2ae3f8e38a
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.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Com...
Java
["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
4497f46100c878dc82c9c5d6ff58fd7b
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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; ...
Java
["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
7a3ad2a7b98a8b027cbff5bc41031e22
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.Closeable; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; import 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
799aac65d8efedb154f472a3ee65bf34
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.lang.reflect.Array; import java.util.*; public final class D { static int MOD; public static void main(String[] args) { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int T = fs.nextInt(); for(int 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
8daa0318022a04f6eeaf9fccbbcecaa2
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
/* Rating: 1367 Date: 22-02-2022 Time: 21-08-36 Author: Kartik Papney Linkedin: https://www.linkedin.com/in/kartik-papney-4951161a6/ Leetcode: https://leetcode.com/kartikpapney/ Codechef: https://www.codechef.com/users/kartikpapney */ import java.util.*; import java.io.BufferedRe...
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
4b640c3024c57b84bf928723f5e79e28
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.math.BigInteger; import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int t = cin.nextInt(); Solution solution = new Solution(); for (int 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
aff057dcdee5ebd7ba10669d6256c69a
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 { public static void main(String[] args) throws Exception { mod=998244353; int t=sc.nextInt(); while(t-->0){ long n=sc.nextInt(); long m=sc.nextInt(); long k=sc.nextInt(); long q...
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
95d84a14bd2f6e23ae9ebbe1fd18fed7
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 static java.lang.Math.*; import static java.util.Map.*; import static java.util.Arrays.*; import static java.util.Collections.*; import static java.lang.System.*; public class Main { public void tq() throws Exception { st=new StringTokenizer(bq.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
PASSED
218844d7d431f35e311c4346460f593f
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 kg.my_algorithms.Codeforces; import java.util.*; import java.io.*; // Not a spectator public class Solution { private static final FastReader fr = new FastReader(); private static final long mod = 998244353L; public static void main(String[] args) throws IOE...
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
e0cec132c983bf6aa418ec54363297fc
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 FastScanner fs = null; static long mod = (long)998244353; public static void main(String[] args) { fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = fs.nextInt(); while (t-->0) { int n = fs.nextInt(); 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
0716bb7cccdb57d8dcd55b46ec1a60bd
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.*; // cd C:\Users\Lenovo\Desktop\New //ArrayList<Integer> a=new ArrayList<>(); //List<Integer> lis=new ArrayList<>(); //StringBuilder ans = new StringBuilder(); //HashMap<Integer,Integer> map=new HashMap<>(); ...
Java
["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
c142e2794a2cab21907ce0ededb1926f
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 Solution { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuffer out = new StringBuffer(); ...
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
5e22ae98156cad61f61f72e46d9cd993
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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.util.HashSet; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top *...
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
c70d62876691ab8791e097e92e7b7d3c
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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.util.HashSet; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top *...
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
b672004bbf93998878d1aa4a077c533c
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 { public static PrintWriter out; private static final long MOD = 998244353L; private static void solve(int n, int m, int k, int q, int[] row, int[] col){ Set<Integer> rowSet = new HashSet<>(); Set<Integer> colSet = new HashSe...
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
86c94765db12d9794f1771b17add5c0b
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.*; // BEFORE 31ST MARCH 2022 !! //MAX RATING EVER ACHIEVED-1622(LETS SEE WHEN WILL I GET TO CHANGE THIS) ////*************************************************************************** /* public class E_Gardener_and_Tree implements Runnable{ public static void ma...
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
f741464a3f423e287e72b7716b6c6f48
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.StringTokenizer; public class Main { static AReader scan = new AReader(); static int MOD = 998244353; static void slove() { int n = scan.nextInt(); int m = scan.nextInt(); int k = scan....
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
8b331a610c3de1c5fda933e95b796a6b
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.lang.*; // import java.math.*; public class Main { static FastReader sc=new FastReader(); static PrintWriter out=new PrintWriter(System.out); // static long mod=1000000007; static long mod=998244353; static int MAX=Integer.MAX_VALUE; static int M...
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
8521abc563acbb277ad64ce00b0aaa04
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 { public static void main(String args[]) { FastReader input=new FastReader(); PrintWriter out=new PrintWriter(System.out); int T=input.nextInt(); while(T-->0) { int n=input.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
bae320590525a21c61a8ab1b79ba7476
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.lang.*; import java.util.*; public class ComdeFormces { public static void main(String[] args) throws Exception{ // TODO Auto-generated method stub // Reader.init(System.in); FastReader sc=new FastReader(); BufferedWriter log = new BufferedWriter(new OutputStreamWriter(Sys...
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 11
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
4d6d8d3b1beeb8be7d296075583ecb53
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.DecimalFormat; import java.util.Arrays; import java.util.*; import java.util.Scanner; import java.util.StringTokenizer; public class copy { static int log=18; static int[][] ancestor; static int[] depth; static void sieveOfEratosthenes(int n, Arra...
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 11
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
39b3e27a1996e85365020400c05c570e
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.DecimalFormat; import java.util.Arrays; import java.util.*; import java.util.Scanner; import java.util.StringTokenizer; public class copy { static int log=18; static int[][] ancestor; static int[] depth; static void sieveOfEratosthenes(int n, Arra...
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 11
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
2c615aa5772494ccd019c6d50761cd02
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 javax.print.DocFlavor.INPUT_STREAM; import java.io.*; import java.math.*; import java.sql.Array; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.SQLIntegrityConstraintViolationException; public class Main { private static class MyScanner { ...
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 11
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
eb428d38c35f91a1384e47cdfa0fe752
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
// JAI SHREE RAM, HAR HAR MAHADEV, HARE KRISHNA import java.util.*; import java.util.Map.Entry; import java.util.stream.*; import java.lang.*; import java.math.BigInteger; import java.text.DecimalFormat; import java.io.*; public class Eshan { static BufferedReader br = new BufferedReader(new InputStrea...
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 11
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
ce13a3b80304ff2557f30215aef4b99e
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.*; /** TODO: unsloved My idea: 1. form bottom to up, if remaining * k, or 1 * */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java....
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 11
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
0a22c8700707b979953fe6c6f3b5cfe1
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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashSet; import java.util.Objects; impor...
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 11
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
400140ca390538d89c69eb52534b8563
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 _772 { public static void main(String[] args) { MyScanner sc = new MyScanner(); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); int t = sc.nextInt(); while (t-- >0) { int n = sc.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 11
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
68c91504f3415b887168a6e70917e7f4
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 { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int a = 0; a < t; a++) { HashMap<Integer, Integer> xVals = new HashMap<Integer, Integer>(); HashMap<Integ...
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 11
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
6a497d3158fde851ddd9e0a73235de06
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 { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int a = 0; a < t; a++) { HashMap<Integer, Integer> xVals = new HashMap<Integer, Integer>(); HashMap<Integ...
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 11
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
670b5cc90c6b0647577031ebc22e72e2
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.lang.Math; import java.math.BigInteger; public final class code { static class sortCond implements Comparator<Pair<Integer, Pair<Long, Long>>> { @Override public int compare(Pair<Integer, Pair<Long, Long>> p1, Pair<Integer, Pair<Long, 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 11
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
2bc5ea35e118b2ebb1e5141740604922
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 mod = 998244353; public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); StringBuilder sb = new 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 11
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
c275713882b0d1f49e278e0b59a2ff80
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 mod = 998244353; public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); StringBuilder sb = new 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 11
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
65358417c0cedeb1d4752f8f61fd159b
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.*; public class D_Paint { public static void main(String[] args) throws IOException { BufferedScanner input = new BufferedScanner(); BufferedOutput output = new BufferedOutput(); ...
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 11
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
deed90c02fdf4e0d2cebffd682cce26a
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 CF1644D extends PrintWriter { CF1644D() { super(System.out); } static class Scanner { Scanner(InputStream in) { this.in = in; } InputStream in; byte[] bb = new byte[1 << 15]; int i, n; byte getc() { if (i == n) { i = n = 0; try { n = in.read(bb); } ...
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 11
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
c02d84bfde9fd8d0b137d7288fd1eb3b
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.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.StringTokenizer; public class App { static class FastReader ...
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 11
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
304c87aece33f8cb3103ee3a86e77d05
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 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); in...
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 11
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
ba42d78452251fe93d0eb1253da956a8
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.*; import java.math.BigInteger; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter...
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 11
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
d33e9e7214516f32d81e701ba3ecf4bb
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 {static class FastReader { BufferedReader br; StringTokenizer st; pub...
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 11
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
37e32a463ef968879d0e0896cd2e7e00
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 Codeforces { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); int t=Integer.parseInt(bu.readLine()); ...
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 11
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
ff93dbe7043116ba8443d96ab81a87ad
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 Solution { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == nul...
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 11
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
1e8850af57d04f4347ff874420ed8f02
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.Arrays; import java.util.HashSet; import java.util.Random; import java.util.StringTokenizer; public class codeforces_Edu123_D { private static long mod = 998_244_353; private static void solve(FastIOAdapter in, PrintWriter out) { int n = 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 11
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
19182def64e2e7f3ef5ce9dada9dba83
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.Arrays; import java.util.HashSet; import java.util.Random; import java.util.StringTokenizer; public class codeforces_Edu123_D { private static long mod = 998_244_353; private static void solve(FastIOAdapter in, PrintWriter out) { int n = 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 11
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
31d061d45e2e150f5667fa6d31185f55
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 static java.lang.Math.*; public class D{ static long mod = 998244353; static class Pair{ int a, b; public Pair(int x, int y) {a=x;b=y;} } public static void main(String[] args) throws IOException { // br = new BufferedReader(new FileReader(".in")); ...
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 11
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
12e24b0c00f471843e5c0f71ddcec456
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.*; public class Code { private static Scanner scanner; private static final Integer PRIME = 998_244_353; public static void main(String[] args) { scanner = new Scanner(System.in); int t = scanner.nextInt(); for (int i = 0; i < t; i++) { solv...
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 11
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
dda7abaae39261b842591cb8e2b888b5
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.Map; import java.util.StringTokenizer; import java.util.TreeMap; import java.util.TreeSet; public class TaskD { final long mod = 998244353; 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 11
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
72dbfe9190535ede1e06407adf078083
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.*; public class Main implements Runnable { public static void main(String[] args) { new Thread(null, new Main(), "whatever", 1 << 26).start(); } // private FastScanner sc; private PrintWriter pw...
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 11
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
76d9df06a12136c9ff1be1c4e074c4e8
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.*; import java.awt.*; /*AUTHOR - SHIVAM GUPTA */ // U KNOW THAT IF THIS DAY WILL BE URS THEN NO ONE CAN DEFEAT U HERE ,JUst keep faith in ur strengths .................................................. // ASCII = 48 + i ;// 2^28 = 268,435,456 > 2* 10^8 ...
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 11
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
d76b0ebd7df4329f5837df5b66c522ec
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.Arrays; import java.util.HashSet; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.Random; import java.io.FileWriter; import java.io.PrintWriter; /* Solution Created:...
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 11
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
c1fc2704c464db332e84dc31f620395c
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 { static long pow(long a , long b , long c) { if(b == 0) return 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 11
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
1d4fb078923af700e2aab83934feb235
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 D1644 { public static void main(String[] args) throws IOException, FileNotFoundException { // Scanner in = new Scanner(new File("test.in")); Kattio in = new Kattio(); int T = in.nextInt(); while(T > 0){ int N = in.nextInt(); int M = in.n...
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 11
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
4760ee2af304041b76c706c936ef892d
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
/* _oo0oo_ o8888888o 88" . "88 (| -_- |) 0\ = /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 11
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
54aeec279b480f37ec428f310da60da3
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 Cross { static int mod = 998244353; public static void main(String[] args) throws Exception { FastIO in = new FastIO(); int t = in.nextInt(); for (int tc=0; tc<t; tc++) { int n = in.nextInt(); int m = in.nextInt(); int k = in.nextInt(); 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 11
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
4d1c560e20bfd6f1f89c5ea37f8d34b2
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
/* 2 1 1 3 2 1 1 1 1 2 2 2 3 2 1 1 1 2 2 1 4 4 3 5 1 1 2 1 2 2 2 3 2 4 If a cross a covers a cross b, then the color of cross a does not matter Likewise, if the row of a cross x and the column of a cross x are covered, the color of cross x does not matter If the row of a cross and the column of a ...
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 11
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
f471041cb7ef59e045951300fba7a043
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 Practice { // static final long mod=7420738134811L; static int mod=998244353;//1000000007; static int size=(int)1e7+1; static FastReader sc=new FastReader(System.in); // static Reader sc=new Reader(); // static Scanner sc=new Scanner(System.in); 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 11
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
8cde40b6cad5cbd71d2ab79908c7c646
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 Main { void solve() { int n = in.nextInt(); int m = in.nextInt(); int k = in.nextInt(); int q = in.nextInt(); HashSet<Integer> x = new HashSet<>(); HashSet<Integer> y = new HashSet<...
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 11
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
38bc6b58c249c922a524bfe336783106
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 new1{ static long mod = 998244353; public static long gcd(long a, long b) { if (a == 0) return b; return gcd(b%a, a); } public static void main(String[] args) throws IOException{ BufferedWriter output = ...
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 11
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
cf9f6583c57d1bac751c733bd8a76812
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.ArrayList; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; public class E123D { static StringBuffer ans1 = new StringBuffer(""); ...
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 11
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
7540c112f0567c53e761830041ca9c94
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.*; public class cf { static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) throws IOException, InterruptedException { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int mod = 998244353; while ...
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 11
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
9f10b4d75caad656fdb5af27933c64e3
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 { private static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); private static BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out)); private static StringTokenizer st; private static lon...
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 11
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
92ffd3ddc2fee5dbdb70d73074afd597
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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.HashSet; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStreamReader; import java.io.InputStream;...
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 11
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
96e186d691fe562faa70643aaebb7099
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 class Scanner { Scanner(InputStream in) { this.in = in; } InputStream in; byte[] bb = new byte[1 << 15]; int i, n; byte getc() { if (i == n) { i = n = 0; try { n = in.read(bb); } catch (IOException e) {} } return i < n...
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 11
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
6fe65ec0e4be66ee98dea633a6007e25
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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.lang.reflect.Array; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args){ InputStream input...
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 11
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
ba8eb1387d95b98049a270fbb265365e
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.LinkedList; import java.util.StringTokenizer; public class D { public static FastScanner s = new FastScanner(); public static PrintWriter out = new PrintWriter(...
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 11
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
da35fd1f6576253cffcb7907b81b7a62
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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
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 11
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
45d87673db996b35c3b3af0e8397522b
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 { public void prayGod() throws IOException { int t = nextInt(); while (t-- > 0) { int n = nextInt(), m = nextInt(); int k = nextInt(), q = nextInt(); int[] x = new int[q]; int[] y = ne...
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 11
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
9ee12983b760d3a19d7684ce29a6c117
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 crosscoloring; import java.util.*; import java.io.*; public class crosscoloring { public static void main(String[] args) throws IOException { BufferedReader fin = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(fin.readLine()); StringBuilder fout = new StringBu...
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 11
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
403befab08ce3d859a5236988f0b117f
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
// JAI SHREE RAM, HAR HAR MAHADEV, HARE KRISHNA import java.util.*; import java.util.Map.Entry; import java.util.stream.*; import java.lang.*; import java.math.BigInteger; import java.text.DecimalFormat; import java.io.*; public class Eshan { static BufferedReader br = new BufferedReader(new InputStrea...
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 11
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
7bd9655623a5c9d88b846b0c59319acd
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 c1644; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.lang.invoke.MethodHandles; import java.util.Random; import java.util.StringTokenizer; // // Educational Codeforces Round 123 (Rated for Div. 2) 2022-02-22 06:35 // D. Cro...
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 11
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
bc4668ec2d4f6fc5084e84d5c1fd8ef0
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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.Set; import java.util.InputMismatchException; import java.io.IOException; import java.util.HashSet; import java.io.Writer; import ...
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 11
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
ed26f143103475fc66abf11882375c64
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.*; public class P1644D { public static void solve (int n, int m, int k, int q, List<Integer> rs, List<Integer> cs){ long ans = 1; long mod = 998244353; Set<Integer> vrow = new Hash...
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 11
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
c779045b55badf0ee348fb30269903cc
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.HashSet; import java.util.Scanner; import java.util.Set; public class TaskD { public static void main(String[] args) { Scanner in = new Scanner(System.in); TaskD taskD = new TaskD(); int t = in.nextInt(); for (int i = 0; i < t; i++) { taskD.solve(in); } } ...
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 11
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
cd9b4220a6d90260876988a4f9dcd288
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{ public static long mod = 998244353; public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int nc = Integer.parseInt(br.readLine()); for(int cc = 0; cc < nc...
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 11
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
13e9f29c9cff07cb642a1fd2f7c5f65d
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 CF_Edu123 { static FastScanner fs; static FastWriter fw; static boolean checkOnlineJudge = System.getProperty("ONLINE_JUDGE") == null; private static final int[][] kdir = new int[][]{{-1, 2}, {-2, 1}, {-2, -1}, {-1, -2}, {1, -2}, {2, -1}, {2...
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 11
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
957152b0320c60a990ee2bb885c4b1c3
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.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.*; public class Main { static final long MOD1=1000000007; static final long MOD=998244353; static int[] ans; public static void main(String[] a...
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 11
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
bae11b9dc419c0f08e43e9124087264e
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 Main { PrintWriter out = new PrintWriter(System.out); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tok = new StringTokenizer(""); String next() throws IOException { if (!tok.h...
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 11
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
74c02c7b55a6dc984355b1a60a3725cf
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.util.HashMap; import java.util.function.Consumer; import java.util.Comparator; public class FirstProject{ static void solve(Scanner src) { int n=src.nextInt(); int m=src.nextInt(); int k=src.nextInt(); int q=src.nextInt(); long ans = 1L; ...
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 11
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
9707d58f6e89a00e70c69ec2aa51f2bf
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
//some updates in import stuff import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; public class Main{ static long mod = 998244353L; static final int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 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 11
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
2771bb2ac030a37641a33b4a6869dea4
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 Codeforces { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); int t=Integer.parseInt(bu.readLine()); ...
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 11
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
188d26192f35eac497e5a879142bbd7f
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 javax.print.DocFlavor.INPUT_STREAM; import java.io.*; import java.math.*; import java.sql.Array; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.SQLIntegrityConstraintViolationException; public class Main { private static class MyScanner { ...
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 11
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
40cb6aa1f210613e30cc19091664b044
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.*; public class Solution { static int mod=1000000007; static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new Input...
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 11
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
7559b8f7e786a00ffb6b63c20643f113
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 Codeforces { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); int t=Integer.parseInt(bu.readLine()); ...
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 11
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
599826bf2b2a7ab584f6856aaa3d6f85
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.text.DecimalFormat; import java.io.*; public class Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter out = new PrintWriter(System.o...
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 11
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
658bf395cbab80cbdda35aee01077fe9
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 CodeForces { /*-------------------------------------------EDITING CODE STARTS HERE-------------------------------------------*/ public static void solve(int tCase) throws IOException { int n = sc.nextInt(); int m = sc.nextInt(); int k ...
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 11
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
15653e67189cc56562048c9175550294
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
/* "Everything in the universe is balanced. Every disappointment you face in life will be balanced by something good for you! Keep going, never give up." Just have Patience + 1... */ import java.util.*; import java.lang.*; impor...
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 11
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
bb6cab901e374d61b2ea16d605643b3e
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 Solution { private static class FastIO { private static class FastReader { BufferedReader br; StringTokenizer st; FastReader() { br = new BufferedReader(new InputStreamRe...
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 11
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
62b63a824cd5338e9a9eb338b2cabb8f
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 { public static void main(String[] args) throws IOException { Scanner scn = new Scanner(System.in); OutputWriter out = new OutputWriter(System.out); // Always print a trailing "\n" and close the OutputWriter as shown at th...
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 11
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
b954a4f397177a8382f511c0cb071aa7
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.*; public class Main{ static class Node{ int x, y; Node(int x, int y){ this.x = x; this.y = y; } } public static void process(int t)throws IOException { int n = ni(); int m = ...
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 11
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
c6ce6e1b26ef248a336c657a5c782565
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 _1644_D { static final long MOD = 998244353; public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); in...
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 11
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
4d4324b466db9f675f8631876caed321
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 FastScanner sc = new FastScanner(System.in); static PrintWriter pw = new PrintWriter(System.out); static StringBuilder sb = new StringBuilder(); static long mod = 998244353; public static void main(String[] args) throws Exce...
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 11
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
3ae7f9feac49857c7fe89959cd1a3955
train_108.jsonl
1645540500
Consider a grid of size $$$n \times n$$$. The rows are numbered top to bottom from $$$1$$$ to $$$n$$$, the columns are numbered left to right from $$$1$$$ to $$$n$$$.The robot is positioned in a cell $$$(1, 1)$$$. It can perform two types of moves: D — move one cell down; R — move one cell right. The robot is not all...
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
["3\n\n4\n\nRD\n\n5\n\nDRDRDRDR\n\n3\n\nD"]
2 seconds
["13\n9\n3"]
NoteIn the first testcase, it's enough to consider the following modified paths: RD $$$\rightarrow$$$ RRD $$$\rightarrow$$$ RRRD $$$\rightarrow$$$ RRRDD $$$\rightarrow$$$ RRRDDD — this path visits cells $$$(1, 1)$$$, $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(1, 4)$$$, $$$(2, 4)$$$, $$$(3, 4)$$$ and $$$(4, 4)$$$; RD $$$\righta...
Java 8
standard input
[ "brute force", "combinatorics", "data structures", "implementation", "math" ]
113a43af2f1c5303f83eb842ef532040
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of each testcase contains the single integer $$$n$$$ ($$$2 \le n \le 10^8$$$) — the number of rows and columns in the grid. The second line of each testcase contains a non-empty string $$$s$$$, consisting...
1,900
For each testcase, print a single integer — the number of cells such that there exists at least one sequence of modifications that the robot visits this cell on the modified path and doesn't move outside the grid.
standard output
PASSED
74c968afa993cda37964f17067171dbb
train_108.jsonl
1645540500
Consider a grid of size $$$n \times n$$$. The rows are numbered top to bottom from $$$1$$$ to $$$n$$$, the columns are numbered left to right from $$$1$$$ to $$$n$$$.The robot is positioned in a cell $$$(1, 1)$$$. It can perform two types of moves: D — move one cell down; R — move one cell right. The robot is not all...
256 megabytes
import java.util.*; import java.io.*; import javafx.util.*; public class Solution { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reade...
Java
["3\n\n4\n\nRD\n\n5\n\nDRDRDRDR\n\n3\n\nD"]
2 seconds
["13\n9\n3"]
NoteIn the first testcase, it's enough to consider the following modified paths: RD $$$\rightarrow$$$ RRD $$$\rightarrow$$$ RRRD $$$\rightarrow$$$ RRRDD $$$\rightarrow$$$ RRRDDD — this path visits cells $$$(1, 1)$$$, $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(1, 4)$$$, $$$(2, 4)$$$, $$$(3, 4)$$$ and $$$(4, 4)$$$; RD $$$\righta...
Java 8
standard input
[ "brute force", "combinatorics", "data structures", "implementation", "math" ]
113a43af2f1c5303f83eb842ef532040
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of each testcase contains the single integer $$$n$$$ ($$$2 \le n \le 10^8$$$) — the number of rows and columns in the grid. The second line of each testcase contains a non-empty string $$$s$$$, consisting...
1,900
For each testcase, print a single integer — the number of cells such that there exists at least one sequence of modifications that the robot visits this cell on the modified path and doesn't move outside the grid.
standard output
PASSED
f7478bba38643bc61326733484fd4cf6
train_108.jsonl
1645540500
Consider a grid of size $$$n \times n$$$. The rows are numbered top to bottom from $$$1$$$ to $$$n$$$, the columns are numbered left to right from $$$1$$$ to $$$n$$$.The robot is positioned in a cell $$$(1, 1)$$$. It can perform two types of moves: D — move one cell down; R — move one cell right. The robot is not all...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { mod=998244353; int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); char[] s=sc.next().toCharArray(); int d=0; int r=...
Java
["3\n\n4\n\nRD\n\n5\n\nDRDRDRDR\n\n3\n\nD"]
2 seconds
["13\n9\n3"]
NoteIn the first testcase, it's enough to consider the following modified paths: RD $$$\rightarrow$$$ RRD $$$\rightarrow$$$ RRRD $$$\rightarrow$$$ RRRDD $$$\rightarrow$$$ RRRDDD — this path visits cells $$$(1, 1)$$$, $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(1, 4)$$$, $$$(2, 4)$$$, $$$(3, 4)$$$ and $$$(4, 4)$$$; RD $$$\righta...
Java 8
standard input
[ "brute force", "combinatorics", "data structures", "implementation", "math" ]
113a43af2f1c5303f83eb842ef532040
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of each testcase contains the single integer $$$n$$$ ($$$2 \le n \le 10^8$$$) — the number of rows and columns in the grid. The second line of each testcase contains a non-empty string $$$s$$$, consisting...
1,900
For each testcase, print a single integer — the number of cells such that there exists at least one sequence of modifications that the robot visits this cell on the modified path and doesn't move outside the grid.
standard output
PASSED
6df0138ee40ddb9ec6c523fe80d590d9
train_108.jsonl
1645540500
Consider a grid of size $$$n \times n$$$. The rows are numbered top to bottom from $$$1$$$ to $$$n$$$, the columns are numbered left to right from $$$1$$$ to $$$n$$$.The robot is positioned in a cell $$$(1, 1)$$$. It can perform two types of moves: D — move one cell down; R — move one cell right. The robot is not all...
256 megabytes
import java.io.*; import java.util.*; public class Main { static Main2 admin = new Main2(); public static void main(String[] args) { admin.start(); } } class Main2 { //---------------------------------INPUT READER-----------------------------------------// public BufferedRead...
Java
["3\n\n4\n\nRD\n\n5\n\nDRDRDRDR\n\n3\n\nD"]
2 seconds
["13\n9\n3"]
NoteIn the first testcase, it's enough to consider the following modified paths: RD $$$\rightarrow$$$ RRD $$$\rightarrow$$$ RRRD $$$\rightarrow$$$ RRRDD $$$\rightarrow$$$ RRRDDD — this path visits cells $$$(1, 1)$$$, $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(1, 4)$$$, $$$(2, 4)$$$, $$$(3, 4)$$$ and $$$(4, 4)$$$; RD $$$\righta...
Java 8
standard input
[ "brute force", "combinatorics", "data structures", "implementation", "math" ]
113a43af2f1c5303f83eb842ef532040
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of each testcase contains the single integer $$$n$$$ ($$$2 \le n \le 10^8$$$) — the number of rows and columns in the grid. The second line of each testcase contains a non-empty string $$$s$$$, consisting...
1,900
For each testcase, print a single integer — the number of cells such that there exists at least one sequence of modifications that the robot visits this cell on the modified path and doesn't move outside the grid.
standard output
PASSED
6bb87a90d7d39db38a1cc02947c50723
train_108.jsonl
1645540500
Consider a grid of size $$$n \times n$$$. The rows are numbered top to bottom from $$$1$$$ to $$$n$$$, the columns are numbered left to right from $$$1$$$ to $$$n$$$.The robot is positioned in a cell $$$(1, 1)$$$. It can perform two types of moves: D — move one cell down; R — move one cell right. The robot is not all...
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 x1644E { public static void main(String...
Java
["3\n\n4\n\nRD\n\n5\n\nDRDRDRDR\n\n3\n\nD"]
2 seconds
["13\n9\n3"]
NoteIn the first testcase, it's enough to consider the following modified paths: RD $$$\rightarrow$$$ RRD $$$\rightarrow$$$ RRRD $$$\rightarrow$$$ RRRDD $$$\rightarrow$$$ RRRDDD — this path visits cells $$$(1, 1)$$$, $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(1, 4)$$$, $$$(2, 4)$$$, $$$(3, 4)$$$ and $$$(4, 4)$$$; RD $$$\righta...
Java 8
standard input
[ "brute force", "combinatorics", "data structures", "implementation", "math" ]
113a43af2f1c5303f83eb842ef532040
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of each testcase contains the single integer $$$n$$$ ($$$2 \le n \le 10^8$$$) — the number of rows and columns in the grid. The second line of each testcase contains a non-empty string $$$s$$$, consisting...
1,900
For each testcase, print a single integer — the number of cells such that there exists at least one sequence of modifications that the robot visits this cell on the modified path and doesn't move outside the grid.
standard output
PASSED
337d89695eab9bd9ac569d759f205779
train_108.jsonl
1645540500
Consider a grid of size $$$n \times n$$$. The rows are numbered top to bottom from $$$1$$$ to $$$n$$$, the columns are numbered left to right from $$$1$$$ to $$$n$$$.The robot is positioned in a cell $$$(1, 1)$$$. It can perform two types of moves: D — move one cell down; R — move one cell right. The robot is not all...
256 megabytes
import java.util.*; import java.io.*; // BEFORE 31ST MARCH 2022 !! //MAX RATING EVER ACHIEVED-1622(LETS SEE WHEN WILL I GET TO CHANGE THIS) ////*************************************************************************** /* public class E_Gardener_and_Tree implements Runnable{ public static void ma...
Java
["3\n\n4\n\nRD\n\n5\n\nDRDRDRDR\n\n3\n\nD"]
2 seconds
["13\n9\n3"]
NoteIn the first testcase, it's enough to consider the following modified paths: RD $$$\rightarrow$$$ RRD $$$\rightarrow$$$ RRRD $$$\rightarrow$$$ RRRDD $$$\rightarrow$$$ RRRDDD — this path visits cells $$$(1, 1)$$$, $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(1, 4)$$$, $$$(2, 4)$$$, $$$(3, 4)$$$ and $$$(4, 4)$$$; RD $$$\righta...
Java 8
standard input
[ "brute force", "combinatorics", "data structures", "implementation", "math" ]
113a43af2f1c5303f83eb842ef532040
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of each testcase contains the single integer $$$n$$$ ($$$2 \le n \le 10^8$$$) — the number of rows and columns in the grid. The second line of each testcase contains a non-empty string $$$s$$$, consisting...
1,900
For each testcase, print a single integer — the number of cells such that there exists at least one sequence of modifications that the robot visits this cell on the modified path and doesn't move outside the grid.
standard output
PASSED
9e78ba22a46286e2bb58049c7b588144
train_108.jsonl
1645540500
Consider a grid of size $$$n \times n$$$. The rows are numbered top to bottom from $$$1$$$ to $$$n$$$, the columns are numbered left to right from $$$1$$$ to $$$n$$$.The robot is positioned in a cell $$$(1, 1)$$$. It can perform two types of moves: D — move one cell down; R — move one cell right. The robot is not all...
256 megabytes
import java.util.*; import java.io.*; public class E1644 { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt()...
Java
["3\n\n4\n\nRD\n\n5\n\nDRDRDRDR\n\n3\n\nD"]
2 seconds
["13\n9\n3"]
NoteIn the first testcase, it's enough to consider the following modified paths: RD $$$\rightarrow$$$ RRD $$$\rightarrow$$$ RRRD $$$\rightarrow$$$ RRRDD $$$\rightarrow$$$ RRRDDD — this path visits cells $$$(1, 1)$$$, $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(1, 4)$$$, $$$(2, 4)$$$, $$$(3, 4)$$$ and $$$(4, 4)$$$; RD $$$\righta...
Java 8
standard input
[ "brute force", "combinatorics", "data structures", "implementation", "math" ]
113a43af2f1c5303f83eb842ef532040
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of each testcase contains the single integer $$$n$$$ ($$$2 \le n \le 10^8$$$) — the number of rows and columns in the grid. The second line of each testcase contains a non-empty string $$$s$$$, consisting...
1,900
For each testcase, print a single integer — the number of cells such that there exists at least one sequence of modifications that the robot visits this cell on the modified path and doesn't move outside the grid.
standard output
PASSED
9bf9cb31e1a254327841fc49d3a2e25a
train_108.jsonl
1645540500
Consider a grid of size $$$n \times n$$$. The rows are numbered top to bottom from $$$1$$$ to $$$n$$$, the columns are numbered left to right from $$$1$$$ to $$$n$$$.The robot is positioned in a cell $$$(1, 1)$$$. It can perform two types of moves: D — move one cell down; R — move one cell right. The robot is not all...
256 megabytes
import java.util.*; import java.io.*; public class E { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); StringTokenizer st; int t = Integer.parseInt(br.readLine()...
Java
["3\n\n4\n\nRD\n\n5\n\nDRDRDRDR\n\n3\n\nD"]
2 seconds
["13\n9\n3"]
NoteIn the first testcase, it's enough to consider the following modified paths: RD $$$\rightarrow$$$ RRD $$$\rightarrow$$$ RRRD $$$\rightarrow$$$ RRRDD $$$\rightarrow$$$ RRRDDD — this path visits cells $$$(1, 1)$$$, $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(1, 4)$$$, $$$(2, 4)$$$, $$$(3, 4)$$$ and $$$(4, 4)$$$; RD $$$\righta...
Java 8
standard input
[ "brute force", "combinatorics", "data structures", "implementation", "math" ]
113a43af2f1c5303f83eb842ef532040
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of each testcase contains the single integer $$$n$$$ ($$$2 \le n \le 10^8$$$) — the number of rows and columns in the grid. The second line of each testcase contains a non-empty string $$$s$$$, consisting...
1,900
For each testcase, print a single integer — the number of cells such that there exists at least one sequence of modifications that the robot visits this cell on the modified path and doesn't move outside the grid.
standard output