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
be4bf8e0164effc0527b09c08b1273b3
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.*; import java.util.StringTokenizer; import static java.lang.Double.parseDouble; import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.System.exit; public class CodeForces { static BufferedReader in; static PrintWriter out; ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
7850323b80949bb8c8a070399a0323cb
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.*; import java.util.StringTokenizer; import static java.lang.Double.parseDouble; import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.System.exit; public class CodeForces { static BufferedReader in; static PrintWriter out; ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
8683911e8f7edfcca48435bd19c59520
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int T = sc.nextInt(); while(T-- > 0){ int n = sc.nextInt(); if(n%2 == 0){ for(int i=1; i<=n; i++) ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
939b637140787990d6688f4817560c4e
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
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.Collections; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new Input...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
074fa8569b40417a0f4bfe88908d9672
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.*; import java.util.*; import java.math.BigInteger; import java.text.SimpleDateFormat; import java.text.DateFormat; public class Codeforces{ public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parse...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
152df01096ab9c34e0990b012438dfc9
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; public class PrettyPermutations { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); for(int i=0;i<n;i++){ int a=sc.nextInt(); System.out.println(solve(a)); } } static S...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
20d0bf1b0f2586ce0c246497e69d9a3e
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; public class cr728_A { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); while(t-->0) { int n = s.nextInt(); if(n==2) { System.out.println(2+" "+1); }else if(n==3) { System.out.println(3+" "+1+" "+2); }else { ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
72dd7a6cc821e6efac7d2057449ba258
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; import javafx.util.Pair; import jdk.nashorn.internal.ir.BreakNode; public class One { static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); static StringBuilder out = new StringBuilder(); static Buffere...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
c2c7994e37d3d6304e061164d1d0f080
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
//package com.amoghghadge.compProgramming.CodeforcesUnder1300; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class PrettyPermutations { public static void main(Str...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
47395ba6adc009217469fbd080e18a1f
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
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 * A...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
ea9333c2ebcd2a230f4ea1d953b544eb
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
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 * A...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
e51b83e6c9a84b59122ec15317da76d1
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
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 * A...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
c6016f9f378866a72adfef69ad0f0029
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
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 * ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
41a54843eb9010771259f0ccfd381cee
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; import java.util.*; public class CatProblem { public static void main(String[] args) { Scanner myObj = new Scanner(System.in); int tests = myObj.nextInt(); List<Integer> list=new ArrayList<Integer>(); for(int j=0;j<tests;j++) { list.add(my...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
5d2a189f0302fd6a18ef00d10886c69f
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
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.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.StringTokenizer; public class P1541A { static PrintWrite...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
98ead47d3ccf0d9911b51f3fa1743ff7
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; public class josh { // Driver program to test the above function public static void main(String []args) { Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t-->0) { int n = s.nextInt(); int arr[]=new int[n]; ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
2d6766cf27e4f4d59f7dd26844f33af6
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.*; import java.util.*; import java.lang.Math; public class Solution { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t>0){ int n = sc.nextInt(); int[] ans = new int[n]; int i; for(i=0;i<n;i++){ ans[i] = i...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
3522fb69962481ab4a6d7215de73fa5e
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
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.math.BigInteger; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.I...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
b57bee2d82150f1bacbc264f021869bb
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.*; import java.util.*; public class Trials1 { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader inp=new BufferedReader(new InputStreamReader(System.in)); BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out)); int ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
de0d4853407762e82eb5436135a12ab0
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
//package java2; import java.util.Arrays; import java.util.Scanner; public class firstclass { public static void main(String[] args) { // Classes and objects /*class Box{ private int len,wid; public Box(int l,int b){ len=l; wid=b; } ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
0e9923adf856193ae6cf5d649805e473
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.ArrayList; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; import java.util.Arrays; import java.util.PriorityQueue; import java.util.HashSet; import java.ut...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
a8e1ca205ce2201e7d715db0fe8fa42c
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
// "static void main" must be defined in a public class. import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int tt=0;tt<t;tt++){ int n = sc.nextInt(); // i...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
4c6a618286fd4242da038f1cee1f0365
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Pretty_Permutations { public static void main(String[] args) { ArrayList <Integer> mList = new ArrayList<>(); Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int m=0; m<t; m++){ ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
cd39b5b652a20b119ee96a75c16b510c
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class file { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); for (int i = 0; i < t; i++) { int...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
b86f3e76bb8124e9f97a969fc62a4de8
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.*; import java.util.*; public final class CatReOrdering { static void minimumDistanceMoved(int[] positions) { int n = positions.length; if(n%2==1) n-=1; for(int i=0;i<n-1;) { int temp = positions[...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
c66ca9ac664c2fe9e90fc24777b92148
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int[] ar; int t = scan.nextInt(); int n = 0; int odd=0, even=0; int swap = 0; while(t-->0){ ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
90e42006ac16459593fc47d763ac836b
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; public class A { public static void main(String[] args) { int T; Scanner s = new Scanner(System.in); //System.out.println("Enter Number of Test Cases:-"); T = s.nextInt(); int counter = 0; while(T > counter) { int N = s.nextInt(); int...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
6e7dbcb31bc2e9ac402464f3d6eb245b
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class June25a { public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.par...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
515226cf98aa1d1173636b47112fedd3
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; public class PrettyPermuatations { public static void printPermuation(int N){ int[] arr = new int[N]; for(int i=0;i<N;i++){ arr[i] = i+1; } for(...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
0adc259e828fb0796fcc0310fe9e2e63
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; public class Permutations { public static void main(String args[]) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while (t-->0) { ArrayList<Integer> nums = new ArrayList<Integer>(); int a = in.nextInt(); for (int ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
7f3eb9b79d8d6c88d2060348fe95dd6a
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.IOException; import java.io.InputStreamReader; import java.io.BufferedReader; import java.util.*; import java.math.*; import java.io.*; import java.text.*; import java.math.BigInteger; public class Main { static class pair{ Character x; int y; public pair(Character x,int y) { ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
b4e3cbd92407dd726d59d705864ad7db
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; import java.io.*; public class saxxx { static FastReader sc = new FastReader(); public static void main(String[] args) throws IOException { try { int t = sc.nextInt(); while (t-- > 0) { solve(); } } catch (Exception e) { return; } } static void solve() {...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
0439fbe1c14d770bf42dc2c9877c5074
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.*; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.io.*; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.*; import java.io.FileInputStream; import jav...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
b6d47220f849083f06627b8ed20a04f4
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.*; import java.util.*; public class solution { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); while(t>0) { int n = sc.nextInt(); if(n%2==0) { for(int i=1;i<=n;i+=2) { System.out.print(i...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
7002275b90bb954c99118e827475148a
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Solution { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
d90bc7d75149d2c640c4d7d8d8242c35
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { // *** ++ // +=-==+ +++=- //+-:---==+ *+=----= ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
242f8d67a49a7a45664d893beae7ab69
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader( new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int i,j,k,l,m,n,t,p; t = Integer.parseIn...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
eb54c816cdc9fd92f9fb5f93f7d74b76
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
// package com.company; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { // write your code here // BufferedReader br = new BufferedReader(new InputStreamReader(S...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
531e6174450a6436a82d0927079ca15c
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.*; import java.util.*; import java.lang.Math; public class Main{ static BufferedReader reader; static StringTokenizer tokenizer; static PrintWriter writer; static int nextInt() throws IOException { return Integer.parseInt(nextToken()); } static long nextLong() throws IOException {...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
3341927d86bedce4d1ff9e1b6a272f43
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class contest728 { public static void main(String[] args) { FastScanner fs = new FastScanner(); ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
b98f593e04ddd5b151bdb3068c4867cb
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; import java.io.*; public class A728 { public static void main(String[] args) { JS scan = new JS(); int t = scan.nextInt(); while(t-->0){ int n = scan.nextInt(); for(int i = 1;i<=n;i+=2){ if(n-i+1==3){ S...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
f374458414c42608b0977c853775ff3c
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
/* ⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
d783d8dbd9057e0f82097f40fd951e46
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
/* ⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
44b3cfc3155e406c20f85e7628bdffb9
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
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.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Random; import java.util.Stack; impor...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
ef3e52f34457ed4a0e4bfdf5f7ea6fc6
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.lang.reflect.Array; import java.util.*; public class ques { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t= sc.nextInt(); for (int i=0; i<t; i++){ int n= sc.nextInt(); int[] arr= new int[n]; f...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
4216f7e52b3b1fe8c80c549172dfe44d
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int n; int[] solution; int temp; while (t > 0) { n = sc.nextInt(); solution = new int[n]; ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
d01c2d0429058d38bca5ba8e35f5d5f2
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; public class Codefoecesp1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i =0 ; i<n;i++) { int a = sc.nextInt(); if(a%2 ==0 ){ for(int k =1 ; k<=a...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
4dc49d2a656c6f19792d71b14ccb7609
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.*; import java.util.*; public class Rough { public static void main(String[] args) throws Exception { Scanner s = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int tc = s.nextInt(); for (int t = 1; t <= tc; t++) { int n=s.nextInt(); if(n%2==1) { pw.p...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
91a90576c62f2eb67b5256157ff1ae67
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { long max = (long) 1e5+10; long[] factorials = new long[(int) max]; long[] primes = new long[(int) max]; ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
19356b70d7718e3e9c5473cd57e24b32
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; /** * https://codeforces.com/problemset/problem/1541/A * @author ey * */ public class P1514A { public static void main(String[] args) throws IOExceptio...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
1021eaddfb57453bf32eaec30c88ccd9
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; public class PrettyCombinations { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int test = sc.nextInt(); while (test-- > 0) { int n = sc.nextInt(); int[] nums = new int[n]; for (int i = 0; i < n; i++) { nums[i] = i + 1; } ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
a67f12d95b45a2cbfbaf76cd8b27e903
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; public class Solution { public static void solve(int start, int n){ for(int i = start; i <= n; i+=2){ if(start+1 != n) System.out.print((i+1) + " " + i + " "); else System.out.print(i+1 +...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
a09f814cef9459de36e34d6b052a91f1
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.*; import java.util.*; public class Solution{ static PrintWriter out = new PrintWriter(System.out); static int mod = 1000000007; public static void main(String[] args) throws IOException { FastReader fs = new FastReader(); int t = fs.nextInt(); while(t > 0){ int n = f...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
21384cc5266973ed54a43dfdce9afcc3
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.Math; import java.util.Scanner; import java.io.*; import java.util.*; import java.util.StringTokenizer; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
5c9347ed09c53a9527ffac9be2096e37
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; import java.io.*; public class PrettyPermutations { public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int t = sc.nextInt(); while (t-->0){ int n = sc.ne...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
ce589802b156e587d365bc4d16d92153
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.*; import java.util.*; public class PrettyPermutations { public static void main(String[] args) { new PrettyPermutations().run(); } BufferedReader br; PrintWriter out; long mod = (long) (1e9 + 7), inf = (long) (3e18); class pair { int F, S; ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
4c89afb1cf3f8b19334d96b09c53e8ea
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; public class main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i = 0; i < t; i++){ int n = sc.nextInt(); if(n % 2 == 1){ System.out.print("3 1 2 "); ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
ba0f623dbebe129be5c69de8297d1314
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; import java.util.Set; import org.omg.CORBA.MARSHAL; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int len = s.nextInt(); long a = 0; long b = 0; long c...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
579876701d6ec811d015e47a50c68bd1
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; public class pretty { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t,n; t=sc.nextInt(); while(t-->0) { n=sc.nextInt(); if(n%2==0) { int a[]=new int[n]; for(int i=0;i<n;i++) { a[i]=i+1; }...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
290722a2a2cf2518bb9d61d9a2e5d3ac
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; import java.io.*; public class c1 { static FastScanner scan; static SlowPrinter out; public static void main(String[] args) throws Exception { scan=new FastScanner(System.in); out=new SlowPrinter(); // int T=1; int T=scan.nextInt(); while(T-->...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
e0e4aea2b543670e39582c9859b95b28
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; import java.io.*; public class s1 { public static void main(String[] args) throws IOException { scan=new BessieBeam(); out=new PrintWriter(System.out); // int T=1; int T=scan.nextInt(); while(T-->0) { int n=scan.nextInt(); int[] a=new int[n]; for(int i=0;i<n;i++) a[...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
ca439ff692dc27e7af26e99c4e558208
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; public class Pretty_Permutations{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); long input_count=sc.nextInt(); while(input_count-->0){ long cat_cost = sc.nextInt(); if(cat_cost==1){ System.ou...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
2be589415a36663a72efcb8da801c178
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; import java.io.*; import java.util.Arrays; import java.util.Map.Entry; public class codeforces { public static void main(String[] args) throws Exception { int t=sc.nextInt(); while(t-->0) { int n = sc.nextInt(); int[] arr = new int[n];for(int i = 1; i<=n; i++)arr[i - ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
63d2681bd526f5176a5c8133ed0d8889
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class Main { static AReader scan = new AReader(); static Scanner scan2 = new Scanner(System.in); static int N = 100010; static void slove() { ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
d8290025d14f03434c1f8b15efaccfb1
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); while(t-->0){ int n = input.nextInt(); int i =1; if (n%2!=0){ System.out.print("3 1 2 ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
5298f9b152a07292b3a3284da7bad577
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
//package practice; import java.util.*; public class Solution { public static void main (String[] args){ Scanner scan = new Scanner(System.in); int T = scan.nextInt(); while(T-->0) { int N = scan.nextInt(); int arr[] = new int[N]; if(N%2 != 0) { arr[0] = 3; arr[1] = 1; arr[2]...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
e01ba52d7869ba0490e470bcac365c7d
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { int n = sc.nextInt(); if (n % 2 == 0) { for (int j = 1; j <= n; ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
4910eb5f154ac524d0733f9a049f1e90
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.*; import java.util.*; public class A { public static void main(String[] args) { FastReader in = new FastReader(); int T = in.nextInt(); while(T-- > 0) { int n = in.nextInt(); if(n==2) System.out.println("2 1"); else if(n==3) System.out.println("3 1 2"); else { if(...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
5f530b84b0b57c37b908ede5abb56e27
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.*; import java.util.*; public class A { public static void main(String[] args) { FastReader in = new FastReader(); int T = in.nextInt(); while(T-- > 0) { int n = in.nextInt(); if(n%2==0) { for(int i = 2; i <= n; i+=2) { System.out.print(i + " " + (i-1) + " "); ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
3e56bc6597da90ab8237d907b831af04
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; public class Hello { public static void main(String[] args) { Scanner ss=new Scanner(System.in); int t=ss.nextInt(); for(int it=0;it<t;it++) { int n=ss.nextInt(); int[] arr=new int[105]; for(int i=1;i<=n;i++) { arr[i-1]=i; } for(int i=0;i<n-1;i++) ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
87f725ee7760e4c622b76f20c3740b7a
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Solution { static class Algebra { public static int GCD(int a, int b) { return b==0?a:GCD(b,a%b); } } static class FastReader { BufferedReader...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
905fd4e378fda9c907c38b9f6752e642
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
// package cp; import java.util.*; import java.lang.*; import java.io.*; import java.math.*; public class Main{ public static void main(String[] args) throws Exception{ Reader.init(System.in); Main mm=new Main(); int t=Reader.nextInt(); while(t>0) { int n=Reader.nextInt(); int odd=1; if...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
32472db2622c434f925a7577ad3814c3
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; public class PrettyPermutations { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); for(int i=1; i<n; i+=2) { if(n%2==1 && i==n-2) { System.out.print((i+1)+" "+(i+2)+" "+i)...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
d0879064a961d804ed6332121a842515
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Solution { static final int MOD = (int)1e9+7; public static void main(String[] args)throws Exception { int T = nextInt(); while(T-- > 0) { int n = nextInt(); int[] a = new int[n]; for (int i=0;i<n-1;i+=2) { a[i] = i+2; a[i+1] ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
78cb3664051af45ce0ef6156758af8a5
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; public class Sol{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int n = sc.nextInt(); if(n%2==1){ if(n==1) System.out.println("1"); ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
88cd399cd39b56ad63ae836956d1952b
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
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 void main(String[] args) { FastScanner input = new FastScanner(); ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 8
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
d63f2b52b961ab30117bdc18fa9a2abf
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; /* * @author : Imtiaz Adar */ public class Pretty_Permutations { public static void main(String[] args) throws IOException{ InputReader scan = ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
12f6aebf824213030c05cdece49574dd
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /* * @author : Imtiaz Adar */ public class Pretty_Permutations { public static void main(String[] args) throws IOException{ InputReader scan = new InputReader(); Runner ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
8d3d9431f6adf6d68f77424b218545f8
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /* * @author : Imtiaz Adar */ public class Pretty_Permutations { public static void main(String[] args) throws IOException{ InputReader scan = new InputReader(); Runner ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
380b45fa9016ebb67b4ee0c1cbf56f21
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
// package first; import java.util.*; import java.io.*; import java.math.*; public class first { public static void main(String hi[]) throws Exception { Scanner sc=new Scanner(System.in); int testcase=sc.nextInt(); while(testcase>=1) { // System.out.print("enter a n...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
d35e0918c8236bc91b275ab0411fa2a2
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
// package solve; /* stream Butter! eggyHide eggyVengeance I need U xiao rerun when */ import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.System.out; import java.util.*; import java.io.*; import java.math.*; public class solve...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
aadcd2e75d1321f4f35995d4dd235548
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
//package com.company; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int number=input.nextInt(); for (int i=0;i<number;i++){ int numbers= input.nextInt(); ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
d745c9aa2ec5cf577709c32e433a46cd
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.math.*; public class A { /* */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); //sc.nextLine(); while(T-->0) { int num = sc.nextInt(); if(num%2==0) {...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
3f34d5536b88987cbe893c4f06f25083
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { private static boolean arr[] = sieve(1000001); private static ArrayList<Long> primes = new ArrayList<>(); private static int freq[] = new int[200005]; private static FastScanner c; private static PrintWriter pw; priva...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
c09417d4ccddc0da6f6ba78434364aa7
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class A_Pretty_Premutation_V3 { public static void main(String[] args) { FastReader fr = new FastReader(); Print...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
07a69a6ec9231476be60943132c3c093
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; public class prettyperm { public static void main(String args[]) { Scanner s = new Scanner(System.in); int t = s.nextInt(); while(t-- > 0) { int n = s.nextInt(); int a[] = new int[n]; for(int i=0;i<n;i++) { a[i] = i+1; } ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
87c4adb0ee80ce68604478cc46525c4f
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
/** * @author Luminous * @date 2022/1/2 20:59 */ import java.io.*; import java.math.*; import java.util.*; public class Main { static final int INF = 0x3f3f3f3f; static final long LNF = 0x3f3f3f3f3f3f3f3fL; public static void main(String[] args) throws IOException { initReader(); ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
2d6c16b9704edad71475f70a15979a77
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { try { Slove(); } catch(Exception e){ System.exit(0); } } public static void Slove() { int t = sc.nextInt(); while(t -- > 0) { int...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
d2db5658c955e7755d52e04bb934a886
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; public class CPEB20211007_E { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); while(n-->0) { int x =sc.nextInt(); if(x%2==1) { System.out.print(3+" "); System.out.print(1+" "); System.out.print(2+" "); ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
cbc2c53106ce30cf3005dce63597a8f2
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
/* Rohit CF Target100 questions 25 days*/ import java.util.*; public class Solution{ public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); if(n%2==0) { ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
11edbf5805e6406e39cf1beea8a23c25
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; public class PrettyPermutations { static Scanner scn = new Scanner(System.in); public static void main(String[] args) { int t = scn.nextInt(); while(t-- >0) { int n = scn.nextInt(); int i = 1; if (n % 2...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
f746957b85292dae7becd38251b4e074
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class cf { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i=0; i<n; i++) { int t = sc.nextInt(); ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
f11ff4d8ade3ad4b079fdeefe9ffbadd
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args) { // write your code here Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t>0){ int n = sc.nextInt(); // for even no. of ca...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
c5e1672c4bc5b760f9c03489c8019159
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; //import template.Template.FastScanner; public class Contest728 { public static class FastScanner { BufferedReader br=new BufferedReader(new InputS...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
cfb76ce2372574e3638681f5c7896481
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
// Problem: A. Pretty Permutations // Contest: Codeforces - Codeforces Round #728 (Div. 2) // URL: https://codeforces.com/contest/1541/problem/A // Memory Limit: 256 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org) import java.io.*; import java.util.*; public class Main{ publ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
d7421cef62a01282ff51282c087db0fc
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; /** * @author jeetscmaker * contest: Codeforces Round #728 (Div. 2), A. Pretty Permutations */ public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); short t = sc.nextShort(); for (int tt = 0; tt < t; tt++) { ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
6da0b307ac84a80303a48b1eac5da2ee
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.Scanner; /** * @author jeetscmaker * contest: Codeforces Round #728 (Div. 2), A. Pretty Permutations */ public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); short t = sc.nextShort(); for (int tt = 0; tt < t; tt++) { ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
5afe0e90ecec87b3f60427bfead129dd
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; public class Matr { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc= new Scanner(System.in); int t=sc.nextInt(); while(t--!=0) { int n=sc.nextInt(); int a[]=new int[n]; a[0]=n; int k=0; ...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
3d679104659d1ef9751260f5345d518c
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
import java.util.*; public class PrettyPermutations { 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]; for(int i = 0; i < n...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output
PASSED
23d5e59c181c222f09413d1b32b8aed1
train_107.jsonl
1624635300
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
256 megabytes
//package com.company; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class Prob_1A { static void swap(int[] arr, int x, int y){ int temp = arr[x]; arr[x] = arr[y]; arr[y] = temp; } static v...
Java
["2\n2\n3"]
1 second
["2 1 \n3 1 2"]
NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$.
Java 11
standard input
[ "constructive algorithms", "greedy", "implementation" ]
f89bd4ec97ec7e02a7f67feaeb4d3958
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans...
800
Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any.
standard output