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
b84cf14102b216de4ea16c03ac08999d
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 < i_2 < \ldots < i_k \le n$$$. Add $$...
256 megabytes
/***** ---> :) Vijender Srivastava (: <--- *****/ import java.util.*; import java.lang.*; import java.lang.reflect.Array; import java.io.*; public class Main { static FastReader sc =new FastReader(); static PrintWriter out=new PrintWriter(System.out); static long mod...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
8986243d9360f92170df8839bb89984c
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.*; import java.util.*; public class C_Two_Arrays { public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); int a[] = sc.readArray(n); i...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
181f502375f5e7a34fe8645035d6cedc
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
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 arr1[]=new int[n],arr2[]=new int[n]; boolean flag=true; ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
a7377a242eb65eb47bcc3787cae9c10e
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*;//import static java.lang.System.out; import static java.lang.System.*; public class Main { static int[] arr; public static void main(String[] args) throws Exception { ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
cb8d3f354b47abcd9244fb07e941f915
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
// package FunTime; import java.io.BufferedReader; import java.util.*; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.math.*; public class Template { static class FastReader { BufferedReader br; StringTokenizer st; publi...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
a8ff743b4313c2771f32b39dbfb489e6
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class Template { private static class FastReader { BufferedReader br; Stri...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
83c9e53f12845a80b64088eb780beee1
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; public class CForce { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while (t-->0){ int n = scan.nextInt(); int ar[] = new int[n]; int ar1[] = new int[n]; for...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
9824a5fd0b3b52d272c9d81a98753027
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; public class problem1584C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t != 0) { t--; int n = sc.nextInt(); int a[] = new int[n]; int b[] = new int[n...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
a92a66b94b14a44fc38fb0b6a576bfb7
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class twoarrays { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int t= sc.nextInt(); for(int i=0; i<t; i++){ int n = sc.nextInt(); int[] a= new int[n]; for(...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
dcbae0272e12a81b0886df9681b2f4b4
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class C_Two_Arrays{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int testCases = scan.nextInt(); while(testCases-->0){ int length = scan.nextInt(); int[] a1 = new in...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
29703307f33d8c6ba830c860df6b9bb6
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t>0) {...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
e82d46cb4185e2232c47e38f1b1786d8
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class C { public static void main(String[] args) throws java.lang.Exception { try { FastReader sc = new FastReader(); int t = sc.nextInt(); u: while (t-- > 0) { int n = sc.nextInt(); int arr[]=sc.readArray(n); ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
5ed456d1a3c19850a499e28a5ee31684
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for (int j = 0; j < T; j++) { int n = sc.nextInt(); int a[] = new int[n]; ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
cb83916c581e3041847bf928c10e26ae
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; import java.io.*; public class Practice { static boolean multipleTC = true; FastReader in; PrintWriter out; static int mod = 1000000007; public static void main(String[] args) throws Exception { new Practice().run(); } void run() throws Exception { in = new FastReader(); out = new P...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
747fd9659bcf435d223be75c6cf091bd
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
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 [] a = new int[n]; int [] b = new int[n]; ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
a93e2f4b4bf550b548140f8521d987c8
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Set; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; import java.util.TreeSet; public class C_Two_Array...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
259f87707bd1936596a6388a61bb5a4e
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
// package com.company.Codeforces; import java.util.*; import java.lang.*; import java.io.*; public class newPro { public static void solve(){ int n = sc.nextInt(); int [] a = sc.nextIntArray(n); int [] b = sc.nextIntArray(n); Arrays.sort(a); Arrays.s...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
435ed0b3641cfead4f3a35ddbde71acd
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class B { public static void main(String[] args) { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
8c031957660580e748230ac2ce9b6253
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class TwoArrays { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for ( int p = 0; p < t; p++){ int n = in.nextInt(); int[] arr1 = new int[n]; ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
af36fb6a61410a885b97cdb4da981bcd
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.FileNotFoundException; import java.sql.Array; import java.util.*; public class template { public static void main(String[] args) throws FileNotFoundException { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int a = 0; a < t; a++) { int n = sc.next...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
364e7a4f0c849145ef6f0fe14d56b695
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import javax.management.ValueExp; import javax.sql.rowset.spi.SyncResolver; import java.io.ObjectInputStream.GetField; import java.lang.*; /* Name of the class has to be "Main" only if the class is public. */ public class codeforces...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
ae3bad70f5bc16d238f616e12d741704
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.*; import java.util.*; public class Main { static class FastReader { BufferedReader br;StringTokenizer st;public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in));} String next(){while(st==null||!st.hasMoreElements()) { try{st=new StringTok...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
0a62166528b7830dfc07ec263ef7a95e
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; import java.io.*; public class Main { // when can't think of anything -->> // 1. In sorting questions try to think about all possibilities like sorting from start, end, middle. // 2. Two pointers, brute force. // 3. In graph query questions try to solve it reversely or try to proc...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
16af5a45a0e657424677e4ef0a553b1a
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class C { public static void main(String[] args) { Scanner in = new Scanner(new BufferedRe...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
3bd5a460d8bfe3a4deff44b64a7e1dc9
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; public class TwoArrays { public static void main(String[] args) { Scanner in=new Scanner(System.in); int t=in.nextInt(); for(int i=0;i<t;i++){ int n=in.nextInt(); int []a=new int [n]; int[] b=new int [n]; for(i...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
55ce52053e568a3af054720e33213f97
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; import java.io.*; import java.lang.reflect.Array; public class codeforce { public static void main(String[] args){ Scanner read = new Scanner(System.in); byte t = read.nextByte(); while(t-->0){ int n = read.nextInt(); ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
772c0a15acca07091467a8e23bbe59ad
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.*; import java.lang.Math; import java.lang.reflect.Array; import java.util.*; import javax.swing.text.DefaultStyledDocument.ElementSpec; public final class Solution { static BufferedReader br = new BufferedReader( new InputStreamReader(System.in) ); static BufferedWriter bw = new B...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
55ee1d7d1e71333ca694ed730530df5a
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.*; import java.util.*; public class Q1584 { static int mod = (int) (1e9 + 7); static void solve() { int n = i(); long[] a = new long[n]; long[] b = new long[n]; for (int i = 0; i < n; i++) { a[i] = l(); } for (int i = 0; i...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
e199e459b96f3449fe88c1de1eb3f444
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; public class Main { static Scanner in = new Scanner(System.in); static int length; static int[] a; static int[] b; static int[] c; public static void main(String[] args) { int casesNumber = in.nextInt(); while (casesNumber-- != 0) { l...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
803510bb21ed7170950723da22b5468a
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
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.StringTokenizer; public class test { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
887118e024905cc97f0fe7591da21bc7
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; public class TwoArrays { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int[] a=new int[n]; int[] b=new int[n]; for(int i=0;i<n;i++) { a[i]=sc.nextInt(); } ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
02ae26d312c013fadf3ff95e08923f47
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
/*LoudSilence*/ import java.io.*; import java.util.*; import static java.lang.Math.*; public class Solution { /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ static FastScanne...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
a84da316126c88dbd74548d48a9e1f3b
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
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 C_Two_Arrays { public static void main(String[] args) { OutputStream outputStream = System.out; PrintWriter ou...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
f66d7080ec4434e2f5b89ab2d5f1215a
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; public class ddz { public static void main(String[] args) { System.out.println(); Scanner sc = new Scanner(System.in); int x= sc.nextInt(); while(x-->0) { int n=sc.nextInt(); int[] a=new int[n]; int[] b=new int[n]; for(int i=0;i<n;i++){ a[i]=sc.nextInt(); ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
9df7ce843409c365e5af81dac1c89a21
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); while(t-->0){ int n = scn.nextInt(); int[] a = new int[n]; int[] b = new int[n]; for(int i = 0; i<n; i++){ ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
12849914a32744c1887575c88d77ac89
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class TwoArrays{ public static void main(String[] args)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int testCases = Integer.parseInt(br.readLine()); StringBuilder re...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
86daf232253b5d5d05744f47b74ba27e
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); // long mod = 1_000_000_007L; // long mod = 998_244_353L; int t = sc.nextInt(); for ( int zzz=0; zzz<t; zzz++ ) { int n = sc.nextInt(); int[] a = new int[n]; int[]...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
bef67997837829cfc11cd6502ab6dd5b
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; import java.io.*; public class CP { static final int MOD = (int) (1e9) + 7;// ((a + b) % MOD + MOD) % MOD public static void main(String[] args) throws IOException { FastReader sc = new FastReader(); int t = sc.Int(); for (; t > 0; t--) { int n...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
3f07341a9f8d5abe9223b0ffa05e1764
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Arrays; import java.util.Scanner; /** * * @author eslam */ public class TwoArrays2 { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); lo...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
e07d1490e40c061bde253da51ec4faa2
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); int a[] = new int[n]; ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
eb3ad61b05aab21452f68268e610c85d
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
//package com.codeforces.Practise; import java.io.*; import java.util.Arrays; public class TwoArrays { //Don't Confuse Always make things simple //Experience is the name of the game // You won't fail until you stop trying....... // you can solve one problem by many approaches. when you stuck yo...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
d1a9cdfbd726f27a79ab17991b1fd44e
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; public class TwoArrays { public static void main(String args[]) { int i,j,k,t,n; Scanner sc=new Scanner(System.in); t=sc.nextInt(); while(t-->0) { n=sc.nextInt(); int a[]=new int[n]; int b[]=new int[n]; for(i=0;i<n;i++) { a[i]=sc.nextInt(); } for(...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
039c308ac0d45eb62be3e37b877e62f4
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int tt=sc.nextInt(); while(tt-->0) { int n=sc.nextInt(); int[] a=new int[n]; for(int i=0;i<n;i++) a[i]=sc.nextInt(); int[] b=new int[n]; for(int i...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
df8b8263ae32c6799bd4d5d340887ee1
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
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\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
4b984c623c6716fdb045e74947434919
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Arrays; 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...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
e2753d6e1ad059497c43abfd6447cb92
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Scanner; import java.util.Arrays; public class Main{ public static void main(String[] args){ Scanner scn = new Scanner(System.in); int t = scn.nextInt(); for(int k=0;k<t;k++){ int n = scn.nextInt(); int[] a = new int[n]; for(int...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
4a443f9a63c875cf745d2fbd36d6f636
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.Arrays; public class NewTemplate { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
5688316b2b894e095e0aa0dd27ba450b
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; import java.lang.*; public class C_Two_Arrays{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); int a[]=new int[n]; int b[]=new int[n]; for(int i=0;i<n;i++)...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
79b10305d7fd2666e9e45688a3460cf6
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.util.Arrays; public class TwoArrays { private static String solve(int n, int a[], int b[]) { Arrays.sort(a); Arrays.sort(b); for (int i = 0 ; i < n ; i++) { ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
8abf9666d7cc7011cab638ffbe6e92cd
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; import java.io.*; public class Check1{ static FastReader in = new FastReader(); static final Random random = new Random(); static long mod = 1000000007L; static HashMap<String, Integer> map = new HashMap<>(); public static void main(String[] args) { int t=in.nextInt(); while(t--...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
b0eec404b7ed6870905bacfe13bd8f7f
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Scanner; import java.util.Arrays; public class TwoArrays { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t > 0) { int n = sc.nextInt(); int[] a = new int[n]; int[] b = new int[n]...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
746c1bae60c41d9196f822b2d2166c7f
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; public class Solution{ static Scanner sc = new Scanner(System.in); public static void main(String[] a) { int testCases = sc.nextInt(); long t1 = System.currentTimeMillis(); for(int i=1; i<=testCases; i++){ solve(); } if (Sy...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
deb79cecd444a23eabd16a4294c6e8b7
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.*; import java.util.*; public class MyClass { public static void main(String args[])throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(br.readLine()); while(t-->0){ int n=Integer.parseInt(br.re...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
a238d1a5fa291b5bc28dc3bc0f062bd3
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
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 [] a = new int[n]; int [] b = new int[n]; ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
2162c7534443db076dd4f74e75df5696
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.*; import java.util.Arrays; public class TwoArrays { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); for(int k = 0; k < t; k++) { int n = Integer.parseInt(br.readLi...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
de83fc01825c9c3660525a9b2faad485
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
//package currentContest; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashS...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
e2dce67b34cc0c2ee0fc7b687b96a497
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Test { static FastScanner sc = new FastScanner(); static PrintWriter out = new PrintWriter(new BufferedOutputSt...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
0cac04dcf0f3fb8cb63b0d4162fa7aa5
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Codeforces { static long mod = 1_000_000__007; public static void main(String[] args) { FastReader fastReader = new FastReader(); int t = fastReader.nextInt();...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
d845100a541eb5f7f44d66859a01abc2
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Locale; import java.util.StringTokenizer; public class C { private void solve() { int t = readInt(); for (int l = 0; l < t; l++) { int n = readInt(); int[] first = readIntArray(n); int[] sec...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
5a7149f361a68391d08ceaf4eccae98f
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Scanner; public class C{ static Scanner scan; public static void main(String[] args){ scan = new Scanner(System.in); int t = scan.nextInt(); for(int i = 0; i< t; i++){ raschet(); } } private static void raschet(){ int n = scan.nextInt(); int[] a = new int[n]; int[]...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 11
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
522ac5136fd43dff8e95f26e861bd437
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.Scanner; public class nxt { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); while(tc-- > 0){ int n = sc.nextInt(); ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 17
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
16d481ba774046513426668698332fa3
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Scanner; import java.util.Arrays; import java.util.*; import java.lang.*; public class Prob01 { public static void main(String[] args) throws Fi...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 17
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
84756f1cabf82a8bd9634764276b5b07
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class scratch{ public static void main(String args[]){ Scanner in=new Scanner(System.in); int test=in.nextInt(); while(test-->0) { int n=in.nextInt(); int arr1[]=new int[n]; int arr2[]=new int[n];...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 17
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
791ac1f4a262fd2088cc1b601bfa8f35
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.*; import java.util.*; public class Two_Arrays{ public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); for(int i = 0; i<N; i++){ int a = sc.nextInt(); int[] amt = new int[203]; ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
ed5fec3e48e572ebaf5ad9608ab6f671
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Scanner; import java.util.List; import java.util.ArrayList; import java.util.Collections; public class MyClass { static Scanner in=new Scanner(System.in); static int n,testCases; static List<Integer> a,b; static void solve(){ Collecti...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
db86a0332f41b1012dee829c98aba109
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { try { Scanner sc=new Scanner...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
8633f5baa9206507dcef62528ef62b39
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
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 a[]=new int[n]; int b[]=new int[n]; for(int i=0;i<n;i++) { a[i]=sc.nextInt(); } ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
705972e8a4b3d55a640c7ed6affedd4c
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
// package faltu; import java.util.*; import java.util.Map.Entry; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWrit...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
88a008a96834e24e668124671eb361d3
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; import java.io.*; public class A { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String next(...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
a2660e3f6d96aec50475286f54285020
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; /** * * @author Acer */ public class TwoArrays { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); while(T-- > 0){ int n = ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
0a7dee39ae988a3d946a9011ffdcad32
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.*; import java.util.*; public class TwoArrays { public static void main(String[] args) throws IOException { FastScanner in = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); for (int i = 1; i <= t; i++) { int n = in.nextInt(); ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
80e2ff13e7d4d8e0e3de47df2d6e88c0
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; public class Practice { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-- >0) { int n=sc.ne...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
f458960607f52eff0fc8cd2bfef4ffd3
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); int[] a = new int[n], b = new in...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
c6b8de6c340221e7fd08c890173207db
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.lang.*; import java.io.InputStreamReader; import static java.lang.Math.*; import static java.lang.System.out; import java.util.*; import java.io.File; import java.io.PrintStream; import java.io.PrintWriter; import java.math.BigInteger; pu...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
9681b9f29e7e984f7fa33777afd9f7ee
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.lang.*; import java.io.InputStreamReader; import static java.lang.Math.*; import static java.lang.System.out; import java.util.*; import java.io.File; import java.io.PrintStream; import java.io.PrintWriter; import java.math.BigInteger; pu...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
b1a868b341801780ed05a33340ed31ff
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.*; import java.util.*; public class TwoArrays{ static long mod = 1000000007L; static MyScanner sc = new MyScanner(); static void solve() { int n = sc.nextInt(); int arr[] = sc.readIntArray(n); int brr[] = sc.readIntArray(n); sort(arr); sort(...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
7578a663a33027a0bbf242058f42e35a
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class TwoArrays { public static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int tc = scanner.nextInt(); while (tc-->0){ int size = scanner.nextInt(); int [] array = ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
1ecb9ce8cdf4ac280e4732b3e6e91983
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class fastTemp { public static void main(String[] args) throws IOException, NumberFormatException { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); w...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
95b7f65320a81ee8a1669f6577f4e8f0
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; /* * Author : Imtiaz Adar */ public class x1584C { public static void main(String[] args) { FastScanner scan = new Fast...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
fa19e4fb459c0896ff54aa6e87dc989d
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.*; import java.util.*; public class TwoArrays { public static void main(String[] args) { new TwoArrays().run(); } BufferedReader br; PrintWriter out; long mod = (long) (1e9 + 7), inf = (long) (3e18); class pair { int F, S; pair(int f, i...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
c233ce149e990ded1022a04c5bb91344
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; import java.io.*; public class C { public static void main(String[] args) throws IOException { FastReader in = new FastReader(System.in); PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); int t = in.nextInt(); for (int tt = 0; tt < t...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
33f7ede638717fdc242e67f8560dd2f1
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.*; import java.util.*; public class Main2 { static long mod = 998244353; public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int test = in.nextInt(); for(int t = 1; t<=test;t++) { ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
6b4b278ee9f28aad0ae0814beed00841
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Arrays; 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]...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
202856f1c879ae056b7f1c5d0b6c5749
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.util.StringTokenizer; public class Two_Arrays { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream di...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
127924c76e4eede4f6344e227934d0c0
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.*; import java.util.*; public class A { public static long gcd(long a, long b) { return a == 0 ? b : gcd(b, a % b); } public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter o = new PrintWriter(System.out); int t1 = sc.nextInt()...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
184a46fccfdc3e0a9cfc3eca6ed37eca
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; import java.io.*; public class Main{ static Scanner sc = new Scanner(new BufferedInputStream(System.in)); static int sc(){return sc.nextInt();} static double scd(){return sc.nextDouble();} static char[] carr(){return sc.next().toCharArray();} static long scl(){return sc.ne...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
554a708273eb0790b64797f2a1a8d8fb
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); while(tc-->0) { int n = sc.nextInt(); int a[] = new int[n]; int b[] = new int[n]; boolea...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
27ca15e71f2f163f3b5c248a18ac28d0
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); while(tc-->0) { int n = sc.nextInt(); int a[] = new int[n]; int b[] = new int[n]; boolean ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
eb7579f14f63c4b82c65a586b7249fab
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class C1584 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); for (int t=0; t<T; t++) { int N = in.nextInt(); int[] A = new int[N]; i...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
aa235340120f185edc3c4e9b9d0902fe
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); while(t-->0){ int n = scn.nextInt(); int[] a = new int[n]; int[] b = new int[n]; for(int i = 0; i<n; i++){ ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
6691f83666d7ca34429b6dea8b0cb377
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.lang.Math; import java.lang.String; import java.util.Arrays; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Scanner; import java.util.Collections; import java...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
cc4e7ddc5bed41282705ac309a314c5c
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; public class practice2 { 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[] brr=new int[n]; for (int i = 0; i < n; i...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
7012a59ffcf0d9a1f6ce0ecc9467cf81
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Scanner; import java.util.List; import java.util.ArrayList; import java.util.Collections; public class MyClass { static Scanner in=new Scanner(System.in); static int n,testCases; static List<Integer> a,b; static void solve(){ Collecti...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
fb71924f1ff719ae094d53f8ec83ef78
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.sql.Time; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
784cfd16a6cf8eb47de882269c813b72
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; import java.io.*; public class codeforces1584C { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int numCases = Integer.parseInt(br.readLine()); for (int rep = 0; rep<numCases;rep+...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
fefd10fa795f5520520dfa760c4bc9cb
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.*; import java.io.*; public class CFsolve { public static void main(String[] args) { FastScanner input = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = input.nextInt(); while(t-- > 0){ byte n = input.nextByte(); StringBuilder str1 = n...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
af6f5e972a07e7bd01d3010fb776c561
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class C { public static void main(String[] args) { FastScanner fs=new FastScanner(); int t=fs.nextInt(); while (t-->0) { int n=fs.next...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
e181ecc839c665d268bf57d1d8d42e79
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.io.*; import java.util.*; public class cf { public static void main(String[] args){ FastScanner sc = new FastScanner(); int z = sc.nextInt(); //int z=1; while(z-- > 0){ int n=sc.nextInt(); int a[]=new...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
9805f5369e3b4a3fbbec3d7e8d7245bf
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.util.Scanner; import java.util.*; public class Main { public static void main(String[] args) { // write your code here Scanner sc = new Scanner(System.in); int test = sc.nextInt(); while (test-- != 0) { int n = sc.nextInt(); ...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output
PASSED
3d4928f53e816dfc01f8d720329d5955
train_109.jsonl
1636869900
You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$.Let's define a transformation of the array $$$a$$$: Choose any non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$. Choose $$$k$$$ distinct array indices $$$1 \le i_1 &lt; i_2 &lt; \ldots &lt; i_k \le n$$$. Add $$...
256 megabytes
import java.lang.reflect.Array; import java.util.*; import java.io.*; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static class Matches implements Comparable<Matches>{ public int quantity; public int amount; public Matches(Integer na...
Java
["3\n3\n-1 1 0\n0 0 2\n1\n0\n2\n5\n1 2 3 4 5\n1 2 3 4 5"]
1 second
["YES\nNO\nYES"]
NoteIn the first test case, we can make the following transformation: Choose $$$k = 2$$$. Choose $$$i_1 = 1$$$, $$$i_2 = 2$$$. Add $$$1$$$ to $$$a_1$$$ and $$$a_2$$$. The resulting array is $$$[0, 2, 0]$$$. Swap the elements on the second and third positions. In the second test case there is no suitable transformat...
Java 8
standard input
[ "greedy", "math", "sortings" ]
6ca98e655007bfb86f1039c9f096557e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Descriptions of test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of arrays $$$a$$$ and $$$b$$$. The second line of each test case contains $$$n$$$ ...
900
For each test case, print "YES" (without quotes) if it is possible to perform a transformation of the array $$$a$$$, so that the resulting array is equal to $$$b$$$. Print "NO" (without quotes) otherwise. You can print each letter in any case (upper or lower).
standard output