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
e59f5d44fab594968cc57a4158d59487
train_108.jsonl
1650722700
There is an array $$$a$$$ of length $$$n$$$. You may perform the following operation any number of times: Choose two indices $$$l$$$ and $$$r$$$ where $$$1 \le l < r \le n$$$ and $$$a_l = a_r$$$. Then, set $$$a[l \ldots r] = [a_{l+1}, a_{l+2}, \ldots, a_r, a_l]$$$. You are also given another array $$$b$$$ of length...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; public class D1672 { public static void main(String[] args) throws IOException { InputReader ir = new InputReader(Syst...
Java
["5\n\n5\n\n1 2 3 3 2\n\n1 3 3 2 2\n\n5\n\n1 2 4 2 1\n\n4 2 2 1 1\n\n5\n\n2 4 5 5 2\n\n2 2 4 5 5\n\n3\n\n1 2 3\n\n1 2 3\n\n3\n\n1 1 2\n\n2 1 1"]
1 second
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case, we can choose $$$l=2$$$ and $$$r=5$$$ to form $$$[1, 3, 3, 2, 2]$$$.In the second test case, we can choose $$$l=2$$$ and $$$r=4$$$ to form $$$[1, 4, 2, 2, 1]$$$. Then, we can choose $$$l=1$$$ and $$$r=5$$$ to form $$$[4, 2, 2, 1, 1]$$$.In the third test case, it can be proven that it is not ...
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation", "two pointers" ]
158bd0ab8f4319f5fd1e6062caddad4e
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$)  — the length of array $$$a$$$ and $...
1,700
For each test case, print "YES" (without quotes) if it is possible to transform array $$$a$$$ to $$$b$$$, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
6e788896b84fc71d8debe3f6af474af0
train_108.jsonl
1650722700
There is an array $$$a$$$ of length $$$n$$$. You may perform the following operation any number of times: Choose two indices $$$l$$$ and $$$r$$$ where $$$1 \le l < r \le n$$$ and $$$a_l = a_r$$$. Then, set $$$a[l \ldots r] = [a_{l+1}, a_{l+2}, \ldots, a_r, a_l]$$$. You are also given another array $$$b$$$ of length...
256 megabytes
import java.util.*; import java.io.*; // cd C:\Users\Lenovo\Desktop\New //ArrayList<Integer> a=new ArrayList<>(); //List<Integer> lis=new ArrayList<>(); //StringBuilder ans = new StringBuilder(); //HashMap<Integer,Integer> map=new HashMap<>(); ...
Java
["5\n\n5\n\n1 2 3 3 2\n\n1 3 3 2 2\n\n5\n\n1 2 4 2 1\n\n4 2 2 1 1\n\n5\n\n2 4 5 5 2\n\n2 2 4 5 5\n\n3\n\n1 2 3\n\n1 2 3\n\n3\n\n1 1 2\n\n2 1 1"]
1 second
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case, we can choose $$$l=2$$$ and $$$r=5$$$ to form $$$[1, 3, 3, 2, 2]$$$.In the second test case, we can choose $$$l=2$$$ and $$$r=4$$$ to form $$$[1, 4, 2, 2, 1]$$$. Then, we can choose $$$l=1$$$ and $$$r=5$$$ to form $$$[4, 2, 2, 1, 1]$$$.In the third test case, it can be proven that it is not ...
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation", "two pointers" ]
158bd0ab8f4319f5fd1e6062caddad4e
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$)  — the length of array $$$a$$$ and $...
1,700
For each test case, print "YES" (without quotes) if it is possible to transform array $$$a$$$ to $$$b$$$, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
9b2dba15a1ee7f136d19c4b4c850284a
train_108.jsonl
1650722700
There is an array $$$a$$$ of length $$$n$$$. You may perform the following operation any number of times: Choose two indices $$$l$$$ and $$$r$$$ where $$$1 \le l &lt; r \le n$$$ and $$$a_l = a_r$$$. Then, set $$$a[l \ldots r] = [a_{l+1}, a_{l+2}, \ldots, a_r, a_l]$$$. You are also given another array $$$b$$$ of length...
256 megabytes
import java.util.*; import java.io.*; public class E{ static FastScanner fs = null; public static void main(String[] args) { fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = fs.nextInt(); while (t-->0) { int n = fs.nextInt(); int a[] = new int[n]; int b[] = ne...
Java
["5\n\n5\n\n1 2 3 3 2\n\n1 3 3 2 2\n\n5\n\n1 2 4 2 1\n\n4 2 2 1 1\n\n5\n\n2 4 5 5 2\n\n2 2 4 5 5\n\n3\n\n1 2 3\n\n1 2 3\n\n3\n\n1 1 2\n\n2 1 1"]
1 second
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case, we can choose $$$l=2$$$ and $$$r=5$$$ to form $$$[1, 3, 3, 2, 2]$$$.In the second test case, we can choose $$$l=2$$$ and $$$r=4$$$ to form $$$[1, 4, 2, 2, 1]$$$. Then, we can choose $$$l=1$$$ and $$$r=5$$$ to form $$$[4, 2, 2, 1, 1]$$$.In the third test case, it can be proven that it is not ...
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation", "two pointers" ]
158bd0ab8f4319f5fd1e6062caddad4e
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$)  — the length of array $$$a$$$ and $...
1,700
For each test case, print "YES" (without quotes) if it is possible to transform array $$$a$$$ to $$$b$$$, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
874c3f105ade4a84dee930fdc223de80
train_108.jsonl
1650722700
There is an array $$$a$$$ of length $$$n$$$. You may perform the following operation any number of times: Choose two indices $$$l$$$ and $$$r$$$ where $$$1 \le l &lt; r \le n$$$ and $$$a_l = a_r$$$. Then, set $$$a[l \ldots r] = [a_{l+1}, a_{l+2}, \ldots, a_r, a_l]$$$. You are also given another array $$$b$$$ of length...
256 megabytes
import java.util.*; import java.io.*; public class Main { static final int MOD = 1000000007; static InputReader in = new InputReader(System.in); static BufferOutput out = new BufferOutput(); public static void main(String[] args) { for(int i = in.nextInt();i>0;i--) { int n...
Java
["5\n\n5\n\n1 2 3 3 2\n\n1 3 3 2 2\n\n5\n\n1 2 4 2 1\n\n4 2 2 1 1\n\n5\n\n2 4 5 5 2\n\n2 2 4 5 5\n\n3\n\n1 2 3\n\n1 2 3\n\n3\n\n1 1 2\n\n2 1 1"]
1 second
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case, we can choose $$$l=2$$$ and $$$r=5$$$ to form $$$[1, 3, 3, 2, 2]$$$.In the second test case, we can choose $$$l=2$$$ and $$$r=4$$$ to form $$$[1, 4, 2, 2, 1]$$$. Then, we can choose $$$l=1$$$ and $$$r=5$$$ to form $$$[4, 2, 2, 1, 1]$$$.In the third test case, it can be proven that it is not ...
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation", "two pointers" ]
158bd0ab8f4319f5fd1e6062caddad4e
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$)  — the length of array $$$a$$$ and $...
1,700
For each test case, print "YES" (without quotes) if it is possible to transform array $$$a$$$ to $$$b$$$, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
cd5be54a4109cc3a2e7de4e99cf123b9
train_108.jsonl
1650722700
There is an array $$$a$$$ of length $$$n$$$. You may perform the following operation any number of times: Choose two indices $$$l$$$ and $$$r$$$ where $$$1 \le l &lt; r \le n$$$ and $$$a_l = a_r$$$. Then, set $$$a[l \ldots r] = [a_{l+1}, a_{l+2}, \ldots, a_r, a_l]$$$. You are also given another array $$$b$$$ of length...
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.*; /** * * @Har_Har_Mahadev */ /** * Main , Solution , Remove Public */ public class Solution { public static void process() throws IOExc...
Java
["5\n\n5\n\n1 2 3 3 2\n\n1 3 3 2 2\n\n5\n\n1 2 4 2 1\n\n4 2 2 1 1\n\n5\n\n2 4 5 5 2\n\n2 2 4 5 5\n\n3\n\n1 2 3\n\n1 2 3\n\n3\n\n1 1 2\n\n2 1 1"]
1 second
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case, we can choose $$$l=2$$$ and $$$r=5$$$ to form $$$[1, 3, 3, 2, 2]$$$.In the second test case, we can choose $$$l=2$$$ and $$$r=4$$$ to form $$$[1, 4, 2, 2, 1]$$$. Then, we can choose $$$l=1$$$ and $$$r=5$$$ to form $$$[4, 2, 2, 1, 1]$$$.In the third test case, it can be proven that it is not ...
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation", "two pointers" ]
158bd0ab8f4319f5fd1e6062caddad4e
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$)  — the length of array $$$a$$$ and $...
1,700
For each test case, print "YES" (without quotes) if it is possible to transform array $$$a$$$ to $$$b$$$, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
eef531c1931b2efd97da5c129386ecbb
train_108.jsonl
1650722700
There is an array $$$a$$$ of length $$$n$$$. You may perform the following operation any number of times: Choose two indices $$$l$$$ and $$$r$$$ where $$$1 \le l &lt; r \le n$$$ and $$$a_l = a_r$$$. Then, set $$$a[l \ldots r] = [a_{l+1}, a_{l+2}, \ldots, a_r, a_l]$$$. You are also given another array $$$b$$$ of length...
256 megabytes
import java.util.Scanner; public class MyClass { static Scanner in = new Scanner(System.in); static int testCases, n; static int a[], b[]; static void solve() { int next[] = new int[n + 1]; int count[] = new int[n + 1]; int map[] = new ...
Java
["5\n\n5\n\n1 2 3 3 2\n\n1 3 3 2 2\n\n5\n\n1 2 4 2 1\n\n4 2 2 1 1\n\n5\n\n2 4 5 5 2\n\n2 2 4 5 5\n\n3\n\n1 2 3\n\n1 2 3\n\n3\n\n1 1 2\n\n2 1 1"]
1 second
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case, we can choose $$$l=2$$$ and $$$r=5$$$ to form $$$[1, 3, 3, 2, 2]$$$.In the second test case, we can choose $$$l=2$$$ and $$$r=4$$$ to form $$$[1, 4, 2, 2, 1]$$$. Then, we can choose $$$l=1$$$ and $$$r=5$$$ to form $$$[4, 2, 2, 1, 1]$$$.In the third test case, it can be proven that it is not ...
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation", "two pointers" ]
158bd0ab8f4319f5fd1e6062caddad4e
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$)  — the length of array $$$a$$$ and $...
1,700
For each test case, print "YES" (without quotes) if it is possible to transform array $$$a$$$ to $$$b$$$, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
7ad0d438b9ceb8bcc2b8c1d0dc0990cd
train_108.jsonl
1650722700
There is an array $$$a$$$ of length $$$n$$$. You may perform the following operation any number of times: Choose two indices $$$l$$$ and $$$r$$$ where $$$1 \le l &lt; r \le n$$$ and $$$a_l = a_r$$$. Then, set $$$a[l \ldots r] = [a_{l+1}, a_{l+2}, \ldots, a_r, a_l]$$$. You are also given another array $$$b$$$ of length...
256 megabytes
import java.util.Scanner; import java.util.Map; import java.util.HashMap; public class MyClass { static Scanner in = new Scanner(System.in); static int testCases, n; static int a[], b[]; static void solve() { Map<Integer, Integer> map = new HashMap<>()...
Java
["5\n\n5\n\n1 2 3 3 2\n\n1 3 3 2 2\n\n5\n\n1 2 4 2 1\n\n4 2 2 1 1\n\n5\n\n2 4 5 5 2\n\n2 2 4 5 5\n\n3\n\n1 2 3\n\n1 2 3\n\n3\n\n1 1 2\n\n2 1 1"]
1 second
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case, we can choose $$$l=2$$$ and $$$r=5$$$ to form $$$[1, 3, 3, 2, 2]$$$.In the second test case, we can choose $$$l=2$$$ and $$$r=4$$$ to form $$$[1, 4, 2, 2, 1]$$$. Then, we can choose $$$l=1$$$ and $$$r=5$$$ to form $$$[4, 2, 2, 1, 1]$$$.In the third test case, it can be proven that it is not ...
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation", "two pointers" ]
158bd0ab8f4319f5fd1e6062caddad4e
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$)  — the length of array $$$a$$$ and $...
1,700
For each test case, print "YES" (without quotes) if it is possible to transform array $$$a$$$ to $$$b$$$, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
83f2c936a2247be102ea01831b9db942
train_108.jsonl
1650722700
There is an array $$$a$$$ of length $$$n$$$. You may perform the following operation any number of times: Choose two indices $$$l$$$ and $$$r$$$ where $$$1 \le l &lt; r \le n$$$ and $$$a_l = a_r$$$. Then, set $$$a[l \ldots r] = [a_{l+1}, a_{l+2}, \ldots, a_r, a_l]$$$. You are also given another array $$$b$$$ of length...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args)throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw=new PrintWriter(System.out); int t=Integer.parseInt(br.readLine()); while(t-->0) ...
Java
["5\n\n5\n\n1 2 3 3 2\n\n1 3 3 2 2\n\n5\n\n1 2 4 2 1\n\n4 2 2 1 1\n\n5\n\n2 4 5 5 2\n\n2 2 4 5 5\n\n3\n\n1 2 3\n\n1 2 3\n\n3\n\n1 1 2\n\n2 1 1"]
1 second
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case, we can choose $$$l=2$$$ and $$$r=5$$$ to form $$$[1, 3, 3, 2, 2]$$$.In the second test case, we can choose $$$l=2$$$ and $$$r=4$$$ to form $$$[1, 4, 2, 2, 1]$$$. Then, we can choose $$$l=1$$$ and $$$r=5$$$ to form $$$[4, 2, 2, 1, 1]$$$.In the third test case, it can be proven that it is not ...
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation", "two pointers" ]
158bd0ab8f4319f5fd1e6062caddad4e
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$)  — the length of array $$$a$$$ and $...
1,700
For each test case, print "YES" (without quotes) if it is possible to transform array $$$a$$$ to $$$b$$$, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
17054701acf43afdf6d60c4fda2c5d76
train_108.jsonl
1650722700
There is an array $$$a$$$ of length $$$n$$$. You may perform the following operation any number of times: Choose two indices $$$l$$$ and $$$r$$$ where $$$1 \le l &lt; r \le n$$$ and $$$a_l = a_r$$$. Then, set $$$a[l \ldots r] = [a_{l+1}, a_{l+2}, \ldots, a_r, a_l]$$$. You are also given another array $$$b$$$ of length...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; import static java.lang.Math.*; public class Codeforces { static int MAX = Integer.MAX_VALUE,MIN = Integer.MIN_VALUE; static long MAXL = Long.MAX_VALUE,MINL = Long.MIN_VALUE,MOD = (int)1e9+7; static void solve() { int n = fs.nIn...
Java
["5\n\n5\n\n1 2 3 3 2\n\n1 3 3 2 2\n\n5\n\n1 2 4 2 1\n\n4 2 2 1 1\n\n5\n\n2 4 5 5 2\n\n2 2 4 5 5\n\n3\n\n1 2 3\n\n1 2 3\n\n3\n\n1 1 2\n\n2 1 1"]
1 second
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case, we can choose $$$l=2$$$ and $$$r=5$$$ to form $$$[1, 3, 3, 2, 2]$$$.In the second test case, we can choose $$$l=2$$$ and $$$r=4$$$ to form $$$[1, 4, 2, 2, 1]$$$. Then, we can choose $$$l=1$$$ and $$$r=5$$$ to form $$$[4, 2, 2, 1, 1]$$$.In the third test case, it can be proven that it is not ...
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation", "two pointers" ]
158bd0ab8f4319f5fd1e6062caddad4e
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$)  — the length of array $$$a$$$ and $...
1,700
For each test case, print "YES" (without quotes) if it is possible to transform array $$$a$$$ to $$$b$$$, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
58b70056428ae6ab0d324a19cfbb8c89
train_108.jsonl
1650722700
There is an array $$$a$$$ of length $$$n$$$. You may perform the following operation any number of times: Choose two indices $$$l$$$ and $$$r$$$ where $$$1 \le l &lt; r \le n$$$ and $$$a_l = a_r$$$. Then, set $$$a[l \ldots r] = [a_{l+1}, a_{l+2}, \ldots, a_r, a_l]$$$. You are also given another array $$$b$$$ of length...
256 megabytes
import java.io.*; import java.util.*; public class D { public static void main(String[] args) { new D().run(); } BufferedReader br; PrintWriter out; int mod = (int) (1e9 + 7), inf = (int) (1e9); class pair { int F, S; pair(int f, int s) { ...
Java
["5\n\n5\n\n1 2 3 3 2\n\n1 3 3 2 2\n\n5\n\n1 2 4 2 1\n\n4 2 2 1 1\n\n5\n\n2 4 5 5 2\n\n2 2 4 5 5\n\n3\n\n1 2 3\n\n1 2 3\n\n3\n\n1 1 2\n\n2 1 1"]
1 second
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case, we can choose $$$l=2$$$ and $$$r=5$$$ to form $$$[1, 3, 3, 2, 2]$$$.In the second test case, we can choose $$$l=2$$$ and $$$r=4$$$ to form $$$[1, 4, 2, 2, 1]$$$. Then, we can choose $$$l=1$$$ and $$$r=5$$$ to form $$$[4, 2, 2, 1, 1]$$$.In the third test case, it can be proven that it is not ...
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation", "two pointers" ]
158bd0ab8f4319f5fd1e6062caddad4e
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$)  — the length of array $$$a$$$ and $...
1,700
For each test case, print "YES" (without quotes) if it is possible to transform array $$$a$$$ to $$$b$$$, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
749889a1a3dc404dda747c52821e9268
train_108.jsonl
1650722700
There is an array $$$a$$$ of length $$$n$$$. You may perform the following operation any number of times: Choose two indices $$$l$$$ and $$$r$$$ where $$$1 \le l &lt; r \le n$$$ and $$$a_l = a_r$$$. Then, set $$$a[l \ldots r] = [a_{l+1}, a_{l+2}, \ldots, a_r, a_l]$$$. You are also given another array $$$b$$$ of length...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Codechef { public static void main (String[] args) throws java.lang.Exception { try{ FastReader read=new FastReader(); StringBuilder sb = new StringBuilder(); int t=read.nextInt(); while(t>0) { ...
Java
["5\n\n5\n\n1 2 3 3 2\n\n1 3 3 2 2\n\n5\n\n1 2 4 2 1\n\n4 2 2 1 1\n\n5\n\n2 4 5 5 2\n\n2 2 4 5 5\n\n3\n\n1 2 3\n\n1 2 3\n\n3\n\n1 1 2\n\n2 1 1"]
1 second
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case, we can choose $$$l=2$$$ and $$$r=5$$$ to form $$$[1, 3, 3, 2, 2]$$$.In the second test case, we can choose $$$l=2$$$ and $$$r=4$$$ to form $$$[1, 4, 2, 2, 1]$$$. Then, we can choose $$$l=1$$$ and $$$r=5$$$ to form $$$[4, 2, 2, 1, 1]$$$.In the third test case, it can be proven that it is not ...
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation", "two pointers" ]
158bd0ab8f4319f5fd1e6062caddad4e
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$)  — the length of array $$$a$$$ and $...
1,700
For each test case, print "YES" (without quotes) if it is possible to transform array $$$a$$$ to $$$b$$$, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
a26cef55b9b3555a6c5d4cea88723c9c
train_108.jsonl
1650722700
There is an array $$$a$$$ of length $$$n$$$. You may perform the following operation any number of times: Choose two indices $$$l$$$ and $$$r$$$ where $$$1 \le l &lt; r \le n$$$ and $$$a_l = a_r$$$. Then, set $$$a[l \ldots r] = [a_{l+1}, a_{l+2}, \ldots, a_r, a_l]$$$. You are also given another array $$$b$$$ of length...
256 megabytes
import java.awt.datatransfer.StringSelection; import java.util.*; import javax.management.Query; import java.io.*; public class practice { static String s; static HashMap<Long,Integer>hm; public static void main(String[] args) throws Exception { Scanner sc=new Scanner(System.in); ...
Java
["5\n\n5\n\n1 2 3 3 2\n\n1 3 3 2 2\n\n5\n\n1 2 4 2 1\n\n4 2 2 1 1\n\n5\n\n2 4 5 5 2\n\n2 2 4 5 5\n\n3\n\n1 2 3\n\n1 2 3\n\n3\n\n1 1 2\n\n2 1 1"]
1 second
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case, we can choose $$$l=2$$$ and $$$r=5$$$ to form $$$[1, 3, 3, 2, 2]$$$.In the second test case, we can choose $$$l=2$$$ and $$$r=4$$$ to form $$$[1, 4, 2, 2, 1]$$$. Then, we can choose $$$l=1$$$ and $$$r=5$$$ to form $$$[4, 2, 2, 1, 1]$$$.In the third test case, it can be proven that it is not ...
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation", "two pointers" ]
158bd0ab8f4319f5fd1e6062caddad4e
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$)  — the length of array $$$a$$$ and $...
1,700
For each test case, print "YES" (without quotes) if it is possible to transform array $$$a$$$ to $$$b$$$, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
678d292c1eb63dc47f023208d012b9fc
train_108.jsonl
1650722700
There is an array $$$a$$$ of length $$$n$$$. You may perform the following operation any number of times: Choose two indices $$$l$$$ and $$$r$$$ where $$$1 \le l &lt; r \le n$$$ and $$$a_l = a_r$$$. Then, set $$$a[l \ldots r] = [a_{l+1}, a_{l+2}, \ldots, a_r, a_l]$$$. You are also given another array $$$b$$$ of length...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.util.Locale; import java.util.StringTokenizer; public class Solution imple...
Java
["5\n\n5\n\n1 2 3 3 2\n\n1 3 3 2 2\n\n5\n\n1 2 4 2 1\n\n4 2 2 1 1\n\n5\n\n2 4 5 5 2\n\n2 2 4 5 5\n\n3\n\n1 2 3\n\n1 2 3\n\n3\n\n1 1 2\n\n2 1 1"]
1 second
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case, we can choose $$$l=2$$$ and $$$r=5$$$ to form $$$[1, 3, 3, 2, 2]$$$.In the second test case, we can choose $$$l=2$$$ and $$$r=4$$$ to form $$$[1, 4, 2, 2, 1]$$$. Then, we can choose $$$l=1$$$ and $$$r=5$$$ to form $$$[4, 2, 2, 1, 1]$$$.In the third test case, it can be proven that it is not ...
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation", "two pointers" ]
158bd0ab8f4319f5fd1e6062caddad4e
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$)  — the length of array $$$a$$$ and $...
1,700
For each test case, print "YES" (without quotes) if it is possible to transform array $$$a$$$ to $$$b$$$, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
1dc53210b8aea97fa3beb7ecf6b9d4ca
train_108.jsonl
1650722700
There is an array $$$a$$$ of length $$$n$$$. You may perform the following operation any number of times: Choose two indices $$$l$$$ and $$$r$$$ where $$$1 \le l &lt; r \le n$$$ and $$$a_l = a_r$$$. Then, set $$$a[l \ldots r] = [a_{l+1}, a_{l+2}, \ldots, a_r, a_l]$$$. You are also given another array $$$b$$$ of length...
256 megabytes
import java.util.*; import java.io.*; public class myclass { 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[] =...
Java
["5\n\n5\n\n1 2 3 3 2\n\n1 3 3 2 2\n\n5\n\n1 2 4 2 1\n\n4 2 2 1 1\n\n5\n\n2 4 5 5 2\n\n2 2 4 5 5\n\n3\n\n1 2 3\n\n1 2 3\n\n3\n\n1 1 2\n\n2 1 1"]
1 second
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case, we can choose $$$l=2$$$ and $$$r=5$$$ to form $$$[1, 3, 3, 2, 2]$$$.In the second test case, we can choose $$$l=2$$$ and $$$r=4$$$ to form $$$[1, 4, 2, 2, 1]$$$. Then, we can choose $$$l=1$$$ and $$$r=5$$$ to form $$$[4, 2, 2, 1, 1]$$$.In the third test case, it can be proven that it is not ...
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation", "two pointers" ]
158bd0ab8f4319f5fd1e6062caddad4e
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$)  — the length of array $$$a$$$ and $...
1,700
For each test case, print "YES" (without quotes) if it is possible to transform array $$$a$$$ to $$$b$$$, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
43351c2123f442a7eb852115ef89fd35
train_108.jsonl
1650722700
There is an array $$$a$$$ of length $$$n$$$. You may perform the following operation any number of times: Choose two indices $$$l$$$ and $$$r$$$ where $$$1 \le l &lt; r \le n$$$ and $$$a_l = a_r$$$. Then, set $$$a[l \ldots r] = [a_{l+1}, a_{l+2}, \ldots, a_r, a_l]$$$. You are also given another array $$$b$$$ of length...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class AACFCC { // public static long mod = (long) Math.pow(10, 9) + 7; public static long mod2 = 998244353; public int oo = 0; // public static HashMap<Integer, Integer> primenom; // public static...
Java
["5\n\n5\n\n1 2 3 3 2\n\n1 3 3 2 2\n\n5\n\n1 2 4 2 1\n\n4 2 2 1 1\n\n5\n\n2 4 5 5 2\n\n2 2 4 5 5\n\n3\n\n1 2 3\n\n1 2 3\n\n3\n\n1 1 2\n\n2 1 1"]
1 second
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case, we can choose $$$l=2$$$ and $$$r=5$$$ to form $$$[1, 3, 3, 2, 2]$$$.In the second test case, we can choose $$$l=2$$$ and $$$r=4$$$ to form $$$[1, 4, 2, 2, 1]$$$. Then, we can choose $$$l=1$$$ and $$$r=5$$$ to form $$$[4, 2, 2, 1, 1]$$$.In the third test case, it can be proven that it is not ...
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation", "two pointers" ]
158bd0ab8f4319f5fd1e6062caddad4e
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$)  — the length of array $$$a$$$ and $...
1,700
For each test case, print "YES" (without quotes) if it is possible to transform array $$$a$$$ to $$$b$$$, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
7b5a4d6ae892ca8d3bd0b9bab1ce0e38
train_108.jsonl
1650722700
There is an array $$$a$$$ of length $$$n$$$. You may perform the following operation any number of times: Choose two indices $$$l$$$ and $$$r$$$ where $$$1 \le l &lt; r \le n$$$ and $$$a_l = a_r$$$. Then, set $$$a[l \ldots r] = [a_{l+1}, a_{l+2}, \ldots, a_r, a_l]$$$. You are also given another array $$$b$$$ of length...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class D { static byte[] buf = new byte[1<<26]; static int bp = -1; public static void main(String[] args) throws IOException { /**/ DataInputStream in = new DataInputStream(System.in); /*/ DataInputStream in = new DataInput...
Java
["5\n\n5\n\n1 2 3 3 2\n\n1 3 3 2 2\n\n5\n\n1 2 4 2 1\n\n4 2 2 1 1\n\n5\n\n2 4 5 5 2\n\n2 2 4 5 5\n\n3\n\n1 2 3\n\n1 2 3\n\n3\n\n1 1 2\n\n2 1 1"]
1 second
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case, we can choose $$$l=2$$$ and $$$r=5$$$ to form $$$[1, 3, 3, 2, 2]$$$.In the second test case, we can choose $$$l=2$$$ and $$$r=4$$$ to form $$$[1, 4, 2, 2, 1]$$$. Then, we can choose $$$l=1$$$ and $$$r=5$$$ to form $$$[4, 2, 2, 1, 1]$$$.In the third test case, it can be proven that it is not ...
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation", "two pointers" ]
158bd0ab8f4319f5fd1e6062caddad4e
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$)  — the length of array $$$a$$$ and $...
1,700
For each test case, print "YES" (without quotes) if it is possible to transform array $$$a$$$ to $$$b$$$, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
standard output
PASSED
f524faa9030766bb9eded20031964384
train_108.jsonl
1650722700
You have a binary string $$$a$$$ of length $$$n$$$ consisting only of digits $$$0$$$ and $$$1$$$. You are given $$$q$$$ queries. In the $$$i$$$-th query, you are given two indices $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$. Let $$$s=a[l,r]$$$. You are allowed to do the following operation on $$$s$$$: Choo...
256 megabytes
import java.util.*; import java.io.*; // you can compare with output.txt and expected out public class RoundGlobal20H { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final static String IMPOSSIBLE = "IMPOSSIBLE"; ...
Java
["5 3\n11011\n2 4\n1 5\n3 5", "10 3\n1001110110\n1 10\n2 5\n5 10"]
1 second
["1\n3\n2", "4\n2\n3"]
NoteIn the first test case, The substring is $$$\texttt{101}$$$, so we can do one operation to make the substring empty. The substring is $$$\texttt{11011}$$$, so we can do one operation on $$$s[2, 4]$$$ to make $$$\texttt{11}$$$, then use two more operations to make the substring empty. The substring is $$$\texttt...
Java 17
standard input
[ "constructive algorithms", "data structures", "greedy" ]
d1c3b8985d0c17e0806117bef30d7ff2
The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 2 \cdot 10 ^ 5$$$)  — the length of the binary string $$$a$$$ and the number of queries respectively. The second line contains a binary string $$$a$$$ of length $$$n$$$ ($$$a_i \in \{0, 1\}$$$). Each of the next $$$q$$$ lines contains two integ...
2,700
Print $$$q$$$ lines, the $$$i$$$-th line representing the minimum number of operations needed for the $$$i$$$-th query.
standard output
PASSED
76004ac7b6b3076ddb0bf3a6427bc1b4
train_108.jsonl
1650722700
You have a binary string $$$a$$$ of length $$$n$$$ consisting only of digits $$$0$$$ and $$$1$$$. You are given $$$q$$$ queries. In the $$$i$$$-th query, you are given two indices $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$. Let $$$s=a[l,r]$$$. You are allowed to do the following operation on $$$s$$$: Choo...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["5 3\n11011\n2 4\n1 5\n3 5", "10 3\n1001110110\n1 10\n2 5\n5 10"]
1 second
["1\n3\n2", "4\n2\n3"]
NoteIn the first test case, The substring is $$$\texttt{101}$$$, so we can do one operation to make the substring empty. The substring is $$$\texttt{11011}$$$, so we can do one operation on $$$s[2, 4]$$$ to make $$$\texttt{11}$$$, then use two more operations to make the substring empty. The substring is $$$\texttt...
Java 11
standard input
[ "constructive algorithms", "data structures", "greedy" ]
d1c3b8985d0c17e0806117bef30d7ff2
The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 2 \cdot 10 ^ 5$$$)  — the length of the binary string $$$a$$$ and the number of queries respectively. The second line contains a binary string $$$a$$$ of length $$$n$$$ ($$$a_i \in \{0, 1\}$$$). Each of the next $$$q$$$ lines contains two integ...
2,700
Print $$$q$$$ lines, the $$$i$$$-th line representing the minimum number of operations needed for the $$$i$$$-th query.
standard output
PASSED
aea82d2887f5276776ccc0f5fd755a57
train_108.jsonl
1650722700
You have a binary string $$$a$$$ of length $$$n$$$ consisting only of digits $$$0$$$ and $$$1$$$. You are given $$$q$$$ queries. In the $$$i$$$-th query, you are given two indices $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$. Let $$$s=a[l,r]$$$. You are allowed to do the following operation on $$$s$$$: Choo...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class H { FastScanner in; PrintWriter out; boolean systemIO = true; public class DSU { int[] sz; int[] p; public DSU(int n) { sz = new int[n]; p = new int[n]; for (int i = 0; i < p.length; i++) { p[i] = ...
Java
["5 3\n11011\n2 4\n1 5\n3 5", "10 3\n1001110110\n1 10\n2 5\n5 10"]
1 second
["1\n3\n2", "4\n2\n3"]
NoteIn the first test case, The substring is $$$\texttt{101}$$$, so we can do one operation to make the substring empty. The substring is $$$\texttt{11011}$$$, so we can do one operation on $$$s[2, 4]$$$ to make $$$\texttt{11}$$$, then use two more operations to make the substring empty. The substring is $$$\texttt...
Java 8
standard input
[ "constructive algorithms", "data structures", "greedy" ]
d1c3b8985d0c17e0806117bef30d7ff2
The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 2 \cdot 10 ^ 5$$$)  — the length of the binary string $$$a$$$ and the number of queries respectively. The second line contains a binary string $$$a$$$ of length $$$n$$$ ($$$a_i \in \{0, 1\}$$$). Each of the next $$$q$$$ lines contains two integ...
2,700
Print $$$q$$$ lines, the $$$i$$$-th line representing the minimum number of operations needed for the $$$i$$$-th query.
standard output
PASSED
697b18a2ea306b9ee9a5ab5667c7d30f
train_108.jsonl
1650722700
You have a binary string $$$a$$$ of length $$$n$$$ consisting only of digits $$$0$$$ and $$$1$$$. You are given $$$q$$$ queries. In the $$$i$$$-th query, you are given two indices $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$. Let $$$s=a[l,r]$$$. You are allowed to do the following operation on $$$s$$$: Choo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Random; import java.util.StringTokenizer; /* */ public class H { public stat...
Java
["5 3\n11011\n2 4\n1 5\n3 5", "10 3\n1001110110\n1 10\n2 5\n5 10"]
1 second
["1\n3\n2", "4\n2\n3"]
NoteIn the first test case, The substring is $$$\texttt{101}$$$, so we can do one operation to make the substring empty. The substring is $$$\texttt{11011}$$$, so we can do one operation on $$$s[2, 4]$$$ to make $$$\texttt{11}$$$, then use two more operations to make the substring empty. The substring is $$$\texttt...
Java 8
standard input
[ "constructive algorithms", "data structures", "greedy" ]
d1c3b8985d0c17e0806117bef30d7ff2
The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 2 \cdot 10 ^ 5$$$)  — the length of the binary string $$$a$$$ and the number of queries respectively. The second line contains a binary string $$$a$$$ of length $$$n$$$ ($$$a_i \in \{0, 1\}$$$). Each of the next $$$q$$$ lines contains two integ...
2,700
Print $$$q$$$ lines, the $$$i$$$-th line representing the minimum number of operations needed for the $$$i$$$-th query.
standard output
PASSED
9a593097a6936cdce96cfeac90fe32a9
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import javax.swing.*; import java.lang.reflect.Array; import java.text.DecimalFormat; import java.util.*; import java.lang.*; import java.io.*; import java.math.*; import java.util.stream.Stream; // Please name your class Main public class Main { static FastScanner fs=new FastScanner(); ...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
76adefde61139091c018e011dc215c9e
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.*; import java.util.*; public class ArrayShuffling { private static final int START_TEST_CASE = 1; public static void solveCase(FastIO io, int testCase) { final int N = io.nextInt(); final int[] A = io.nextIntArray(N); IntQueue[] queues = new IntQueue[N + 1]; for (int i = 0; i ...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
051cdb8efef508662ab185424e1a9b92
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.*; import java.util.*; public class ArrayShuffling { private static final int START_TEST_CASE = 1; public static void solveCase(FastIO io, int testCase) { final int N = io.nextInt(); final int[] A = io.nextIntArray(N); IntQueue[] queues = new IntQueue[N + 1]; for (int i = 0; i ...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
558b06d439dc3df26fc2ea5a61135b4a
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.*; import java.util.*; public class ArrayShuffling { private static final int START_TEST_CASE = 1; public static void solveCase(FastIO io, int testCase) { final int N = io.nextInt(); final int[] A = io.nextIntArray(N); IntQueue[] queues = new IntQueue[N + 1]; for (int i = 0; i ...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
ba8b6b1e6cd9d89e2977a1d8cb72bd4c
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class ArrayShuffling { private static final int START_TEST_CASE = 1; public static void solveCase(FastIO io, int testCase) { final int N = io.nextInt(); final int[] A = io.nextIntArray(N); // int[] freq = new int[N + 1]; // for (...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
8f0a50e7fe70f702807a15babd882b0a
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
/* I am dead inside Do you like NCT, sKz, BTS? 5 4 3 2 1 Moonwalk Imma knock it down like domino Is this what you want? Is this what you want? Let's ttalkbocky about that */ import static java.lang.Math.*; import java.util.*; import java.io.*; public class ArrayShuffling { public static void main(St...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
6d64f65f31449c000829643627db2a27
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.*; import java.util.*; public class Main { //--------------------------INPUT READER---------------------------------// static class fs { public BufferedReader br; StringTokenizer st = new StringTokenizer(""); public fs() { this(System.in); } public fs(I...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
058b0ac0223d8f96d36d6276c535fe90
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.util.*; import java.io.*; // cd C:\Users\Lenovo\Desktop\New //ArrayList<Integer> a=new ArrayList<>(); //List<Integer> lis=new ArrayList<>(); //StringBuilder ans = new StringBuilder(); //HashMap<Integer,Integer> map=new HashMap<>(); ...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
1fa226cc1d8cbe1c44b3e1537e35e43b
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.*; import java.util.*; public final class Main { //int 2e9 - long 9e18 static PrintWriter out = new PrintWriter(System.out); static FastReader in = new FastReader(); static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(0, 1), new Pair(1, 0), new Pair(0, -1)}; static...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
f63fd0d7de5451d41bb6503c50d2277a
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.*; import java.util.*; public class problemF1 { public static void main(String[] args)throws IOException { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(Syste...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
56a2e843763866c15f2e6420c55f285f
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.util.*; import java.io.*; // res.append("Case #"+(p+1)+": "+hh+" \n"); ////*************************************************************************** /* public class E_Gardener_and_Tree implements Runnable{ public static void main(String[] args) throws Exception { new Thr...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
72c9d4700479981c386465641d2eac17
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.*; import java.util.*; //import javafx.util.*; public class Main { static PrintWriter out = new PrintWriter(System.out); static FastReader in = new FastReader(); static int INF = Integer.MAX_VALUE; static int NINF = Integer.MIN_VALUE; public static StringBuilder str = new Stri...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
e1a064f1dad817a3127c025d963ca8b1
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class AACFCC { // public static long mod = (long) Math.pow(10, 9) + 7; public static long mod2 = 998244353; public int oo = 0; // public static HashMap<Integer, Integer...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
dcaf33dc1e2970e8cccd20cd5b215515
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Random; import java.util.StringTokenizer; /* */ publi...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
477a244b162db29a0c8af39a410d92e2
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class F1 { public static void main(String[] args) throws IOException { /**/ Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in))); /*/ Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(new File...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
e3edd1f8c831c42253368e95e23d5a78
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.util.*; import java.io.*; public class Main { static ContestScanner sc = new ContestScanner(System.in); static PrintWriter pw = new PrintWriter(System.out); static StringBuilder sb = new StringBuilder(); static long mod = (long) 1e9 + 7; public static void main(String[] args) ...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
ce4d4af437fc5aba65d2cfe24e9cd3b0
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.*; import java.util.ArrayDeque; import java.util.Arrays; import java.util.InputMismatchException; public class E1672F1 { public static void main(String[] args) { FastIO io = new FastIO(); int t = io.nextInt(); while (t-- > 0) { int n = io.nextInt(); ...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
42e191faf75f758c62e25f1aaf486a34
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.util.*; import java.io.*; // you can compare with output.txt and expected out public class RoundGlobal20F1 { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final static String IMPOSSIBLE = "IMPOSSIBLE"; ...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
8a0fce71e991dd8f0ec5f86b95676723
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
/** * @description: 比赛 * @author: dzx * @date: 2022/4/20 */ import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; FastScanner in = new FastScanner(in...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
fba7127ba3286e0c6e4d887ef0826fa7
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
//Utilities import java.io.*; import java.util.*; public class a { static int t; static int n; static int[] a, res; public static void main(String[] args) throws IOException { t = in.iscan(); while (t-- > 0) { n = in.iscan(); a = new int[n]; res = new int[n]; Stack<Integer>[] idxStack =...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
0196100b5d9911826227db21c0f1d84b
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
//some updates in import stuff import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; //key points learned //max space ever that could be alloted in a program to pass in cf //int[][] prefixSum = new int[...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
af5e3d1cb87035cbf3d1396d576f456f
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.util.*; /* 6 4 3 4 3 6 6 */ public class F1 { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { // TODO Auto-generated method stub int testCases = sc.nextInt(); for (int i = 1; i <= testCases; ++i) { solve(i); } } private stat...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
91cfd7879de72e1bc92c71f516e374f9
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.*; import java.util.*; import java.util.concurrent.ThreadLocalRandom; import java.math.*; /** _ _ ( _) ( _) / / \\ / /\_\_ / / \\ / / | \ \ / / \\ / / |\ \ \ / / , \ , / / /| \ \ / / |\_ /| /...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
2be29065606741f6c044bdf167574d8e
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
// JAI SHREE RAM, HAR HAR MAHADEV, HARE KRISHNA import java.util.*; import java.util.Map.Entry; import java.util.stream.*; import java.lang.*; import java.math.BigInteger; import java.text.DecimalFormat; import java.io.*; public class CodeForces { static private final String INPUT = "input.txt"; s...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
1e0150b57e9af17e14975f03483fa752
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.Queue; import java.util.TreeMap; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
b629267f8e92c9dd68d22caaaebfe575
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.*; import java.util.*; public class Codeforces { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); int t=Integer.parseInt(bu.readLine()); ...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
aa6e3139b57230d69baf357781dda1bd
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.*; import java.util.*; import java.util.concurrent.ThreadLocalRandom; import java.math.*; /** _ _ ( _) ( _) / / \\ / /\_\_ / / \\ / / | \ \ / / \\ / / |\ \ \ / / , \ , / / /| \ \ / / |\_ /| /...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
3184f7fa369d19b804d1e3b223e8892c
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.*; import java.util.*; public class Codeforces { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); int t=Integer.parseInt(bu.readLine()); ...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
948c25c52a02c797c512303d847cd8a1
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
// package c1672; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.lang.invoke.MethodHandles; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.uti...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
1f5cfbf4a38cec3596998c96d97a0bfa
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.System.exit; import static java.util.Arrays.fill; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public ...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
7f8705ec63957767587fd4e18fc6ea7a
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import java.io.BufferedReader; impo...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
045dbef44e5d59efb8db2ba8b951bb27
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.BufferedReader; import java.io.Closeable; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.time.Clock; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; imp...
Java
["2\n\n2\n\n2 1\n\n4\n\n1 2 3 3"]
1 second
["1 2\n3 3 2 1"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy" ]
01703877719e19dd8551e4599c3e1c85
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,000
For each test case, print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — describing the array $$$b$$$. If there are multiple answers, you may print any.
standard output
PASSED
38eb7e9518f93a98c325c8e5303d140b
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.util.*; import java.io.*; // you can compare with output.txt and expected out public class RoundGlobal20F2 { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final static String IMPOSSIBLE = "IMPOSSIBLE"; ...
Java
["4\n\n2\n\n2 1\n\n1 2\n\n4\n\n1 2 3 3\n\n3 3 2 1\n\n2\n\n2 1\n\n2 1\n\n4\n\n1 2 3 3\n\n3 2 3 1"]
1 second
["AC\nAC\nWA\nWA"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "dfs and similar", "graphs" ]
a8f7f64db8fdf42294909774884bec96
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,800
For each test case, print "AC" (without quotes) if $$$b$$$ has the maximum sadness over all permutations of $$$a$$$, and "WA" (without quotes) otherwise.
standard output
PASSED
b0bbaac88d6154ff1a2a826954936983
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper...
Java
["4\n\n2\n\n2 1\n\n1 2\n\n4\n\n1 2 3 3\n\n3 3 2 1\n\n2\n\n2 1\n\n2 1\n\n4\n\n1 2 3 3\n\n3 2 3 1"]
1 second
["AC\nAC\nWA\nWA"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "dfs and similar", "graphs" ]
a8f7f64db8fdf42294909774884bec96
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,800
For each test case, print "AC" (without quotes) if $$$b$$$ has the maximum sadness over all permutations of $$$a$$$, and "WA" (without quotes) otherwise.
standard output
PASSED
58e07068fc83e6e6c577439b86c8c390
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
import java.io.*; import java.util.*; import java.util.concurrent.ThreadLocalRandom; import java.math.*; /** _ _ ( _) ( _) / / \\ / /\_\_ / / \\ / / | \ \ / / \\ / / |\ \ \ / / , \ , / / /| \ \ / / |\_ /| /...
Java
["4\n\n2\n\n2 1\n\n1 2\n\n4\n\n1 2 3 3\n\n3 3 2 1\n\n2\n\n2 1\n\n2 1\n\n4\n\n1 2 3 3\n\n3 2 3 1"]
1 second
["AC\nAC\nWA\nWA"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 11
standard input
[ "constructive algorithms", "dfs and similar", "graphs" ]
a8f7f64db8fdf42294909774884bec96
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,800
For each test case, print "AC" (without quotes) if $$$b$$$ has the maximum sadness over all permutations of $$$a$$$, and "WA" (without quotes) otherwise.
standard output
PASSED
97bb79587d2631dbfafd9bf1ba679be4
train_108.jsonl
1650722700
oolimry has an array $$$a$$$ of length $$$n$$$ which he really likes. Today, you have changed his array to $$$b$$$, a permutation of $$$a$$$, to make him sad.Because oolimry is only a duck, he can only perform the following operation to restore his array: Choose two integers $$$i,j$$$ such that $$$1 \leq i,j \leq n$$...
256 megabytes
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.Random; import java.util.StringTokenizer; /* 1 6 1 2 3 4 4 4 4 4 4 1 2 3 5 1 2 4 ...
Java
["4\n\n2\n\n2 1\n\n1 2\n\n4\n\n1 2 3 3\n\n3 3 2 1\n\n2\n\n2 1\n\n2 1\n\n4\n\n1 2 3 3\n\n3 2 3 1"]
1 second
["AC\nAC\nWA\nWA"]
NoteIn the first test case, the array $$$[1,2]$$$ has sadness $$$1$$$. We can transform $$$[1,2]$$$ into $$$[2,1]$$$ using one operation with $$$(i,j)=(1,2)$$$.In the second test case, the array $$$[3,3,2,1]$$$ has sadness $$$2$$$. We can transform $$$[3,3,2,1]$$$ into $$$[1,2,3,3]$$$ with two operations with $$$(i,j)=...
Java 8
standard input
[ "constructive algorithms", "dfs and similar", "graphs" ]
a8f7f64db8fdf42294909774884bec96
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$)  — the length of the array. Th...
2,800
For each test case, print "AC" (without quotes) if $$$b$$$ has the maximum sadness over all permutations of $$$a$$$, and "WA" (without quotes) otherwise.
standard output
PASSED
1d01fbd29b895166dd33d827672e8ef9
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.*; import java.util.*; public class RailwaySystem { public static void solve(FastIO io) { io.nextInt(); final int M = io.nextInt(); Edge[] edges = new Edge[M]; for (int i = 0; i < M; ++i) { int id = i + 1; final int L = query(io, M, id); edges[i] = new Edge(id, L); ...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
39e241f4f1044077d4b95f9170921e8d
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.*; import java.util.*; public class RailwaySystem { public static void solve(FastIO io) { io.nextInt(); final int M = io.nextInt(); Edge[] edges = new Edge[M]; for (int i = 0; i < M; ++i) { int id = i + 1; final int L = query(io, M, id); edges[i] = new Edge(id, L); ...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
14b75bdfce502a4b28718d21ddc429ef
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.*; import java.util.*; public class RailwaySystem { public static void solve(FastIO io) { io.nextInt(); final int M = io.nextInt(); Edge[] edges = new Edge[M]; for (int i = 0; i < M; ++i) { int id = i + 1; final int L = query(io, M, id); edges[i] = new Edge(id, L); ...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
af0b0293e4df2f192eef5bae83f51424
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.*; import java.util.*; public class RailwaySystem { public static void solve(FastIO io) { io.nextInt(); final int M = io.nextInt(); Edge[] edges = new Edge[M]; for (int i = 0; i < M; ++i) { int id = i + 1; final int L = query(io, M, id); edges[i] = new Edge(id, L); ...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
6368b5063f5cf593b9f02f7c09000a9d
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.*; import java.util.*; public class RailwaySystem { public static void solve(FastIO io) { io.nextInt(); final int M = io.nextInt(); Edge[] edges = new Edge[M]; for (int i = 0; i < M; ++i) { int id = i + 1; final int L = query(io, M, id); edges[i] = new Edge(id, L); ...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
96d5ad628a4e10ad1c3f900ecb3e6380
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
// OM NAMAH SHIVAY //import jdk.jshell.execution.JdiDefaultExecutionControl; import java.math.BigInteger; import java.util.*; import java.io.*; //import java.util.logging.LogManager; public class Vaibhav { static long bit[]; static boolean prime[]; //static PrintWriter out = new PrintWriter(...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
019f8635a7b817c7e8a1795b3461c106
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.*; import java.util.*; import static java.util.Comparator.*; public class Solution { public static boolean useInFile = false; public static boolean useOutFile = false; public static void main(String args[]) throws IOException { InOut inout = new InOut(); Resolv...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
da1ceb7cac8ff6b854a9a4001b3a25df
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
/* I am dead inside Do you like NCT, sKz, BTS? 5 4 3 2 1 Moonwalk Imma knock it down like domino Is this what you want? Is this what you want? Let's ttalkbocky about that :() */ import static java.lang.Math.*; import java.util.*; import java.io.*; public class x1687B { public static void main(String...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
9f3715569bb8574c91ae17eb41af6144
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); Task solver = new Task(); solver.solve(1, in...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
2468b04a8cc62a0ae0821c93088e12b9
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.util.*; import java.io.*; // res.append("Case #"+(p+1)+": "+hh+" \n"); ////*************************************************************************** /* public class E_Gardener_and_Tree implements Runnable{ public static void main(String[] args) throws Exception { new Thr...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
a67ce933194fb9ff249f30ecde2a634c
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.*; import java.util.*; //import org.graalvm.compiler.core.common.Fields.ObjectTransformer; import java.math.*; import java.math.BigInteger; public final class A { static PrintWriter out = new PrintWriter(System.out); static StringBuilder ans=new StringBuilder(); static FastReader...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
934ef4b6b96a1ef1c8d4071507aa36f5
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.lang.*; import java.util.*; import java.io.*; import java.math.*; public class Main { public static void deal(int n,int m,MyScanner sc) { char[] ch = new char[m]; Arrays.fill(ch,'0'); int[] a = new int[m]; Integer[] p = new Integer[m]; for(int i=0;i<m...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
34dcffcdba1d184403f645a32c88ad8e
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
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.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.Outpu...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
161f61b571257a2526dcfff98f51cce4
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.util.Arrays; import java.util.Comparator; import java.util.Locale; import j...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
604932e2c4d7b364bfc1461d98020aaf
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.lang.*; import java.util.*; import java.io.*; import java.math.*; public class Main { public static void deal(int n,int m,MyScanner sc) { char[] ch = new char[m]; Arrays.fill(ch,'0'); int[] a = new int[m]; Integer[] p = new Integer[m]; for(int i=0;i<m;...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
2adea0a8cdf361367f5e48db79639122
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.BufferedReader; import java.io.Closeable; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.time.Clock; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Arrays; imp...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
85b3e92035eabea176ae591f6b2fd5ab
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class B { FastScanner in; PrintWriter out; boolean systemIO = true; int mod = 1000000007; public int mult(int x, int y) { return (int) (x * 1L * y % mod); } public int sum(int x, int y) { if (x + y >= mod) { ret...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 8
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
3a4a59b035722fe5c6a7e7e4a7882372
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.util.*; import java.io.*; import java.text.*; public class Main{ //SOLUTION BEGIN void pre() throws Exception{} void solve(int TC) throws Exception { int N = ni(), M = ni(); BitSet b = new BitSet(M); PriorityQueue<int[]> pq = new PriorityQueue<>((int[] i1, int[...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
fcfa10c8b8a70d40b6d5bccac30a6df4
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.*; import java.lang.Math; import java.util.*; import java.util.regex.Pattern; import javax.swing.text.DefaultStyledDocument.ElementSpec; public final class Solution { private static class FastScanner { private final int BUFFER_SIZE = 1 << 16; private DataInputStream din; priv...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
6e3ba0fc074210b3d383e49115623da4
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Comparator; import java.util.stream.IntStream; public class RailwaySystem { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = n...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
ff23b869b1dd166851c9a4824fca78a5
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
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.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.Outpu...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
9beac3f4fad8aabcd4f980aa91d5f693
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
//some updates in import stuff import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; //key points learned //max space ever that could be alloted in a program to pass in cf //int[][] prefixSum = new int[...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
0415fdd43466556d777d0a82d110479f
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.lang.*; import java.util.*; import java.io.*; import java.math.*; public class Main { public static void deal(int n,int m,MyScanner sc) { char[] ch = new char[m]; Arrays.fill(ch,'0'); int[] a = new int[m]; Integer[] p = new Integer[m]; for(int i=0;i<m...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
772c11a8c3718c624a74f6b783dd26de
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
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.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.Outpu...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
2a2498d0b348e6759db9b308eaaebe1d
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Comparator; import java.util.stream.IntStream; public class RailwaySystem { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = n...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
c56aad5c24562d93a3eedaa71b09bce8
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.util.*; import java.io.*; // you can compare with output.txt and expected out public class Round796E { public static MyPrintWriter out; public static MyScanner in; final static String IMPOSSIBLE = "IMPOSSIBLE"; final static String POSSIBLE = "POSSIBLE"; final static String YES = "YES"; f...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 11
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
14cab0f84241e3c7a368fb6ce86e1b30
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.*; import java.util.*; public class B { static class Edge implements Comparable<Edge>{ int id; int val; Edge(int id, int val){ this.id = id; this.val = val; } public int compareTo(Edge e){ return Int...
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 17
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
4959b9ea2ced5daec99b7ba8f9fbb6a9
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.*; import java.util.*; public class B { static class Edge implements Comparable<Edge>{ int id; int val; Edge(int id, int val){ this.id = id; this.val = val; } public int compareTo(Edge e){ return Integer....
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 17
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
b74a73d9da2d9ddd516f2bc87b0f1b9c
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.*; import java.util.*; public class B { static class Edge implements Comparable<Edge>{ int id; int val; Edge(int id, int val){ this.id = id; this.val = val; } public int compareTo(Edge e){ return Integer....
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 17
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
f40ccd7ce7efdc4c01e3118a0d43cc4a
train_108.jsonl
1654266900
As for the technology in the outside world, it is really too advanced for Gensokyo to even look up to.—Yasaka Kanako, Symposium of Post-mysticismThis is an interactive problem.Under the direct supervision of Kanako and the Moriya Shrine, the railway system of Gensokyo is finally finished. GSKR (Gensokyo Railways) consi...
256 megabytes
import java.io.*; import java.util.*; public class B { static class Edge implements Comparable<Edge>{ int id; int val; Edge(int id, int val){ this.id = id; this.val = val; } public int compareTo(Edge e){ return Integer....
Java
["5 4\n\n0\n\n5\n\n9\n\n7"]
1 second
["? 0000\n\n? 1110\n\n? 1111\n\n? 1101\n\n! 7"]
NoteHere is the graph of the example, satisfying $$$l_i=i$$$.
Java 17
standard input
[ "constructive algorithms", "graphs", "greedy", "interactive", "sortings" ]
003b7257b35416ec93f189cb29e458e6
The first and only line of input contains two integers $$$n,m$$$ ($$$2 \leq n \leq 200$$$, $$$1\le m \le 500$$$) — the number of stations and tracks.
1,700
null
standard output
PASSED
711ecef046d62d80c45d6bb577b1c9b7
train_108.jsonl
1654266900
The enchanted forest got its name from the magical mushrooms growing here. They may cause illusions and generally should not be approached.—Perfect Memento in Strict SenseMarisa comes to pick mushrooms in the Enchanted Forest. The Enchanted forest can be represented by $$$n$$$ points on the $$$X$$$-axis numbered $$$1$$...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Practice{ public static void main(String[] args) { TaskA solver = new TaskA(); // initFac(2*100001); int t = in.nextInt(); for (int i = 1; i <= t ; i++) { solver.solve(i, in, out); ...
Java
["4\n\n5 2\n\n5 6 1 2 3\n\n5 7\n\n5 6 1 2 3\n\n1 2\n\n999999\n\n5 70000\n\n1000000000 1000000000 1000000000 1000000000 1000000000"]
2 seconds
["12\n37\n1000000\n5000349985"]
NoteTest case 1:Marisa can start at $$$x=2$$$. In the first minute, she moves to $$$x=1$$$ and collect $$$5$$$ mushrooms. The number of mushrooms will be $$$[1,7,2,3,4]$$$. In the second minute, she moves to $$$x=2$$$ and collects $$$7$$$ mushrooms. The numbers of mushrooms will be $$$[2,1,3,4,5]$$$. After $$$2$$$ minu...
Java 8
standard input
[ "brute force", "greedy" ]
e092d58ac58e1e41d17be946128234e5
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$, $$$k$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$, $$$1\le k \le 10^9$$$) — t...
1,600
For each test case, print the maximum number of mushrooms Marisa can pick after $$$k$$$ minutes.
standard output
PASSED
97995387e2a4cbe0ff27dae63df56f2a
train_108.jsonl
1654266900
The enchanted forest got its name from the magical mushrooms growing here. They may cause illusions and generally should not be approached.—Perfect Memento in Strict SenseMarisa comes to pick mushrooms in the Enchanted Forest. The Enchanted forest can be represented by $$$n$$$ points on the $$$X$$$-axis numbered $$$1$$...
256 megabytes
import java.util.*; import java.util.concurrent.LinkedBlockingDeque; import javax.print.attribute.IntegerSyntax; import javax.sql.rowset.spi.SyncResolver; import java.io.*; import java.nio.channels.NonReadableChannelException; import java.text.DateFormatSymbols; import static java.lang.System.*; public ...
Java
["4\n\n5 2\n\n5 6 1 2 3\n\n5 7\n\n5 6 1 2 3\n\n1 2\n\n999999\n\n5 70000\n\n1000000000 1000000000 1000000000 1000000000 1000000000"]
2 seconds
["12\n37\n1000000\n5000349985"]
NoteTest case 1:Marisa can start at $$$x=2$$$. In the first minute, she moves to $$$x=1$$$ and collect $$$5$$$ mushrooms. The number of mushrooms will be $$$[1,7,2,3,4]$$$. In the second minute, she moves to $$$x=2$$$ and collects $$$7$$$ mushrooms. The numbers of mushrooms will be $$$[2,1,3,4,5]$$$. After $$$2$$$ minu...
Java 8
standard input
[ "brute force", "greedy" ]
e092d58ac58e1e41d17be946128234e5
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$, $$$k$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$, $$$1\le k \le 10^9$$$) — t...
1,600
For each test case, print the maximum number of mushrooms Marisa can pick after $$$k$$$ minutes.
standard output
PASSED
26fc7c4fbf84a34f2b2f3293aa09384b
train_108.jsonl
1654266900
The enchanted forest got its name from the magical mushrooms growing here. They may cause illusions and generally should not be approached.—Perfect Memento in Strict SenseMarisa comes to pick mushrooms in the Enchanted Forest. The Enchanted forest can be represented by $$$n$$$ points on the $$$X$$$-axis numbered $$$1$$...
256 megabytes
import java.util.Scanner; public class main { static long find_sum(long[] A,int k){ if (k>A.length){ long ans=0; for (int i=0;i<A.length;i++){ ans+=A[i]; } ans+=(((long) (A.length) *(k-1+k-A.length))/2); return ans; ...
Java
["4\n\n5 2\n\n5 6 1 2 3\n\n5 7\n\n5 6 1 2 3\n\n1 2\n\n999999\n\n5 70000\n\n1000000000 1000000000 1000000000 1000000000 1000000000"]
2 seconds
["12\n37\n1000000\n5000349985"]
NoteTest case 1:Marisa can start at $$$x=2$$$. In the first minute, she moves to $$$x=1$$$ and collect $$$5$$$ mushrooms. The number of mushrooms will be $$$[1,7,2,3,4]$$$. In the second minute, she moves to $$$x=2$$$ and collects $$$7$$$ mushrooms. The numbers of mushrooms will be $$$[2,1,3,4,5]$$$. After $$$2$$$ minu...
Java 8
standard input
[ "brute force", "greedy" ]
e092d58ac58e1e41d17be946128234e5
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$, $$$k$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$, $$$1\le k \le 10^9$$$) — t...
1,600
For each test case, print the maximum number of mushrooms Marisa can pick after $$$k$$$ minutes.
standard output
PASSED
c43f10f7a3bb77d2de99a980e8b6cbfa
train_108.jsonl
1654266900
The enchanted forest got its name from the magical mushrooms growing here. They may cause illusions and generally should not be approached.—Perfect Memento in Strict SenseMarisa comes to pick mushrooms in the Enchanted Forest. The Enchanted forest can be represented by $$$n$$$ points on the $$$X$$$-axis numbered $$$1$$...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class A { FastScanner in; PrintWriter out; boolean systemIO = true; int mod = 1000000007; public int mult(int x, int y) { return (int) (x * 1L * y % mod); } public int sum(int x, int y) { if (x + y >= mod) { ret...
Java
["4\n\n5 2\n\n5 6 1 2 3\n\n5 7\n\n5 6 1 2 3\n\n1 2\n\n999999\n\n5 70000\n\n1000000000 1000000000 1000000000 1000000000 1000000000"]
2 seconds
["12\n37\n1000000\n5000349985"]
NoteTest case 1:Marisa can start at $$$x=2$$$. In the first minute, she moves to $$$x=1$$$ and collect $$$5$$$ mushrooms. The number of mushrooms will be $$$[1,7,2,3,4]$$$. In the second minute, she moves to $$$x=2$$$ and collects $$$7$$$ mushrooms. The numbers of mushrooms will be $$$[2,1,3,4,5]$$$. After $$$2$$$ minu...
Java 8
standard input
[ "brute force", "greedy" ]
e092d58ac58e1e41d17be946128234e5
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$, $$$k$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$, $$$1\le k \le 10^9$$$) — t...
1,600
For each test case, print the maximum number of mushrooms Marisa can pick after $$$k$$$ minutes.
standard output
PASSED
4d5334f2dd4eed4dc23f676b3ba7a9f2
train_108.jsonl
1654266900
The enchanted forest got its name from the magical mushrooms growing here. They may cause illusions and generally should not be approached.—Perfect Memento in Strict SenseMarisa comes to pick mushrooms in the Enchanted Forest. The Enchanted forest can be represented by $$$n$$$ points on the $$$X$$$-axis numbered $$$1$$...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.security.KeyStore.Entry; import java.util.ArrayList; import java.util.Arrays; import java.util.Coll...
Java
["4\n\n5 2\n\n5 6 1 2 3\n\n5 7\n\n5 6 1 2 3\n\n1 2\n\n999999\n\n5 70000\n\n1000000000 1000000000 1000000000 1000000000 1000000000"]
2 seconds
["12\n37\n1000000\n5000349985"]
NoteTest case 1:Marisa can start at $$$x=2$$$. In the first minute, she moves to $$$x=1$$$ and collect $$$5$$$ mushrooms. The number of mushrooms will be $$$[1,7,2,3,4]$$$. In the second minute, she moves to $$$x=2$$$ and collects $$$7$$$ mushrooms. The numbers of mushrooms will be $$$[2,1,3,4,5]$$$. After $$$2$$$ minu...
Java 8
standard input
[ "brute force", "greedy" ]
e092d58ac58e1e41d17be946128234e5
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$, $$$k$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$, $$$1\le k \le 10^9$$$) — t...
1,600
For each test case, print the maximum number of mushrooms Marisa can pick after $$$k$$$ minutes.
standard output
PASSED
ede9a89b68cf32150cfbe2d5d70ccdb6
train_108.jsonl
1654266900
The enchanted forest got its name from the magical mushrooms growing here. They may cause illusions and generally should not be approached.—Perfect Memento in Strict SenseMarisa comes to pick mushrooms in the Enchanted Forest. The Enchanted forest can be represented by $$$n$$$ points on the $$$X$$$-axis numbered $$$1$$...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { static FastReader sc=new FastReader(); static PrintWriter out=new PrintWriter(System.out); static final double pi=3.1415926536; static long mod=1000000007; // static long mod=998244353; static int MAX=Integer.MAX_VALUE; ...
Java
["4\n\n5 2\n\n5 6 1 2 3\n\n5 7\n\n5 6 1 2 3\n\n1 2\n\n999999\n\n5 70000\n\n1000000000 1000000000 1000000000 1000000000 1000000000"]
2 seconds
["12\n37\n1000000\n5000349985"]
NoteTest case 1:Marisa can start at $$$x=2$$$. In the first minute, she moves to $$$x=1$$$ and collect $$$5$$$ mushrooms. The number of mushrooms will be $$$[1,7,2,3,4]$$$. In the second minute, she moves to $$$x=2$$$ and collects $$$7$$$ mushrooms. The numbers of mushrooms will be $$$[2,1,3,4,5]$$$. After $$$2$$$ minu...
Java 8
standard input
[ "brute force", "greedy" ]
e092d58ac58e1e41d17be946128234e5
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$, $$$k$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$, $$$1\le k \le 10^9$$$) — t...
1,600
For each test case, print the maximum number of mushrooms Marisa can pick after $$$k$$$ minutes.
standard output
PASSED
812a124c1e4ad772822fd21554cf416f
train_108.jsonl
1654266900
The enchanted forest got its name from the magical mushrooms growing here. They may cause illusions and generally should not be approached.—Perfect Memento in Strict SenseMarisa comes to pick mushrooms in the Enchanted Forest. The Enchanted forest can be represented by $$$n$$$ points on the $$$X$$$-axis numbered $$$1$$...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Bit...
Java
["4\n\n5 2\n\n5 6 1 2 3\n\n5 7\n\n5 6 1 2 3\n\n1 2\n\n999999\n\n5 70000\n\n1000000000 1000000000 1000000000 1000000000 1000000000"]
2 seconds
["12\n37\n1000000\n5000349985"]
NoteTest case 1:Marisa can start at $$$x=2$$$. In the first minute, she moves to $$$x=1$$$ and collect $$$5$$$ mushrooms. The number of mushrooms will be $$$[1,7,2,3,4]$$$. In the second minute, she moves to $$$x=2$$$ and collects $$$7$$$ mushrooms. The numbers of mushrooms will be $$$[2,1,3,4,5]$$$. After $$$2$$$ minu...
Java 8
standard input
[ "brute force", "greedy" ]
e092d58ac58e1e41d17be946128234e5
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$, $$$k$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$, $$$1\le k \le 10^9$$$) — t...
1,600
For each test case, print the maximum number of mushrooms Marisa can pick after $$$k$$$ minutes.
standard output
PASSED
be25aa2c409612d8b5b60bd3ea24f15d
train_108.jsonl
1654266900
The enchanted forest got its name from the magical mushrooms growing here. They may cause illusions and generally should not be approached.—Perfect Memento in Strict SenseMarisa comes to pick mushrooms in the Enchanted Forest. The Enchanted forest can be represented by $$$n$$$ points on the $$$X$$$-axis numbered $$$1$$...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; import java.util.concurrent.ThreadLocalRandom; public class c731{ pub...
Java
["4\n\n5 2\n\n5 6 1 2 3\n\n5 7\n\n5 6 1 2 3\n\n1 2\n\n999999\n\n5 70000\n\n1000000000 1000000000 1000000000 1000000000 1000000000"]
2 seconds
["12\n37\n1000000\n5000349985"]
NoteTest case 1:Marisa can start at $$$x=2$$$. In the first minute, she moves to $$$x=1$$$ and collect $$$5$$$ mushrooms. The number of mushrooms will be $$$[1,7,2,3,4]$$$. In the second minute, she moves to $$$x=2$$$ and collects $$$7$$$ mushrooms. The numbers of mushrooms will be $$$[2,1,3,4,5]$$$. After $$$2$$$ minu...
Java 8
standard input
[ "brute force", "greedy" ]
e092d58ac58e1e41d17be946128234e5
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$, $$$k$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$, $$$1\le k \le 10^9$$$) — t...
1,600
For each test case, print the maximum number of mushrooms Marisa can pick after $$$k$$$ minutes.
standard output
PASSED
5216ba1c4c691d63dc7b1eab84d5668a
train_108.jsonl
1654266900
The enchanted forest got its name from the magical mushrooms growing here. They may cause illusions and generally should not be approached.—Perfect Memento in Strict SenseMarisa comes to pick mushrooms in the Enchanted Forest. The Enchanted forest can be represented by $$$n$$$ points on the $$$X$$$-axis numbered $$$1$$...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; import java.util.concurrent.ThreadLocalRandom; public class c731{ pub...
Java
["4\n\n5 2\n\n5 6 1 2 3\n\n5 7\n\n5 6 1 2 3\n\n1 2\n\n999999\n\n5 70000\n\n1000000000 1000000000 1000000000 1000000000 1000000000"]
2 seconds
["12\n37\n1000000\n5000349985"]
NoteTest case 1:Marisa can start at $$$x=2$$$. In the first minute, she moves to $$$x=1$$$ and collect $$$5$$$ mushrooms. The number of mushrooms will be $$$[1,7,2,3,4]$$$. In the second minute, she moves to $$$x=2$$$ and collects $$$7$$$ mushrooms. The numbers of mushrooms will be $$$[2,1,3,4,5]$$$. After $$$2$$$ minu...
Java 8
standard input
[ "brute force", "greedy" ]
e092d58ac58e1e41d17be946128234e5
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$, $$$k$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$, $$$1\le k \le 10^9$$$) — t...
1,600
For each test case, print the maximum number of mushrooms Marisa can pick after $$$k$$$ minutes.
standard output
PASSED
d20df309a247cc1b7252a4af712b7173
train_108.jsonl
1654266900
The enchanted forest got its name from the magical mushrooms growing here. They may cause illusions and generally should not be approached.—Perfect Memento in Strict SenseMarisa comes to pick mushrooms in the Enchanted Forest. The Enchanted forest can be represented by $$$n$$$ points on the $$$X$$$-axis numbered $$$1$$...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static BufferedReader bf; static PrintWriter out; static Scanner sc; static StringTokenizer st; public static void main (String[] args)throws IOException { bf = new BufferedReader(new InputStreamReader(System.in)); out = ne...
Java
["4\n\n5 2\n\n5 6 1 2 3\n\n5 7\n\n5 6 1 2 3\n\n1 2\n\n999999\n\n5 70000\n\n1000000000 1000000000 1000000000 1000000000 1000000000"]
2 seconds
["12\n37\n1000000\n5000349985"]
NoteTest case 1:Marisa can start at $$$x=2$$$. In the first minute, she moves to $$$x=1$$$ and collect $$$5$$$ mushrooms. The number of mushrooms will be $$$[1,7,2,3,4]$$$. In the second minute, she moves to $$$x=2$$$ and collects $$$7$$$ mushrooms. The numbers of mushrooms will be $$$[2,1,3,4,5]$$$. After $$$2$$$ minu...
Java 8
standard input
[ "brute force", "greedy" ]
e092d58ac58e1e41d17be946128234e5
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$, $$$k$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$, $$$1\le k \le 10^9$$$) — t...
1,600
For each test case, print the maximum number of mushrooms Marisa can pick after $$$k$$$ minutes.
standard output
PASSED
7e84cb3ecca613e94d8ae2231184860b
train_108.jsonl
1654266900
The enchanted forest got its name from the magical mushrooms growing here. They may cause illusions and generally should not be approached.—Perfect Memento in Strict SenseMarisa comes to pick mushrooms in the Enchanted Forest. The Enchanted forest can be represented by $$$n$$$ points on the $$$X$$$-axis numbered $$$1$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; import javafx.util.Pair; public class Main { public static long sumofn(long n) { return (n*(n+1))/2l; } public static void...
Java
["4\n\n5 2\n\n5 6 1 2 3\n\n5 7\n\n5 6 1 2 3\n\n1 2\n\n999999\n\n5 70000\n\n1000000000 1000000000 1000000000 1000000000 1000000000"]
2 seconds
["12\n37\n1000000\n5000349985"]
NoteTest case 1:Marisa can start at $$$x=2$$$. In the first minute, she moves to $$$x=1$$$ and collect $$$5$$$ mushrooms. The number of mushrooms will be $$$[1,7,2,3,4]$$$. In the second minute, she moves to $$$x=2$$$ and collects $$$7$$$ mushrooms. The numbers of mushrooms will be $$$[2,1,3,4,5]$$$. After $$$2$$$ minu...
Java 8
standard input
[ "brute force", "greedy" ]
e092d58ac58e1e41d17be946128234e5
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$, $$$k$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$, $$$1\le k \le 10^9$$$) — t...
1,600
For each test case, print the maximum number of mushrooms Marisa can pick after $$$k$$$ minutes.
standard output
PASSED
a02375c5a2733f78425935f409edb31b
train_108.jsonl
1654266900
The enchanted forest got its name from the magical mushrooms growing here. They may cause illusions and generally should not be approached.—Perfect Memento in Strict SenseMarisa comes to pick mushrooms in the Enchanted Forest. The Enchanted forest can be represented by $$$n$$$ points on the $$$X$$$-axis numbered $$$1$$...
256 megabytes
import java.util.Scanner; public class A1687 { 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 K = in.nextInt(); int[] A = new int[N]; ...
Java
["4\n\n5 2\n\n5 6 1 2 3\n\n5 7\n\n5 6 1 2 3\n\n1 2\n\n999999\n\n5 70000\n\n1000000000 1000000000 1000000000 1000000000 1000000000"]
2 seconds
["12\n37\n1000000\n5000349985"]
NoteTest case 1:Marisa can start at $$$x=2$$$. In the first minute, she moves to $$$x=1$$$ and collect $$$5$$$ mushrooms. The number of mushrooms will be $$$[1,7,2,3,4]$$$. In the second minute, she moves to $$$x=2$$$ and collects $$$7$$$ mushrooms. The numbers of mushrooms will be $$$[2,1,3,4,5]$$$. After $$$2$$$ minu...
Java 8
standard input
[ "brute force", "greedy" ]
e092d58ac58e1e41d17be946128234e5
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$, $$$k$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$, $$$1\le k \le 10^9$$$) — t...
1,600
For each test case, print the maximum number of mushrooms Marisa can pick after $$$k$$$ minutes.
standard output
PASSED
d86b97fe1da168fe760bb4a224948181
train_108.jsonl
1654266900
The enchanted forest got its name from the magical mushrooms growing here. They may cause illusions and generally should not be approached.—Perfect Memento in Strict SenseMarisa comes to pick mushrooms in the Enchanted Forest. The Enchanted forest can be represented by $$$n$$$ points on the $$$X$$$-axis numbered $$$1$$...
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.Print...
Java
["4\n\n5 2\n\n5 6 1 2 3\n\n5 7\n\n5 6 1 2 3\n\n1 2\n\n999999\n\n5 70000\n\n1000000000 1000000000 1000000000 1000000000 1000000000"]
2 seconds
["12\n37\n1000000\n5000349985"]
NoteTest case 1:Marisa can start at $$$x=2$$$. In the first minute, she moves to $$$x=1$$$ and collect $$$5$$$ mushrooms. The number of mushrooms will be $$$[1,7,2,3,4]$$$. In the second minute, she moves to $$$x=2$$$ and collects $$$7$$$ mushrooms. The numbers of mushrooms will be $$$[2,1,3,4,5]$$$. After $$$2$$$ minu...
Java 8
standard input
[ "brute force", "greedy" ]
e092d58ac58e1e41d17be946128234e5
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$, $$$k$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$, $$$1\le k \le 10^9$$$) — t...
1,600
For each test case, print the maximum number of mushrooms Marisa can pick after $$$k$$$ minutes.
standard output
PASSED
411d246827ba7b5a9c72c55c3c6c01b4
train_108.jsonl
1654266900
The enchanted forest got its name from the magical mushrooms growing here. They may cause illusions and generally should not be approached.—Perfect Memento in Strict SenseMarisa comes to pick mushrooms in the Enchanted Forest. The Enchanted forest can be represented by $$$n$$$ points on the $$$X$$$-axis numbered $$$1$$...
256 megabytes
import java.io.*; import java.util.*; public class TheEnchantedForest { private static final int START_TEST_CASE = 1; public static void solveCase(FastIO io, int testCase) { final int N = io.nextInt(); final int K = io.nextInt(); final int[] A = io.nextIntArray(N); if (K >= N) { long aSum...
Java
["4\n\n5 2\n\n5 6 1 2 3\n\n5 7\n\n5 6 1 2 3\n\n1 2\n\n999999\n\n5 70000\n\n1000000000 1000000000 1000000000 1000000000 1000000000"]
2 seconds
["12\n37\n1000000\n5000349985"]
NoteTest case 1:Marisa can start at $$$x=2$$$. In the first minute, she moves to $$$x=1$$$ and collect $$$5$$$ mushrooms. The number of mushrooms will be $$$[1,7,2,3,4]$$$. In the second minute, she moves to $$$x=2$$$ and collects $$$7$$$ mushrooms. The numbers of mushrooms will be $$$[2,1,3,4,5]$$$. After $$$2$$$ minu...
Java 8
standard input
[ "brute force", "greedy" ]
e092d58ac58e1e41d17be946128234e5
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$, $$$k$$$ ($$$1 \le n \le 2 \cdot 10 ^ 5$$$, $$$1\le k \le 10^9$$$) — t...
1,600
For each test case, print the maximum number of mushrooms Marisa can pick after $$$k$$$ minutes.
standard output