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 | efda553c7f78049201acfe1182b81a0d | train_108.jsonl | 1652020500 | Tokitsukaze has a permutation $$$p$$$ of length $$$n$$$. Recall that a permutation $$$p$$$ of length $$$n$$$ is a sequence $$$p_1, p_2, \ldots, p_n$$$ consisting of $$$n$$$ distinct integers, each of which from $$$1$$$ to $$$n$$$ ($$$1 \leq p_i \leq n$$$).She wants to know how many different indices tuples $$$[a,b,c,d]... | 256 megabytes |
import java.io.*;
import java.util.*;
/**
*
* @author eslam
*/
public class IceCave {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
St... | Java | ["3\n\n6\n\n5 3 6 1 4 2\n\n4\n\n1 2 3 4\n\n10\n\n5 1 6 2 8 3 4 10 9 7"] | 1.5 seconds | ["3\n0\n28"] | NoteIn the first test case, there are $$$3$$$ different $$$[a,b,c,d]$$$ tuples.$$$p_1 = 5$$$, $$$p_2 = 3$$$, $$$p_3 = 6$$$, $$$p_4 = 1$$$, where $$$p_1 < p_3$$$ and $$$p_2 > p_4$$$ satisfies the inequality, so one of $$$[a,b,c,d]$$$ tuples is $$$[1,2,3,4]$$$.Similarly, other two tuples are $$$[1,2,3,6]$$$, $$$[2,... | Java 17 | standard input | [
"brute force",
"data structures"
] | d6a123dab1263b0e7b297ca2584fe701 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Each test case consists of two lines. The first line contains a single integer $$$n$$$ ($$$4 \leq n \leq 5000$$$) — the length of permutation $$$p$$$. The second line contains $$$n$$$ integers $$$p_1, p_2, \ldots, p_n$$$ ... | 1,600 | For each test case, print a single integer — the number of different $$$[a,b,c,d]$$$ tuples. | standard output | |
PASSED | b0ca54cd295cb677c6d0269b3dc8e146 | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class CF789VC {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(
new InputStr... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 11 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | e17be1cb664db9e05c74182efbefc864 | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
import static java.lang.Math.*;
public class Main {
static double pi = 3.141592653589;
static int mod = (int) 1e9 + 7;
public static void main(String[] args) throws IOException {
int qwe = in.nextInt();
while (qwe-- > 0... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 11 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | b86b82a54471a1bf4281646c99ba122e | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 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.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamW... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 11 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | 5cb446da1ddd930bd948fc3759741b94 | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
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 voi... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 11 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | 855afa5efdba966117df011d625f8a5d | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.math.BigInteger;
import static java.lang.Math.*;
import static java.lang.System.*;
import java.util.*;
public class Main {
static pub... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 11 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | 1a3eacd9b45639cce040f9d5d40b21dc | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | import java.io.*;
import java.util.*;
public class D {
static IOHandler in = new IOHandler();
public static void main(String[] args) {
// TODO Auto-generated method stub
int testCases = in.nextInt();
for (int i = 1; i <= testCases; ++i) {
solve(i);
}
}
private static void solve(i... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 11 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | a644fe2ba98537e8ceeafecc0305523c | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | //Utilities
import java.io.*;
import java.util.*;
public class b {
static int t;
static int n, m;
static char[] ch;
static int[] add, sub, cnt;
static int pr, pc;
static int colCnt, rowCnt = 0;
static boolean[] bc;
public static void main(String[] args) throws IOException {
t = in.iscan();
... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 11 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | 3e09bbbcd37c0fe4cfeb526b9910f89b | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 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 CodeForces {
static private final String INPUT = "input.txt";
s... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 11 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | 0b6bed60cf53e7563519df31519c8e67 | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes |
import java.util.*;
import java.io.*;
// you can compare with output.txt and expected out
public class Round789D {
MyPrintWriter out;
MyScanner in;
final static String IMPOSSIBLE = "IMPOSSIBLE";
final static String POSSIBLE = "POSSIBLE";
final static String YES = "YES";
final static String NO = "N... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 11 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | 804fc222f7b761d7d4484cbfc5fca1ce | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.security.cert.X509CRL;
import java.util.*;
import java.lang.*;
import java.util.stream.Collector;
import java.util.stream.Co... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 11 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | 02d81e62d0dd95e5019203f19beb3c42 | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | import java.io.*;
import java.util.*;
public class Meeting {
public static void main(String[] args) throws IOException {
// BufferedReader in = new BufferedReader(new FileReader("Meeting.in"));
// PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("Meeting.out")));
BufferedReader in = new Buffe... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 11 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | e57df20e21711a8fdbe8a6ebccb733b1 | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Scanner;
public class D {
static int[] primes = new int[] {2, 3, 7, 11, 13, 17, 19, 23, 29};
static long p = 2 * 3 * 7 * 11 * 13 * 17 * 19 * 23 * 29;
... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 11 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | fefad67699556fe16db65d6042c727a9 | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | import java.io.*;
import java.util.*;
public class D {
void go() {
int m = Reader.nextInt();
int n = Reader.nextInt();
String s = Reader.next();
boolean[] col = new boolean[n];
Queue<Integer> row = new ArrayDeque<>();
int[] dp = new int[m * n];
int... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 11 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | fe7b32602d8fdbe022e21c2a3d4b52c6 | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | import java.util.*;
import java.io.*;
public class G {
static FastScanner fs = new FastScanner();
static PrintWriter pw = new PrintWriter(System.out);
static StringBuilder sb = new StringBuilder("");
static Scanner scn = new Scanner(System.in);
public static void main(String[] ... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 11 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | 517e1c0ccaf995079a33e35b6e34ed49 | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | // package c1678;
//
// Codeforces Round #789 (Div. 2) 2022-05-08 07:35
// D. Tokitsukaze and Meeting
// https://codeforces.com/contest/1678/problem/D
// time limit per test 1 second; memory limit per test 256 megabytes
// public class Pseudo for 'Source should satisfy regex [^{}]*public\s+(final)?\s*class\s+(\w+).*'
... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 11 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | 43907de381d390f14e8a791beed6e21c | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF1678D extends PrintWriter {
CF1678D() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1678D o = new CF1678D(); o.main(); o.flush();
}
void main() {
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 11 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | cc1d731bf5bb7bbab0ffb65c45d0f7e2 | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Priorit... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 8 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | f24755ed72a04ab92d2ac3e08daf998e | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
/*
* Author: Atuer
*/
public class Main
{
// ==== Solve Code ====//
static int INF = 2000000010;
public static void csh()
{
}
public static void main(String[] args) throws IOException
{
// csh();
int t = in.nextInt();
while (t-- > 0)
{
... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 8 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | b8693af57ad99ddcc692d86dfc2958e7 | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.*;
public class Codeforces {
static long mod= 10000_0000_7;
public static void main(String[] args) throws Exception {
PrintW... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 8 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | faf32580843207bc10d72b036095493b | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.stream.IntStream;
import java.util.Arrays;
import java.io.ByteArrayOutputStream;
import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 8 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | c81d63bdbff38fb9c5ad2c1a719e818c | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
public class tr0 {
static PrintWriter out;
static StringBuilder sb;
static long mod = (long) 1e9 + 7;
static long inf = (long) 1e16;
static int n, m;
static ArrayList<Integer>[] ad, ad1;
static int[][] remove, add;
static long[... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 8 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | 0cba0a52e0234e5fa2625453ceeebb09 | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | import java.util.*;
import java.io.*;
// res.append("Case #"+(p+1)+": "+hh+" \n");
////***************************************************************************
/* public class E_Gardener_and_Tree implements Runnable{
public static void main(String[] args) throws Exception {
new Thr... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 8 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | 9be258b525bf99b9295634d991788579 | train_108.jsonl | 1652020500 | Tokitsukaze is arranging a meeting. There are $$$n$$$ rows and $$$m$$$ columns of seats in the meeting hall.There are exactly $$$n \cdot m$$$ students attending the meeting, including several naughty students and several serious students. The students are numerated from $$$1$$$ to $$$n\cdot m$$$. The students will ente... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
Task solver = new Task();
solver.solve(in.nextInt(), in, out);
... | Java | ["3\n\n2 2\n\n1100\n\n4 2\n\n11001101\n\n2 4\n\n11001101"] | 1 second | ["2 3 4 3\n2 3 4 3 5 4 6 5\n2 3 3 3 4 4 4 5"] | NoteThe first test case is shown in the statement.After the $$$1$$$-st student enters the meeting hall, there are $$$2$$$ good rows and columns: the $$$1$$$-st row and the $$$1$$$-st column.After the $$$2$$$-nd student enters the meeting hall, there are $$$3$$$ good rows and columns: the $$$1$$$-st row, the $$$1$$$-st ... | Java 8 | standard input | [
"dp",
"implementation"
] | ca835eeb8f24de8860d6f5ac6c0af55d | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n,m \leq 10^6$$$; $$$1 \leq n \cdot m \leq 10^6$$$), denoting there are $$$n$$$ rows and $$$m$$$ columns of seats in the mee... | 1,700 | For each test case, print a single line with $$$n \cdot m$$$ integers — the number of good rows and columns just after the $$$i$$$-th student enters the meeting hall. | standard output | |
PASSED | d62c719f6ee4b43530076e068456e446 | train_108.jsonl | 1652020500 | Tokitsukaze has a permutation $$$p$$$. She performed the following operation to $$$p$$$ exactly $$$k$$$ times: in one operation, for each $$$i$$$ from $$$1$$$ to $$$n - 1$$$ in order, if $$$p_i$$$ > $$$p_{i+1}$$$, swap $$$p_i$$$, $$$p_{i+1}$$$. After exactly $$$k$$$ times of operations, Tokitsukaze got a new sequenc... | 256 megabytes | // package c1678;
//
// Codeforces Round #789 (Div. 2) 2022-05-08 07:35
// F. Tokitsukaze and Permutations
// https://codeforces.com/contest/1678/problem/F
// time limit per test 2 seconds; memory limit per test 256 megabytes
// public class Pseudo for 'Source should satisfy regex [^{}]*public\s+(final)?\s*class\s+(\w... | Java | ["3\n\n5 0\n\n0 1 2 3 4\n\n5 2\n\n-1 1 2 0 0\n\n5 2\n\n0 1 1 0 0"] | 2 seconds | ["1\n6\n6"] | NoteIn the first test case, only permutation $$$p=[5,4,3,2,1]$$$ satisfies the constraint condition.In the second test case, there are $$$6$$$ permutations satisfying the constraint condition, which are: $$$[3,4,5,2,1]$$$ $$$\rightarrow$$$ $$$[3,4,2,1,5]$$$ $$$\rightarrow$$$ $$$[3,2,1,4,5]$$$ $$$[3,5,4,2,1]$$$ $$$\ri... | Java 11 | standard input | [
"dp",
"math"
] | f2b2d12ab1c8a511d2ca550faa9768d4 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Each test case consists of two lines. The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 10^6$$$; $$$0 \leq k \leq n-1$$$) — the length of the permutation and the exactly number of operations.... | 2,500 | For each test case, print a single integer — the number of different permutations modulo $$$998\,244\,353$$$. | standard output | |
PASSED | 5a2f65af7732e105062f25323e909fd4 | train_108.jsonl | 1652020500 | Tokitsukaze has a permutation $$$p$$$. She performed the following operation to $$$p$$$ exactly $$$k$$$ times: in one operation, for each $$$i$$$ from $$$1$$$ to $$$n - 1$$$ in order, if $$$p_i$$$ > $$$p_{i+1}$$$, swap $$$p_i$$$, $$$p_{i+1}$$$. After exactly $$$k$$$ times of operations, Tokitsukaze got a new sequenc... | 256 megabytes | // package c1678;
//
// Codeforces Round #789 (Div. 2) 2022-05-08 07:35
// F. Tokitsukaze and Permutations
// https://codeforces.com/contest/1678/problem/F
// time limit per test 2 seconds; memory limit per test 256 megabytes
// public class Pseudo for 'Source should satisfy regex [^{}]*public\s+(final)?\s*class\s+(\w... | Java | ["3\n\n5 0\n\n0 1 2 3 4\n\n5 2\n\n-1 1 2 0 0\n\n5 2\n\n0 1 1 0 0"] | 2 seconds | ["1\n6\n6"] | NoteIn the first test case, only permutation $$$p=[5,4,3,2,1]$$$ satisfies the constraint condition.In the second test case, there are $$$6$$$ permutations satisfying the constraint condition, which are: $$$[3,4,5,2,1]$$$ $$$\rightarrow$$$ $$$[3,4,2,1,5]$$$ $$$\rightarrow$$$ $$$[3,2,1,4,5]$$$ $$$[3,5,4,2,1]$$$ $$$\ri... | Java 11 | standard input | [
"dp",
"math"
] | f2b2d12ab1c8a511d2ca550faa9768d4 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Each test case consists of two lines. The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 10^6$$$; $$$0 \leq k \leq n-1$$$) — the length of the permutation and the exactly number of operations.... | 2,500 | For each test case, print a single integer — the number of different permutations modulo $$$998\,244\,353$$$. | standard output | |
PASSED | 027adbd07fc7883faf2ddb580db0025b | train_108.jsonl | 1652020500 | Tokitsukaze has a permutation $$$p$$$. She performed the following operation to $$$p$$$ exactly $$$k$$$ times: in one operation, for each $$$i$$$ from $$$1$$$ to $$$n - 1$$$ in order, if $$$p_i$$$ > $$$p_{i+1}$$$, swap $$$p_i$$$, $$$p_{i+1}$$$. After exactly $$$k$$$ times of operations, Tokitsukaze got a new sequenc... | 256 megabytes | // package c1678;
//
// Codeforces Round #789 (Div. 2) 2022-05-08 07:35
// F. Tokitsukaze and Permutations
// https://codeforces.com/contest/1678/problem/F
// time limit per test 2 seconds; memory limit per test 256 megabytes
// public class Pseudo for 'Source should satisfy regex [^{}]*public\s+(final)?\s*class\s+(\w... | Java | ["3\n\n5 0\n\n0 1 2 3 4\n\n5 2\n\n-1 1 2 0 0\n\n5 2\n\n0 1 1 0 0"] | 2 seconds | ["1\n6\n6"] | NoteIn the first test case, only permutation $$$p=[5,4,3,2,1]$$$ satisfies the constraint condition.In the second test case, there are $$$6$$$ permutations satisfying the constraint condition, which are: $$$[3,4,5,2,1]$$$ $$$\rightarrow$$$ $$$[3,4,2,1,5]$$$ $$$\rightarrow$$$ $$$[3,2,1,4,5]$$$ $$$[3,5,4,2,1]$$$ $$$\ri... | Java 11 | standard input | [
"dp",
"math"
] | f2b2d12ab1c8a511d2ca550faa9768d4 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Each test case consists of two lines. The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 10^6$$$; $$$0 \leq k \leq n-1$$$) — the length of the permutation and the exactly number of operations.... | 2,500 | For each test case, print a single integer — the number of different permutations modulo $$$998\,244\,353$$$. | standard output | |
PASSED | 3074b98572e7c517c47456c61de600e1 | train_108.jsonl | 1652020500 | Tokitsukaze has a permutation $$$p$$$. She performed the following operation to $$$p$$$ exactly $$$k$$$ times: in one operation, for each $$$i$$$ from $$$1$$$ to $$$n - 1$$$ in order, if $$$p_i$$$ > $$$p_{i+1}$$$, swap $$$p_i$$$, $$$p_{i+1}$$$. After exactly $$$k$$$ times of operations, Tokitsukaze got a new sequenc... | 256 megabytes |
import java.util.*;
import java.util.function.BiFunction;
import java.io.*;
// you can compare with output.txt and expected out
public class Round789F {
MyPrintWriter out;
MyScanner in;
// final static long FIXED_RANDOM;
// static {
// FIXED_RANDOM = System.currentTimeMillis();
// }
final static ... | Java | ["3\n\n5 0\n\n0 1 2 3 4\n\n5 2\n\n-1 1 2 0 0\n\n5 2\n\n0 1 1 0 0"] | 2 seconds | ["1\n6\n6"] | NoteIn the first test case, only permutation $$$p=[5,4,3,2,1]$$$ satisfies the constraint condition.In the second test case, there are $$$6$$$ permutations satisfying the constraint condition, which are: $$$[3,4,5,2,1]$$$ $$$\rightarrow$$$ $$$[3,4,2,1,5]$$$ $$$\rightarrow$$$ $$$[3,2,1,4,5]$$$ $$$[3,5,4,2,1]$$$ $$$\ri... | Java 11 | standard input | [
"dp",
"math"
] | f2b2d12ab1c8a511d2ca550faa9768d4 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Each test case consists of two lines. The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 10^6$$$; $$$0 \leq k \leq n-1$$$) — the length of the permutation and the exactly number of operations.... | 2,500 | For each test case, print a single integer — the number of different permutations modulo $$$998\,244\,353$$$. | standard output | |
PASSED | 1cccc94ee2d132b0fd05e832e175d5ff | train_108.jsonl | 1652020500 | Tokitsukaze has a permutation $$$p$$$. She performed the following operation to $$$p$$$ exactly $$$k$$$ times: in one operation, for each $$$i$$$ from $$$1$$$ to $$$n - 1$$$ in order, if $$$p_i$$$ > $$$p_{i+1}$$$, swap $$$p_i$$$, $$$p_{i+1}$$$. After exactly $$$k$$$ times of operations, Tokitsukaze got a new sequenc... | 256 megabytes | import java.util.*;
import java.io.*;
public class G {
static FastScanner fs = new FastScanner();
static PrintWriter pw = new PrintWriter(System.out);
static StringBuilder sb = new StringBuilder("");
static Scanner scn = new Scanner(System.in);
static int md = 998244353;
p... | Java | ["3\n\n5 0\n\n0 1 2 3 4\n\n5 2\n\n-1 1 2 0 0\n\n5 2\n\n0 1 1 0 0"] | 2 seconds | ["1\n6\n6"] | NoteIn the first test case, only permutation $$$p=[5,4,3,2,1]$$$ satisfies the constraint condition.In the second test case, there are $$$6$$$ permutations satisfying the constraint condition, which are: $$$[3,4,5,2,1]$$$ $$$\rightarrow$$$ $$$[3,4,2,1,5]$$$ $$$\rightarrow$$$ $$$[3,2,1,4,5]$$$ $$$[3,5,4,2,1]$$$ $$$\ri... | Java 11 | standard input | [
"dp",
"math"
] | f2b2d12ab1c8a511d2ca550faa9768d4 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Each test case consists of two lines. The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 10^6$$$; $$$0 \leq k \leq n-1$$$) — the length of the permutation and the exactly number of operations.... | 2,500 | For each test case, print a single integer — the number of different permutations modulo $$$998\,244\,353$$$. | standard output | |
PASSED | a93e93de5d8538ec7e0017c034a90ac9 | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
static long INF = 2000000000000000010l;
static int fx[][] = {{-1,0},{0,1},{1,0},{0,-1},{-1,-1},{1,1},{1,-1},{-1,1}};
public static void main(String[] args) throws IOException {
int t=1;
t = cin.nextInt();
while (t-- > 0)... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | 775ff0efa04198aafea318472e7394d4 | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
/*
* Author: Atuer
*/
public class Main
{
// ==== Solve Code ====//
static int INF = 2000000010;
public static void csh()
{
}
public static void main(String[] args) throws IOException
{
// csh();
int t = in.nextInt();
while (t-- > 0)
{
... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | 29f60aaed3d3642857a82ceb55a9bc7e | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes |
import java.util.Scanner;
import java.util.stream.IntStream;
public class Main {
public static long dfs(int[] b, int[] index, boolean[] visited, int i){
if(visited[i]){
return 0;
}
visited[i] = true;
return 1 + dfs(b, index, visited, index[b[i]]);
... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | c8190ea3271e908b13c55b9083a09c6e | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.stream.IntStream;
import java.io.ByteArrayOutputStream;
import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.InputMismatchEx... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | 72b2788c3c3e1992aa699b0fe0dffdb3 | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Priorit... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | 22e07f747078243d1efb8dc904ba15ea | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution
{
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reader()
{
din ... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | b8eee2e533dd9b319e9c05f3fb6abfef | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 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 | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | f66a0a70c8f4e2ab3b248d64708d735f | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes | import java.util.*;
import java.io.*;
// res.append("Case #"+(p+1)+": "+hh+" \n");
////***************************************************************************
/* public class E_Gardener_and_Tree implements Runnable{
public static void main(String[] args) throws Exception {
new Thr... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | 4f596a0b9105db51339a34c1d85e267a | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.lang.*;
public class Main {
public static int inf = (int)1e9+7;
public static int mod = (int)1e9+7;
public static void main(String[] args) throws IOException, InterruptedException {
BufferedWriter writer = new BufferedWriter(new ... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | f215d19251836c898ed079f18636c1d7 | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
Task solver = new Task();
solver.solve(in.nextInt(), in, out);
out.close();... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 8 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | cdcc14dbc231440c710dac7c66e29460 | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes |
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
public final class E {
private static final class UnionFind {
private final int[] parent;
... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 11 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | 3477093c438f9fff010a3df967e9ddd4 | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes |
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
public final class E {
private static final class UnionFind {
private final int[] parent;
... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 11 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | d26a84620b693e467fdf334d3b2f8848 | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes |
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
public final cla... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 11 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | 72587002a0054aa79edab029be561fb0 | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes |
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
public fin... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 11 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | 80b58eab3938e38f861b67e9dc5bd3fe | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes | import java.util.*;
import java.io.*;
// you can compare with output.txt and expected out
public class Round789E {
MyPrintWriter out;
MyScanner in;
final static String IMPOSSIBLE = "IMPOSSIBLE";
final static String POSSIBLE = "POSSIBLE";
final static String YES = "YES";
final static String NO = "NO"... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 11 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | 171ae406ba44e3e3e5ddce7bc1073bb7 | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes | import java.io.*;
import java.util.*;
public class E {
void go() {
int n = Reader.nextInt();
int[] A = new int[n];
int[] B = new int[n];
int[] p1 = new int[n + 1];
int[] p2 = new int[n + 1];
long ans = 0;
long r = n;
long l = 1;
... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 11 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | e9bf9ebca378061c565ce6b2a924cfca | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes | import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class CF789VC {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(
new InputStr... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 11 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | 4dfec11bbac72e791d292245395159ff | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.math.BigInteger;
import static java.lang.Math.*;
import static java.lang.System.*;
import java.util.*;
public class Main {
static pub... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 11 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | 929b909be1875718aa756e1fc354ee55 | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes | import java.util.*;
import java.io.*;
public class G {
static FastScanner fs = new FastScanner();
static PrintWriter pw = new PrintWriter(System.out);
static StringBuilder sb = new StringBuilder("");
static Scanner scn = new Scanner(System.in);
public static void main(String[] ... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 11 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | d2a5542f014da4c4553a081f562e164b | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes | // package c1678;
//
// Codeforces Round #789 (Div. 2) 2022-05-08 07:35
// E. Tokitsukaze and Two Colorful Tapes
// https://codeforces.com/contest/1678/problem/E
// time limit per test 2 seconds; memory limit per test 256 megabytes
// public class Pseudo for 'Source should satisfy regex [^{}]*public\s+(final)?\s*class... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 11 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | a3ad39267929b45c535c4ca54c5e7120 | train_108.jsonl | 1652020500 | Tokitsukaze has two colorful tapes. There are $$$n$$$ distinct colors, numbered $$$1$$$ through $$$n$$$, and each color appears exactly once on each of the two tapes. Denote the color of the $$$i$$$-th position of the first tape as $$$ca_i$$$, and the color of the $$$i$$$-th position of the second tape as $$$cb_i$$$.No... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF1678E extends PrintWriter {
CF1678E() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1678E o = new CF1678E(); o.main(); o.flush();
}
void main() {
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.... | Java | ["3\n\n6\n\n1 5 4 3 2 6\n\n5 3 1 4 6 2\n\n6\n\n3 5 4 6 2 1\n\n3 6 4 5 2 1\n\n1\n\n1\n\n1"] | 2 seconds | ["18\n10\n0"] | NoteAn optimal solution for the first test case is shown in the following figure: The beauty is $$$\left|4-3 \right|+\left|3-5 \right|+\left|2-4 \right|+\left|5-2 \right|+\left|1-6 \right|+\left|6-1 \right|=18$$$.An optimal solution for the second test case is shown in the following figure: The beauty is $$$\left|2-2... | Java 11 | standard input | [
"constructive algorithms",
"dfs and similar",
"dsu",
"greedy",
"math"
] | 4bcaa910cce687f0881a36231aa1a2c8 | The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n \leq 10^5$$$) — the number of colors. The second line contains $$$n$$$ integers $$$ca_1, ca_2, \ldots, ca_n$$$ ($$$1 \leq ca_i \leq... | 1,900 | For each test case, print a single integer — the highest possible beauty. | standard output | |
PASSED | 17fe3c3a0c35d978f5e6756125dda400 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | /*
stream Butter!
eggyHide eggyVengeance
I need U
xiao rerun when
*/
import static java.lang.Math.*;
import java.util.*;
import java.io.*;
import java.math.*;
public class x1607E
{
public static final int INF = Integer.MAX_VALUE/2;
public static void main(String hi[]) throws Exception
{
... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | a15f154e4ad8b8712e7056e0ac5a9d0d | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
int t = nextInt();
while (t-- != 0) {
long n = nextLong();
long m = nextLong();
String s = nextToken();
long maxx = 0;
... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 4511c73048eb2ee72602e9316779b350 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
public class robotonboard{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0){
int n = sc.nextInt();
int m = sc.nextInt();
sc.nextLine();
String s = sc... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | e8d8fdb87c5694375c2ec8d040a1e296 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | /*
* In_The_Name_Of_Allah_The_Merciful */
import java.util.*;
import java.io.*;
public class Solution
{
class Pair implements Comparable<Pair>{
int f,s;
Pair(int x,int y){
f=x;
s=y;
}
@Override
public int compareTo(Pair a) {
if(a.f!=... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 2007655a003d357cac33187a72a3710e | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.Scanner;
public class RobotOnBoard {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int tests = sc.nextInt();
sc.nextLine();
for(int i = 0;i<tests;i++) {
String[] rowsAndCols = sc.nextLine().split(" ");
int row... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 2cd490aca80c1f470c479dc2a78050d1 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
import java.io.*;
public class E1607{
static FastScanner fs = null;
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();
int m = fs.nextInt();
String s... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 5373df1a025217d26523420fb4f72dbc | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
for (int t = in.nextInt(); t > 0; t--) {
int rows = in.nextInt();
int cols = in.nextInt();
char[] commands = in.next().toCharArray(... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | abee49d83abf03bd9513671e70ea3931 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
for (int t = in.nextInt(); t > 0; t--) {
int rows = in.nextInt();
int cols = in.nextInt();
char[] commands = in.next().toCharArray(... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 31c0d55a325582b6916f322f5c32d7fc | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.LinkedList;
import java.util.*;
import java.util.StringTokenizer;
public class C {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | d81a08a25a6339df949117a196427f33 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
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 | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | f67ecc92743d2d0db196a5f8f143e94e | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.Scanner;
public class CodeForces_1607E {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int numTestcases = sc.nextInt();
while(numTestcases-->0){
int n = sc.nextInt();
int m = sc.nextInt();
char[] d... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 1c2d03ce13acd825f7eac5dad14dc3d8 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
/*
Goal: Become better in CP!
Key: Consistency!
*/
public class Coder {
static StringBuffer str=new StringBuffer();
static int n,m;
static char c[];
static void solve(){
int dx, dy, mndx, mxdx, mndy, mxdy;
dx=dy=mndx=mxdx=m... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 377c5da26320e50af53a7d24cbe159fc | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
/*
Goal: Become better in CP!
Key: Consistency!
*/
public class Coder {
static StringBuffer str=new StringBuffer();
static int n,m;
static char c[];
static void solve(){
int dx, dy, mndx, mxdx, mndy, mxdy;
dx=dy=mndx=mxdx=m... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 8fc6deeba2f3e532ba3a443a29ecb3e0 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
import java.io.*;
public class codeforces1607E {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int numCases = Integer.parseInt(br.readLine());
StringBuilder ans = new StringBuild... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 9ea04bdac2132f19df5fef7f3e4b2d1f | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.CompletableFuture.Asynchronou... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | a31cddb1d30101c60b5206174f4c7ec6 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Main {
static Scanner scanner=new Scanner (System.in);
public static void main(String[] args) throws IOException {
int t=scanner.nextInt();
l:while(t-->0) {
int x=scanner.nextInt();
int y=scanner.nextInt();
int xx=0,yy=0;
char a[]=sc... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 1ccb6e6be180f48dc1b5a369648b993c | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | //package codeforces.round753div3;
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
//Think through the entire logic before jump into coding!
//If you are out of ideas, take a guess! It is better than doing nothing!
//Read both C and D, it is possible that D is easier than C for you!
//Be aware... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | cc9038d751d082f5449786403f7665d9 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main{
static Scanner sc = new Scanner(new BufferedInputStream(System.in));
static int sc(){return sc.nextInt();}
static double scd(){return sc.nextDouble();}
static char[] carr(){return sc.next().toCharArray();}
static long scl(){return sc.ne... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | eedb311bded22b187de3318c27a4a5cd | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | /********
* @author Brennan Cox
*
********/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.StringTokenizer;
public class Main {
public Main() {
FastScanner input = new FastScanner(Sys... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 52440997a036a0736e0c07fd9435f3c6 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
public class RobotOnBoard {
public static void main(String[] args) throws IOException {
FastReader fr = new FastReader();
PrintWriter pr = new PrintWriter(new OutputStreamWriter(System.out));
int t = fr.nextInt();
while (t-- > 0) {
... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 49c51555fc8c5e5b3a2b77b95c4ac05c | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class E {
public static void main(String args[]) {
Scanner fs = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int T = fs.ne... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 024f86388bb13e3a329ba428656d55f2 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class E {
public static void main(String args[]) {
Scanner fs = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int T = f... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | f6ddfc16bdda6c9f990cda751f576717 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class E {
public static void main(String args[]) {
Scanner fs = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int T = f... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | cacdb820285e13aed9fd94c8c84a5b96 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes |
import java.awt.Container;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
public class Main
{
public static void mai... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | bfc2c3ba2dd6530d45884d2f97734977 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes |
import java.awt.Container;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
public class Main
{
public static void mai... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | ba5307d42947bf02681d7b7e112b49ea | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes |
import java.awt.Container;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
public class Main
{
public static void mai... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 34a53ac29a6c14a89919058899a2d60c | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
public class Main{
public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
static long MOD = (long) (1e9 + 7);
// static long MOD = 998244353;
static long MOD2 = MOD * MOD;
static FastReader sc = n... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 4c8b42bee2500d1ebbf2d88071dfe689 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Codechef {
public static void main(String[] args) throws java.lang.Exception {
FastReader in = new FastReader(System.in);
StringBuilder sb = new StringBuilder();
int t = 1;
t = in.nextInt();
while (t > 0) {
--t;
int n =... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | c3068c51c2a17636cd068b4183b12bdf | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
public class E {
public static void main(String[] args)throws IOException {
FastScanner scan = new FastScanner();
PrintWriter output = new PrintWriter(System.out);
int t = scan.nextInt();
for(int tt = 0;tt<t;tt++) {
int n = scan.nextInt(), m = scan.nextI... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 80501fe506b98eb17d09b8f332274430 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution {
static int M = 998244353;
static Random rng = new Random();
private static int[] testCase(int n, int m, String s) {
int startX = 0, startY = 0;
int currX = startX, currY = startY, minX = startX, minY = startY, maxX = st... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | eac864fb515ed4164e9d9eea5d043104 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.math.BigInteger;
public final class A
{
static PrintWriter out = new PrintWriter(System.out);
static StringBuilder ans=new StringBuilder();
static FastReader in=new FastReader();
static ArrayList<Integer> g[];
static long ... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | b3da5c6dc4f5eab25d61c604cd867398 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws Exception {
int tc = io.nextInt();
for (int i = 0; i < tc; i++) {
solve();
}
io.close();
}
private static void solve() throws Exception {
... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 05e992bd5008f17e67b2a1ddca5f288c | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
public class Main {
public static void main(Stri... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | e12dd8fc7ff6f3de3f57ad9552852fad | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Collections;
public class E {
static FastScanner sc = new FastScanner();
public static void main(String[] args) {
int t = sc.nextInt();
while(t-->0) {
solve();
}
... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 675515933197bd17bf965760eee1c1e7 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class RobotOnTheBoard1 {
public static void main(String[] args){
int t;
Scanner scanner = new Scanner(System.in);
t = scanner.nextInt();
while(t>0){
t--;
int n,m;... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 334b63749fc6e3de01260c5a792a85df | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
public class Main{
public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
static long MOD = (long) (1e9 + 7);
// static long MOD = 998244353;
static long MOD2 = MOD * MOD;
static FastReader sc = new FastRea... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 47cf2cd9b3beb3cb0496b1bc96f79539 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
public class Templ {
static StreamTokenizer in;
static int nextInt() throws IOException {
in.nextToken();
return (int) in.nval;
}
public static void main(String[] args) throws IOException {
in = new StreamTokenizer(new Buffered... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 441b4939c4e19761aff78a1abd86c8e4 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | cd1d7fe8877427d507fd39789a23b0bd | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
public class E {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next() {
... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 19552933dbcf6b5b9a1b8d2135278501 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
public class E {
public static void main(String... args) {
try {
Scanner sc = new Scanner(System.in);
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
int t = sc.nextInt();
for (; t > 0... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 7864b4ad4cc6ba5855f8b24019256695 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
public class aaa {
//--------------------------INPUT READER--------------------------------//
static class fs {
public BufferedReader br;
StringTokenizer st = new StringTokenizer("");
public fs() { this(System.in); }
public fs(Inp... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 230d214a396ede6756f6819e139cfb45 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution {
public static void solve(InputReader in, PrintWriter out) {
int t = in.nextInt();
while (t-- > 0) {
int n = in.nextInt();
int m = in.nextInt();
String st = in.next();
int x = 1, y = 1, ... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 28fbcbecba921624282317971f89b18b | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes |
import java.io.*;
import java.util.*;
public class E {
public static void main(String[] args) {
FastIO io = new FastIO();
int t = io.nextInt();
while (t --> 0) {
int r = io.nextInt(), c = io.nextInt();
String s = io.next();
int hor = 0, ver = 0;
int h... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | b50c2d8ee54c09aa3261c8e8d5283359 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static long startTime = System.currentTimeMillis();
// for global initializations and methods starts here
// global initialisations and methods end here
static void run() {
boolean tc = true;
//AdityaFastIO r = n... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 505553b68c77ccbef389ad6cddba7e5d | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static PrintWriter pw;
static Scanner sc;
static long ceildiv(long x, long y) { return (x+y-1) / y; }
static int mod(long x, int m) { return (int) ((x%m + m) % m); }
static void put(Map<Integer, Integer> map, Integer p){if(map.contai... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | ae2ed0830398dc1b4b15372cd4817e3e | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class E_Robot_on_the_Board_1
{
static int M = 1_000_000_007;
static final PrintWriter out =new PrintWriter(System.out);
static final FastReader fs = new FastReader();
static boolean prime[];
public static void main ... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 14794b97f32039002cedc938e5232dbb | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | //created by Whiplash99
import java.io.*;
import java.util.*;
public class E
{
private static int calcCost(int start, int lim, ArrayDeque<Integer> DQ)
{
int cost=0;
for(int x:DQ)
{
start+=x;
if(start<1||start>lim) cost++;
start=Math.max(1... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | a3aaba14cf76f78926f0331898ff0fe7 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.Scanner;
public class E1607 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
StringBuilder out = new StringBuilder();
int T = in.nextInt();
for (int t=0; t<T; t++) {
int R = in.nextInt();
int C = in.n... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | 91b1fb3bbcbe73a01e0ca7491a367957 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
public class RobotOnTheBoard1 {
private static final int START_TEST_CASE = 1;
private static final int[] DR = {-1, 0, 1, 0};
private static final int[] DC = {0, 1, 0, -1};
private static final int[] DIR = new int[256];
static {
DIR['U'] = 0;
DIR['R'] = 1;
... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output | |
PASSED | d0ec3f23c7a33a73f1141418b367f8a6 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static BufferedReader bf;
static PrintWriter out;
static Scanner sc;
static StringTokenizer st;
static long mod = (long)(1e9+7);
static long mod2 = 998244353;
static long fact[] = new long[1000001];
static long inverse[] = new long[1000001];... | Java | ["4\n1 1\nL\n1 2\nL\n3 3\nRRDLUU\n4 3\nLUURRDDLLLUU"] | 2 seconds | ["1 1\n1 2\n2 1\n3 2"] | null | Java 8 | standard input | [
"implementation"
] | 585bb4a040144da39ed240366193e705 | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. In the description of each test case, the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the height and width of the fie... | 1,600 | Print $$$t$$$ lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers $$$r$$$ ($$$1 \leq r \leq n$$$) and $$$c$$$ ($$$1 \leq c \leq m$$$), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start mov... | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.