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
66da2b1c3e5ec0a276c6923c8ed2cbd9
train_108.jsonl
1654266900
Is it really?! The robot only existing in my imagination?! The Colossal Walking Robot?!!— Kochiya Sanae Sanae made a giant robot — Hisoutensoku, but something is wrong with it. To make matters worse, Sanae can not figure out how to stop it, and she is forced to fix it on-the-fly.The state of a robot can be represented ...
256 megabytes
import java.io.*; import java.util.*; public class gaint_robot { public static void main(String[] args)throws IOException { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter out = new BufferedWriter(new OutputStreamWriter...
Java
["2\n\n5 2\n\n1 5 4 2 3\n\n3 2 5 4 1\n\n1 3\n\n2 5\n\n5 2\n\n1 5 4 2 3\n\n3 2 4 5 1\n\n1 2\n\n2 4"]
1 second
["YES\nNO"]
NoteTest case 1:One possible way of turning $$$a$$$ to $$$b$$$:First, select $$$[1,3]$$$. After the operation, $$$a=[3,2,5,2,3]$$$.Then, select $$$[2,5]$$$. After the operation, $$$a=[3,2,5,4,1]=b$$$.Test case 2:It can be shown that it is impossible to turn $$$a$$$ into $$$b$$$.
Java 8
standard input
[ "binary search", "brute force", "data structures", "dsu", "greedy", "sortings" ]
2627417136abced8481ea5728d5c1f06
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 2\cdot 10^4$$$) — the number of test cases. The descriptions of the test cases follow. The first line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n\leq 2\cdot 10^5$$$, $$$1 \leq m\leq 2\cdo...
2,500
For each test case, print "YES" (without quotes) if $$$a$$$ can be turned into $$$b$$$, or "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
ab910240b3d4bdc6f75aee36c9de91d6
train_108.jsonl
1654266900
Is it really?! The robot only existing in my imagination?! The Colossal Walking Robot?!!— Kochiya Sanae Sanae made a giant robot — Hisoutensoku, but something is wrong with it. To make matters worse, Sanae can not figure out how to stop it, and she is forced to fix it on-the-fly.The state of a robot can be represented ...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java...
Java
["2\n\n5 2\n\n1 5 4 2 3\n\n3 2 5 4 1\n\n1 3\n\n2 5\n\n5 2\n\n1 5 4 2 3\n\n3 2 4 5 1\n\n1 2\n\n2 4"]
1 second
["YES\nNO"]
NoteTest case 1:One possible way of turning $$$a$$$ to $$$b$$$:First, select $$$[1,3]$$$. After the operation, $$$a=[3,2,5,2,3]$$$.Then, select $$$[2,5]$$$. After the operation, $$$a=[3,2,5,4,1]=b$$$.Test case 2:It can be shown that it is impossible to turn $$$a$$$ into $$$b$$$.
Java 8
standard input
[ "binary search", "brute force", "data structures", "dsu", "greedy", "sortings" ]
2627417136abced8481ea5728d5c1f06
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 2\cdot 10^4$$$) — the number of test cases. The descriptions of the test cases follow. The first line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n\leq 2\cdot 10^5$$$, $$$1 \leq m\leq 2\cdo...
2,500
For each test case, print "YES" (without quotes) if $$$a$$$ can be turned into $$$b$$$, or "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
c89e18345575edb51559f883d3502340
train_108.jsonl
1654266900
Is it really?! The robot only existing in my imagination?! The Colossal Walking Robot?!!— Kochiya Sanae Sanae made a giant robot — Hisoutensoku, but something is wrong with it. To make matters worse, Sanae can not figure out how to stop it, and she is forced to fix it on-the-fly.The state of a robot can be represented ...
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.util.Collection; import java.io.FileOutputStream; import java.util.HashMap; impo...
Java
["2\n\n5 2\n\n1 5 4 2 3\n\n3 2 5 4 1\n\n1 3\n\n2 5\n\n5 2\n\n1 5 4 2 3\n\n3 2 4 5 1\n\n1 2\n\n2 4"]
1 second
["YES\nNO"]
NoteTest case 1:One possible way of turning $$$a$$$ to $$$b$$$:First, select $$$[1,3]$$$. After the operation, $$$a=[3,2,5,2,3]$$$.Then, select $$$[2,5]$$$. After the operation, $$$a=[3,2,5,4,1]=b$$$.Test case 2:It can be shown that it is impossible to turn $$$a$$$ into $$$b$$$.
Java 8
standard input
[ "binary search", "brute force", "data structures", "dsu", "greedy", "sortings" ]
2627417136abced8481ea5728d5c1f06
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 2\cdot 10^4$$$) — the number of test cases. The descriptions of the test cases follow. The first line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n\leq 2\cdot 10^5$$$, $$$1 \leq m\leq 2\cdo...
2,500
For each test case, print "YES" (without quotes) if $$$a$$$ can be turned into $$$b$$$, or "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
37ab1515d617144015e76753accdfbae
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
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
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 8
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
a88543384d4d150fa57ba2271dcc5778
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) { new Main().run(); } FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); long[] rec=new long[200002]; long[] inv=new long[200002]; void run() {...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 8
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
1d94162efb4eb7a4f023183b31b32b7f
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.io.*; import java.util.*; public final class Solution { static PrintWriter out = new PrintWriter(System.out); static FastReader in = new FastReader(); static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(1, 0), new Pair(0, -1), new Pair(0, 1)}; public static void main(Strin...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 8
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
9d047538084a50f8cae7b9610d9eb48f
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.io.*; import java.util.*; public final class Solution { static PrintWriter out = new PrintWriter(System.out); static FastReader in = new FastReader(); static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(1, 0), new Pair(0, -1), new Pair(0, 1)}; public static void main(Strin...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 8
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
9e33953de6cb66d4a1424d2b7be12092
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.math.BigInteger; import java.util.Locale; import java.util.StringTokenizer; ...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 8
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
21fa878b8f9e058982b6e6cba292b527
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.util.*; public class AquaMoonAndChess_732B { public static void main(String[] args) { // TODO Auto-generated method stub long[] p = new long[100001]; int mod = 998244353; p[1] = 1; p[0] = 1; for(int i = 2; i < 100001; i ++) p[i] = p[i - 1] * i % mod; Scanner sc = new Scanner(System...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 8
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
509cc1abdff7153763ce611db679b6c5
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.io.*; import java.util.*; public class B { static final int MOD = 998244353; public static void main(String[] args) { scan = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int t = scan.nextInt(); while (t-->0){ ...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 8
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
4a81ce4fce2bf77a193e57d0ac7df849
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
/* stream Butter! eggyHide eggyVengeance I need U xiao rerun when */ import static java.lang.Math.*; import static java.lang.System.out; import java.util.*; import java.io.*; import java.math.*; public class x1545B { static final long MOD = 998244353L; public static void main(String hi[]) throw...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 8
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
f5500671381c96bac407db69cc4629ae
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
//make sure to make new file! import java.io.*; import java.util.*; public class B732{ public static int N = 100005; public static long MOD = 998244353L; public static long[] fac; public static long[] ifac; public static void main(String[] args)throws IOException{ BufferedRea...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 8
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
77365188e94554f8d627eb56cb3a6a5e
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; import java.lang.reflect.Field; import java.nio.charset.StandardCharsets; import java.io.UncheckedIOException; import java.io.Closeable; import java.math.BigInteger; import java....
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 8
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
89e2ba1f91fcdaaf879aa068eee5d521
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.io.*; import java.util.*; import java.util.StringTokenizer; public class AquaMoonAndChess { static long mod = 998244353; static long x, y; static void gcdExtended(long a, long b){ if(a%b==0){ x = 1; y = 1 - (a/b); return; } ...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 11
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
d7453e727bbb59f666ae89e24760fdde
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.util.*; import java.util.Map.Entry; import java.lang.*; import java.io.*; import java.math.BigInteger; public class CF { private static FS sc = new FS(); private static class FS { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringT...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 11
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
33f519b7b948439a889c3094be116b70
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class B { public static void main(String[] args) { init(100000); Scanner s = new Scanner(System.in); int lines = s.nextInt(); s.nextLine(); for (int i = 0; i < lines; i += 1) { solve(s....
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 11
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
b27752bd265372e8f0df976a4756fb84
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.io.*; import java.util.*; public class Main { static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); private static int nextInt() { ...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 11
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
9f05a137d798e9cec07bc3187d93c143
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
public class Main { public static void main(String[] args) { new Main(); } public Main() { FastScanner fs = new FastScanner(); java.io.PrintWriter out = new java.io.PrintWriter(System.out); solve(fs, out); out.flush(); } public void solve(FastScanner fs, java.io.PrintWriter out) { int ...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 11
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
787b28ea8863e96049974e91ba20a928
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
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
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 11
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
648525c350f8974177457373599b7dc3
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.util.*; import java.io.*; public class _1545_B { static final long MOD = 998244353; public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); in...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 11
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
60e88b04f7d0285c5167a42a8afb4e8e
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf1545b { public static void main(String[] args) throws IOException { int t = ri(), fact[] = new int[100005], ifact[] = new int[100005]; fact[0] = fact[1] = ifact[0] = if...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 11
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
854287fb1f61a767bc67bcdae7c0f905
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.util.*; import java.io.*; public class Sol{ // ************ n==1 ***************** important test case static ArrayList<Integer> g[]; static HashSet<Integer> s[]; public static void main(String []args){ int times=ni(); while(times-->0){ int n=ni(); String s=ns(); s+='0';n+...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 11
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
92871c846885c8c8890ff3a897366baf
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.Math.max; public class EdA { static long[] mods = {1000000007, 998244353, 1000000009}; static long mod = mods[1]; public static MyScanner sc; public static PrintWriter out; ...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 11
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
ed2b61e66a59b4b6103e60b7d806ece9
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.util.*; import java.io.*; import java.text.*; public class CF_1545_B{ //SOLUTION BEGIN long MOD = 998244353; void pre() throws Exception{} void solve(int TC) throws Exception{ int N = ni(); List<Integer> l = new ArrayList<>(); String S = n(); int ...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 11
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
9ed389463bf5e45197a7f1a9609df1db
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.util.*; import java.io.*; public class B { static long mod = 998244353; public static void main(String[] args) { FastScanner sc = new FastScanner(); int T = sc.nextInt(); while(T-->0) { int n = sc.nextInt(); char[] s = sc.next().toCharArray(); int ps = 0, lones = 0; for(int i = 0; i < n...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 11
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
4efb5b3da79b9dc7b5a8b0be8f67eeba
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class B { public static final long MOD = 998244353; void solve() throws IOException { int t = nextInt(); for (int testCase = 0; testCase < t ; testCase++) { int n = nextInt(); ...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 11
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
c0fc027b3fbb6a377cd62ff0e517a438
train_108.jsonl
1626012300
Cirno gave AquaMoon a chessboard of size $$$1 \times n$$$. Its cells are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.In each operation, AquaMoon can choose a cell $$$i$$$ with a pawn, and do eit...
256 megabytes
//package round732; import java.io.*; import java.util.*; public class B { InputStream is; FastWriter out; String INPUT = ""; static final int mod = 998244353; int[][] fif = enumFIF(200000, mod); public static int[][] enumFIF(int n, int mod) { int[] f = new int[n + 1]; int[] invf = new int[n ...
Java
["6\n4\n0110\n6\n011011\n5\n01010\n20\n10001111110110111000\n20\n00110110100110111101\n20\n11101111011000100010"]
1 second
["3\n6\n1\n1287\n1287\n715"]
NoteIn the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations.
Java 11
standard input
[ "combinatorics", "math" ]
930b296d11d6d5663a14144a491f2c0a
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the size of the chessboard. The second line contains a string of $$$n$$$ characters, consist...
1,900
For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo $$$998\,244\,353$$$.
standard output
PASSED
1f974d8dc435f31e369d4f53b9bd0773
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.lang.*; import java.math.BigInteger; import java.io.*; public class Main implements Runnable { public static void main(String[] args) { new Thread(null, new Main(), "whatever", 1 << 26).start(); } private FastScanner sc; private PrintWriter pw; ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
e186029a178df0c14ba3636e3542ef95
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.util.*; public class temp { public static void main(String[] args) throws IOException { new temp().run(); } void run() throws IOException { BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); int t= Integer.parseInt(br.readLine()); int mx= (in...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
41ea106263ec8a83031b831e7efc7d4c
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.lang.*; import java.util.*; public class ComdeFormces { public static HashMap<Integer,ArrayList<Integer>> hm; public static boolean dp[][]; public static void main(String[] args) throws Exception{ // TODO Auto-generated method stub FastReader sc=new FastReader(); ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
723fc04b46691a617e216bd64788d83e
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
// have faith in yourself!!!!! import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class CodeForces { /*-------------------------------------------EDITING COD...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
e63d9cef216a41fc012799487001915f
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.util.*; /* */ public class B { static FastReader sc=null; public static void main(String[] args) { sc=new FastReader(); int t=sc.nextInt(); outer:while(t-->0) { int n=sc.nextInt(); int even[]=new int[(n+1)/2],odd[]=new int[n/2]; int a[]=sc.readArray(...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
99ebebc5df7939ecccaff71310f1da4e
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.text.DecimalFormat; import java.util.*; public class Main { static class Pair { long a,b; public Pair(long a,long b) { this.a=a; this.b=b; } // @Override // public int compareTo(Pair p) { // ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
74d10b2ee1442229113fc6c19c4bb19e
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
//package Codeforces; import java.io.*; import java.util.*; import java.util.StringTokenizer; public class AquaMoonAndStrangeSort { public static void main(String[] args) throws IOException { Soumit sc = new Soumit(); int t = sc.nextInt(); StringBuilder sb = new StringBuilder()...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
bb1663b655d920e286b7fca3eef26c86
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; public class Solution { private static Scanner in = new Scanner(System.in); public static void main(String[] args) { int t = in.nextInt(); while(t-- > 0) solve(); } private static void solve() { int n = in.nextInt(); int a[][] = new int[n][2]; for(int i...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
874d6ba5e84d0ce321cc651a38715386
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
// Imports import java.io.*; import java.util.*; public class A1545 { // Implement binary search for lowest element public static int minBinary(Integer value, Integer[] sorted) { int low = 0; int high = sorted.length - 1; while(low < high) { // Can't be too low? ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
ec8f57c252c84621dd3edb66b92be5b4
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import com.sun.jdi.IntegerValue; import javax.lang.model.type.IntersectionType; import javax.swing.*; import java.sql.Array; import java.util.*; import java.lang.*; import java.io.*; public class Main { static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); static FastRe...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
59f07b14143d6e15b5e315294c46ffaf
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; public class AquamoonAndStrangeSort { static class FastScanner { BufferedReader br = new BufferedReader(new InputStre...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
c1771f91bc8e8bd1467d198818d467fd
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; //import java.lang.*; import java.io.*; public class Solution { static long[] fac; static int m = (int)1e9+7; static int c = 1; // static int[] x = {1,-1,0,0}; // static int[] y = {0,0,1,-1}; // static int cycle_node; public static void main(String[] args) thro...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
ffbfe66b9a5a491fbdd8d67865e7e340
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.lang.*; import java.util.*; public class Main { public static int mod = (int) 1e9 + 7; // **** -----> Disjoint Set Union(DSU) Start ********** public static int findPar(int node, int[] parent) { if (parent[node] == node) return node; ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
317c816769414c8cf103b020bb7124ad
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.io.*; public class Main{ static int mod = (int) (Math.pow(10, 9)+7); static final int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 }; static final int[] dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 }; static final int[] dx9 = { -1, -1, -1, 0, 0,...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
7e3f98588a67fcdae4ac2cc31c7dc738
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.*; public class copy{ public static int find(int a,int[] parent) { if(parent[a]==-1) return a; return find(parent[a],parent); } ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
5f5709d484c75ea3a93d5214e3704841
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.io.*; public class Main { // For fast input output static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { try { br = new BufferedReader(new FileReader("input.txt")); ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
a6b1978b781f07705c76154bbb27df75
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.util.*; public class A { public static int[] sort(int arr[]) { List<Integer> list = new ArrayList<>(); for(int i:arr) list.add(i); Collections.sort(list); for(int i = 0;i<list.size();i++) { arr[i] = list.get(i); } return arr; } public static void...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
b28dcb16dfae764395519fa0cd919c05
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.PriorityQueue; import java.util.Stack; import java.util.StringTokenize...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
2e035e5f22c8483f8bcc775770600dc5
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.Math.max; public class EdA { static long[] mods = {1000000007, 998244353, 1000000009}; static long mod = mods[0]; public static MyScanner sc; public static PrintWriter out; ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
64aa121af813ac20bf7c722695b13156
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { static final PrintWriter out =new PrintWriter(System.out); static final FastReader sc = new FastReader(); //I invented a new word!Plagiarism! //Did you hear about the mathematician who’s afraid of negative numbers?He’l...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
e5a2441e0bd322830c60ffb83b840c40
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.text.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { FastReader sc = new FastReader(); PrintWriter writer = new PrintWriter(System.out); int t = sc.nextInt(); while(t-->0) { ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
941f648f016e561c5d3142e4b615fccc
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int n = sc.nextInt(); int[] arr = new int[n]; int even_size = n/2; int odd_size=n/2; ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
3fc24192ad16f8ae475a5bc5ddf7b2e6
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.IOException; import java.util.*; public class A { static Scanner sc = new Scanner(System.in); public static void main(String[] args) throws IOException { int t = sc.nextInt(); while(t-- > 0){ solve(); } } static void solve(){ ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
31995f4c81f0842b3b4b33fef0b2094e
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; public class q1545 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int v[][] = new int[100001][2]; while (t-- > 0) { int N = sc.nextInt(); int arr[] = new int[N]; ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
4e4f5ddd196cf6faf2a160d5481eec69
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
//package com.rajan.codeforces.level_1500; import java.io.*; import java.util.LinkedList; import java.util.PriorityQueue; import java.util.Queue; public class AquaMoonAndStrangeSort { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamRead...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
bbae7f6fbd065cc8a106c5868c5533f1
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.lang.Math.ceil; import static java.util.Arrays.*; public class Codeforces { static int mod = 998244353; public static void main(String[] args) throws IOException { int t = ri(); while (t-- >...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
26a57346b41058f87ac1bab6f314b337
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.nio.charset.StandardCharsets; import java.util.*; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Rea...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
5f8ae529af4086e1efc2a3ab65d0998e
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Pupil { static FastReader sc = new FastReader(); public static void main (String[] args) throws java.lang.Exception { // your code...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
cf1f2205859c33a28535d65a904e2750
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
/* _oo0oo_ o8888888o 88" . "88 (| -_- |) 0\ = /0 ___/`---'\___ .' \\| |// '. / \\||| : |||// \ / _||||| -:- |||||- \ ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
163536bef1f7a0d554f20ee8a21c0088
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.*; import java.math.*; import static java.lang.Math.min; import static java.lang.Math.max; import static java.lang.Math.abs; /* https://codeforces.com/problemset/problem/1545/A*...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
71f249be20c5dd1009ff33250a616a3a
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; public class AquaMoonandStrangeSort { static Scanner scn = new Scanner(System.in); public static void main(String[] args) { int t = scn.nextInt(); while(t-- >0) { int n = scn.nextInt(); String ans = "YES"; int[] arr =...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
08207c1b67488ef548a831f16c146db3
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Solution implements Runnable { static int dx[] = {-1,1,0,0}; static int dy[] = {0,0,-1,1}; public static void main(String arg[]) { ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
bfcc578124cc68a16c83d4d71db2762e
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; public class A_AquaMoon_and_Strange_Sort { static long mod = Long.MAX_VALUE; public static void main(String[] args) { OutputStr...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
2a6805951d40276cb46cfdab3aed5202
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Sol { public static void main(String[] args) { FastReader sc = new FastReader(); int t = sc.nextInt(); int maxNum = ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
4232b6a8dd3803a7bd15a7b1069bf3cb
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main extends PrintWriter { Main() { super(System.out); } static boolean cases = true; // Solution void solve(int t) { int n = sc.nextInt(); int a[] = sc.readIntArray(n); int b[] = a....
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
04c8756d91d309e8976d246ba0a3a51f
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; public class Hello { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = Integer.parseInt(sc.nextLine()); int count[][] = new int[100001][2]; while (T-- > 0) { int N = sc.nextInt(); int arr[] = ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
e5b3856179fef564eadbf160b5aa1b0d
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.util.Map.Entry; import java.math.*; import java.sql.Array; public class Simple{ public static class Pair implements Comparable<Pair>{ int x; int y; public Pair(int x,int y){ this.x = x; this.y = y; } ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
dc8d3ec739f65a864574bf573b855299
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; public class class373 { public static void main(String arg[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int a[]=new int[n]; int i; int ct1[][]=new int[100001][2]; for(i=0;i<n;i++) { a[i]=sc.nextInt(); if(i%2==0) ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
4deee4a53013189585d5b110226a3fcd
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.Math.sqrt; import static java.lang.Math.pow; import static java.lang.System.out; import static java.lang.System.err; import java.util.*; import java.io.*; import java.math.*; public ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
dd204b41e4bb52c99cbc0070f86b360d
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int cishu = sc.nextInt(); while (cishu-- != 0) { int n=sc.nextIn...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
a19f46ce9100630c5fb5cc23985c4b66
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
// package com.company; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); StringBuilder sb = new StringBuilder...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
abb04514571b7cfa34d2749b91467eaa
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { static { try { System.setIn(new FileInputStream("input.txt")); System.setOut(new PrintStream(new FileOutputStream("output.txt"))); } catch (Exception e) {} } void solve() { int n = in.nextInt(); int[] a = arra...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
ad2c3518299385946d4a97b48ccc0d26
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; public class Solution { private static Scanner in = new Scanner(System.in); public static void main(String[] args) { int t = in.nextInt(); while(t-- > 0) solve(); } private static void solve() { int n = in.nextInt(); int a[][] = new int[n][2]; for(int i...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
f3b9cb38f04075386f4174acc4e414e6
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.util.*; import javax.sound.midi.SysexMessage; import java.math.*; public class Main { public String ns() throws IOException{return(read.nextLine());} public String wrd() throws IOException{return(read.next());} public int ni() throws IOException{return(read.nextInt...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
fdff3d4d3c5a81947949ef17a69ee9dd
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.Scanner; import java.util.stream.IntStream; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int tc = 0; tc < t; ++tc) { int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < a.length...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
cad91c4c6522f32905a34e51025d649e
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; import java.util.stream.Collectors; import java.text.DecimalFormat; public class A{ static FastScanner scan=new FastScanner(); public static PrintWriter...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
fedee5a54b05535e93b83a49ab50bad9
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOExcept...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
1a3724239d1692e811eb5bfbe825b128
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
/* Author : Kartikey Rana from MSIT New Delhi */ import java.util.*; import javax.sql.rowset.serial.SerialArray; import javax.swing.text.html.HTMLDocument.HTMLReader.PreAction; import java.io.*; import java.math.*; import java.sql.Array;; public class Main { static class FR { BufferedReader br; String...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
663937cced73f4f6933af91ebd44bf81
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { try { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
97397d3bf4730751a1d7acf19e4b14a7
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static FastScanner sc = new FastScanner(); static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); private static void solve(){ int n = sc.nextInt(); int[]arr = new int[n]; for(int i =...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
305e81f52f23533e4d36feb4e5f19dd6
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
/** * @Created_by : Lucent868 * @Date : 26-08-2021 * @Time : 13:03 */ import java.util.*; import java.io.*; import java.math.*; public class A { static InputReader in; static PrintWriter out; public static void main(String args[]) { new Thread(null, new Runnable() { ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
b458a1ee959100eaace1255aa7254d28
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
/* Date: 12-08-2021 Time: 10:12 Author: Kartik Papney Linkedin: https://www.linkedin.com/in/kartik-papney-4951161a6/ Leetcode: https://leetcode.com/kartikpapney/ Codechef: https://www.codechef.com/users/kartikpapney */ import java.util.*; import java.io.BufferedReader; import java.io...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
0ccf9c43e7e3ba1fe0dee10b94caf75d
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
//package Practise; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.Random; import java.util.StringTokenizer; public class StrangeSort { public static void main(String args[]) { FastScanner ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
39947066e709d45faf7361ebbe328606
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.awt.*; /*AUTHOR - SHIVAM GUPTA */ // U KNOW THAT IF THIS DAY WILL BE URS THEN NO ONE CAN DEFEAT U HERE ,JUst keep faith in ur strengths .................................................. // ASCII = 48 + i ;// 2^28 = 268,435,456 > 2* 10^8 ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
10a9a5cf691fbf59498368b38ad85d5b
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf1545a { public static void main(String[] args) throws IOException { int t = ri(); next: while (t --> 0) { int n = ri(), a[] = ria(n); Map<p, I...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
a8c4e144a9d37de23af168085e3ef773
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.util.*; import java.text.DecimalFormat; public class Main { static long mod=(long)1e9+7; static long mod1=998244353; public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputR...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
d7e07c218af9db018d7ac6add0d43e6d
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class hello { static Scanner scan = new Scanner(System.in); public static void main(String[] args) { int t = scan.nextInt(); while(t-->0){ solve(); } } static void solve(){ int n ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
d1b9f55b6e20c1660221cdc9c8559b3d
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
/* stream Butter! eggyHide eggyVengeance I need U xiao rerun when */ import static java.lang.Math.*; import static java.lang.System.out; import java.util.*; import java.io.*; import java.math.*; public class x1545A { public static void main(String hi[]) throws Exception { BufferedReade...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
df265091392488a85108d4f1fa518d59
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.PriorityQueue; public class Main { public static void main(String[] args) { new Main(); } public Main() { FastScanner fs = new FastScanner(); java.io.PrintWriter out = new java.io.PrintWriter(System.out); solve(fs, out); out.flush(); } public void solve(FastScanner fs,...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
ac6d9b5a863c97624aad957f1a9f69a6
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String[] args) { FastScanner sc = new FastScanner(); int T = sc.nextInt(); int N = 100000; while(T-->0) { int n = sc.nextInt(); LinkedList<Integer>[] pos = new LinkedList[N+1]; for(int i = 0; i <= N; i++) { pos[i] = ne...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
b189de2791439824080e09cf19bf4d45
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
//package round732; import java.io.*; import java.util.ArrayDeque; import java.util.Arrays; import java.util.InputMismatchException; import java.util.Queue; public class A { InputStream is; FastWriter out; String INPUT = ""; void solve() { for(int T = ni();T > 0;T--)go(); } void go() { ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 11
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
62c91a338ff38a108a5feca09d173d14
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.util.*; public class A { public static void main(String[] args) { FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); int T = in.nextInt(); for(int ttt = 1; ttt <= T; ttt++) { int n = in.nextInt(); ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 8
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
9af262b1a214b9dec06469e1ece71f98
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.util.*; public class A { public static void main(String[] args) { FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); int T = in.nextInt(); for(int ttt = 1; ttt <= T; ttt++) { int n = in.nextInt(); ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 8
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
616243bd5d6683e229bdbff489c71b2a
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class CF1545_D1_A { public static void main(String[] args) { FastScanner scanner = new FastScanner(); int t = scanner.nextInt(); for (int i = 0; i < t; i++) { ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 8
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
4393cdcee863ec46d162a6bade0c1215
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Random; import java.util.Stack; import java.util.concurrent.ThreadLocalRandom; public class AquaMoonAndStrangeSort { public static void main...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 8
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
edeb6a9bbc8ec166745caa13d0066a21
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
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; public static void main (String[] args)throws IOException { bf = new Buf...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 8
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
9388ddc8daa6484cc781922b37968fd7
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.io.*; public class codeforces1545A { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int numCases = Integer.parseInt(br.readLine()); while (numCases-->0) { ...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 8
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
0128a9fb82920d5bf4954984550a9305
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.util.*; public class Solution{ public static int INF = 0x3f3f3f3f; public static int mod = 1000000007; public static int mod1 = 998244353; public static void main(String args[]){ try { int t = fReader.nextInt(), loop = 0; while (lo...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 8
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
8210a8d3fedcf90c9a479dff42852a7f
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.*; import java.io.*; public class Solution { static FastScanner scr=new FastScanner(); // static Scanner scr=new Scanner(System.in); static PrintStream out=new PrintStream(System.out); static StringBuilder sb=new StringBuilder(); static class pair{ int x;int y...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 8
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
f861371b8564d8e7f6a5b910807a3d92
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws Exception { (new Main()).run(); } BufferedReader in; PrintWriter out; StringTokenizer st = new StringTokenizer(""); void run() th...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 8
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
86753d848a73d62da01a965406bce3db
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.util.Arrays; public class BubbleSort { public static void main(String[] args) { FastScanner sc = new FastScanner(); int testCases = sc.nextInt(); for(int i = 0 ; i < testCases; i ++) { int len = sc.nextInt(); int[] arr = new int[len]; for(int j = 0 ; j < len; j++) { arr[j] = s...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 8
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
729f9e93d949e9fbfba424213d96d011
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.io.IOException; import java.lang.reflect.Field; import java.util.stream.Collectors; import java.nio.charset.StandardCharsets; import java.io.UncheckedIOException; import...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 8
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output
PASSED
67f0014b7bf5fc1526cc50fbafa2c9ec
train_108.jsonl
1626012300
AquaMoon has $$$n$$$ friends. They stand in a row from left to right, and the $$$i$$$-th friend from the left wears a T-shirt with a number $$$a_i$$$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.AquaMoon can make some operations on friends. On each ...
256 megabytes
/* stream Butter! eggyHide eggyVengeance I need U xiao rerun when */ import static java.lang.Math.*; import static java.lang.System.out; import java.util.*; import java.io.*; import java.math.*; public class x1545A { public static void main(String hi[]) throws Exception { BufferedReade...
Java
["3\n4\n4 3 2 5\n4\n3 3 2 2\n5\n1 2 3 5 4"]
1 second
["YES\nYES\nNO"]
NoteThe possible list of operations in the first test case: Swap $$$a_1$$$ and $$$a_2$$$. The resulting sequence is $$$3, 4, 2, 5$$$. The directions are: left, left, right, right. Swap $$$a_2$$$ and $$$a_3$$$. The resulting sequence is $$$3, 2, 4, 5$$$. The directions are: left, left, right, right. Swap $$$a_1$$$ an...
Java 8
standard input
[ "sortings" ]
1d27d6d736d891b03b7476f8a7209291
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of Aquamoon's friends. The second line contains $$$n$$$ integers $$$...
1,500
For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes). You can print each letter in any case (upper or lower).
standard output