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 | ceb8eea02796379c37bc0e7836278a41 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | //package Algorithm;
import java.awt.List;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Colle... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 98aad397caf711173d0b133e5e18d4d8 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class main
{
static long mod = (int)1e9+7;
static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
public static void main (String[] args) throws java.lang.Exception
{
FastReader sc =new FastReader();
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 37e133b0421f58d378a33dd7f090229b | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.*;
import java.util.*;
public class MyClass {
public static void main(String args[])throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(br.readLine());
while(t-->0){
int n=Integer.parseInt(br.re... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 8cccd704aa964db5e9892d845a07296f | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
public class practice{
public static FastReader sc;
public static PrintWriter out;
static class FastReader{
BufferedReader br;
StringTokenizer str;
public FastReader(){
br = new BufferedReader(new InputStreamReader(... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 6e91c67cc06b9570c857da2f2f1ba85f | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.*;
public class weird_algrithm {
static BufferedWriter output = new BufferedWriter(
new OutputStreamWriter(Sy... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | b5acd80fd717e1d8f82be228bf20d8c4 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
public class Solution{
public static void main(String args[]){
Scanner in = new Scanner(System.in);
long test = in.nextLong();
while(test-- > 0){
long n = in.nextLong();
ArrayList<Integer> list = new ArrayList<>();
int i, a = 1;... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | e24d7bd7d0a1815c4154c4d5292f8896 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
public class Codechef {
//-----------PrintWriter for faster output---------------------------------
public static PrintWriter out;
public static int cnt;
//-----------MyScanner class for faster input----------
public static class M... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | fd742c86432a4a06da1ddeef3486a0d0 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.math.BigInteger;
public class Main{
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | b006d4f99f1f0b06c65060bebc53c3a2 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
public class aa
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
StringBuffer ans = new StringBuffer();
while(t-->0)
{
int n=sc.nextInt();
int a[] = new int[n];
fo... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 4a625e5fbe7b62ce061331a8c0dcd30b | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
// Problem Link:
// Runtime: O()
// Space: O()
public class B2 {
// Public Static Variables
// Private Static Methods Starts Here
private static class StringLT implements Comparator<String> {
@Override
public int compare(String o1, String o2) {
re... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 8c97bee8fd2c43e9c38a2dd2a501c0df | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
// Problem Link:
// Runtime: O()
// Space: O()
public class B {
// Public Static Variables
// Private Static Methods Starts Here
private static class StringLT implements Comparator<String> {
@Override
public int compare(String o1, String o2) {
ret... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | c36b0c85c9eab246c5f0f5c92c210997 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
static long mod = (int)1e9+7;
static PrintWriter out=new PrintWriter(new BufferedOutputStream(System.out));
public static void main (String[] args) throws java.lang.Exception
{
FastReader sc =new FastReader(... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | cddb1f628f609cda3b4a855970c1cd72 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
public class Main {
public static String solve(int j, int n) {
String ans = "";
int k = 1;
for (int i = 0; i < n; i++) {
if (i == j) {
ans = ans + n + " ";
} else {
ans = ans + k + " ";
k++;
}
}
return ans + "\n";
}
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 61dbf71c8435a2056401fdeef209217c | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes |
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.Scanner;
import java.util.stream.IntStream;
public class Solution {
private static void solve() {
for (int t = 0, T = i32(); t < T; t++) {
int n = i32();
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 52ce5bf4b0755082e56462043bfe167d | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.Scanner;
public class Solution {
private static void solve(Scanner in, PrintStream out) {
int t = in.nextInt();
while (t-- > 0) {
int[] perm = new int[in.n... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | ca10e6e4dac9404af64b18316d16115b | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static int mod = 1000000007;
static void read(int arr[], int start, int end, FastReader in) {
for (int i = start; i < end; i++) {
arr[i] = in.nextInt();
}
}
static int sumArr(int arr[]) {
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 9a1d7ac54ce2496444d0fab395963fbe | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
public class contestA {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Arrays.fill(mk,false);
int t = scanner.nextInt();
while (t-->0){
int n = scanner.nextInt();
ac(n);
}
}
s... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 63ea62efb7cf466e63877a45ab03816b | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
public static void main (String[] args) throws java.lang.Exception
{
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 2e01f9e2088112cfb1b32fa6f74fc046 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
public class _1716B{
public static void main (String[] args) {
Scanner in = new Scanner(System.in);
StringBuilder sb = new StringBuilder();
for (int t = in.nextInt(); t>0; t--){
int n = in.nextInt();
sb.append(n).append("\n");
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 946b3ad722d9759391e1c4276ab61721 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.ma... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 46fd19c7aae21c4c37b4ef0f52c63b2d | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes |
import java.io.*;
import java.util.*;
public class MyClass {
public static void main(String args[])throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(br.readLine());
while(t-->0){
int n=Integer.parseInt(br.... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | ff960d3f06475d19b30fb2381b9f7452 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | //codeforces
//package someAlgorithms;
import java.util.*;
import java.io.*;
import java.lang.*;
public class Main {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
public st... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | f1f54f57557afdb6ae49f62cd72c3c82 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.math.BigInteger;
import java.util.*;
public class Main{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int testcase=sc.nextInt();
for(int tc=1;tc<=testcase;tc++){
//System.out.print("Case #"+tc+": ");
int n = sc.nextIn... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 59d2df7333fdc4dc57bc557f3a141b2c | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
public class A_1 {
static FastReader in=new FastReader();
static final Random random=new Random();
static long mod=1000000007L;
static HashMap<String,Integer>map=new HashMap<>();
public static void main(String args[]) throws IOException
{
i... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | b49b68a98c579faae8964868d56ef61d | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main
{
public static void main(String[] args)throws Exception {
Scanner sc=new Scanner(System.in);
int x=sc.nextInt();
while(x-->0)
{
int a=sc.nextInt();
int arr[]=new int[a];
BufferedWriter output =new BufferedWriter(new OutputStreamWrit... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 264f8206b85a4914933ef38b92ee55b6 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class hello {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
try {
br = new BufferedReader(new FileReader("input.txt"));
PrintStrea... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | baf8b4df6c7c7388d06780ce351666e4 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
int T=0;
Scanner in ... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 6b52d59e8d0c0c0ac9fc18b2e5f61e37 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class codeforces {
static BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
StringTokenizer st = ... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 100bd0a8965ba8b15ed409aaf0612c9f | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(
new InputStreamReader(System.in));
}
String next()
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 33b3520102245be9b10aeb6be1892c95 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
public class Round12 {
public static void main(String[] args) {
FastReader fastRe... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 3ed1a526985bbd9d998783de12c18f6e | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes |
import java.util.*;
public class Codeforces {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc= new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
StringBuilder sb= new StringBuilder("");
int n=sc.nextInt();
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 60501ad7531e4f652ee5be79c27c74b3 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public final class Main{
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(
new InputStreamReader(System.in));
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 0efdb00d4e9b0f1130cbf47e4e41a217 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes |
import java.io.*;
import java.math.*;
import java.util.*;
public class B_Permutation_Chain
{
public static void main(String[] args)throws Exception
{
new Solver().solve();
}
}
//* Success is not final, failure is not fatal: it is the courage to continue that counts.
class S... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | a351fb198a903adc2013829ebf7cd0ff | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | /*input
Prateek Singh
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.*;
import java.util.*;
public class codeforces {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastRead... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 7a645c9eed20d8aa30ff80ef702c44e4 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int h;
static int n;
static long mod = 1000000007;
public static void main(String[] args) {
Sca in = new Sca(System.in);
PrintWriter out = new PrintWriter(System.out);
int t = in.nextInt();
whi... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 62e51ea93f1122f8312385f9eefa1151 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Solution127 {
private final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private final PrintWriter pw = new PrintWrite... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | e51c000373d3c67b8e0c699380dc63b4 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.lang.invoke.MethodHandles;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
imp... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | a0fca170e78ea0f6cb2d2da71d8b1de3 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | /******************************************************************************
No one else matters, this is the moment, this is day.
*******************************************************************************/
import java.io.*;
import java.util.*;
public class Main {
static PrintWriter out=new Pri... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 7ba995590a19ad7bdb13acf40d3faff1 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes |
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while (t-- > 0) {
int n = s.nextInt();
int pos = 1;
System.out.println(n);
for (int i = 1; i <= n; i++) {
StringBuilder str = new StringBui... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | e30c0b7358d07e8d93f65331ff018d31 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | //package codeforces;
import java.util.*;
import java.io.*;
public class CF {
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
int q = Integer.parseInt(br.readLine());
while(q... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 46bb85357dbed6952cd512ee4af21a49 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.*;
import java.util.*;
/*
*/
public class B{
static FastReader sc=null;
public static void main(String[] args) {
sc=new FastReader();
int t=sc.nextInt();
PrintWriter out=new PrintWriter(System.out);
for(int tt=0;tt<t;tt++) {
int n=sc.nextInt();
out.prin... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | efd4dc17ae451699f10eb4e793bd7d80 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | // package com.company.Codeforces;/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class newPro
{
public static void solve(){
int n = sc.nextInt();
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 42276c066f6535b51961fa41537cee9e | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | //Code By KB.
import java.beans.Visibility;
import java.io.*;
import java.lang.annotation.Target;
import java.lang.reflect.Array;
import java.nio.channels.AsynchronousCloseException;
import java.security.KeyStore.Entry;
import java.util.*;
import java.util.logging.*;
import java.io.*;
import java.util.loggi... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | d6978590cb78d5889f5b06db04cf91f1 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.OutputStream;
import java.io.BufferedOutputStream;
import java.util.*;
public class CodeForces_Edu_133 {... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | c8b192c74d3b0d1562aed6d760c27333 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 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.LinkedHashMap;
import java.util.LinkedList;
import java.uti... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | f1573418fbb8b364293b8e5f17e864df | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.Scanner;
public class PermutationChain {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int tc= scanner.nextInt();
for (int i = 0; i<tc; i++){
int length = scanner.nextInt();
int [] array = new int[length];... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | e9e335308643161299fb0e6cd8e5ea43 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
static Scanner scn = new Scanner(System.in);
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) {
int t = 1;
t = scn.nextInt();
for(int tests = 0; tests < t; test... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 8be720f8a767226ad9e0e654ae61b052 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.util.regex.*;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
// sorting on the basis of count of set bits
//Arrays.sort(arr, (a,b)->... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 5f17211f9b24efd25a53b4826e400d27 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes |
import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
//##############################FAST READER###################################
static class FastReader{
BufferedReader br;
StringTokenizer st;
FastReader(){
br=new BufferedReader(new InputSt... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 23cd0f83f0c75094f159ff995bfc1ed4 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.*;
import java.util.*;
public class HackerEarth {
public static void main(String args[]){
InputReader in = new InputReader();
PrintWriter out = new PrintWriter(System.out);
Task solver = new Task();
solver.solve(1, in, out);
out.close();
}
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 28348988d335d443c8e6011cecf54f87 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import javax.swing.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
static AReader scan = new AReader();
static int N = 110;
static int[] a = new int[N];
static void solve() {
int n = scan.... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 215588ff7a89362f5e357d7cc8d5ebf0 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes |
import java.io.PrintWriter;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 0b2ac89c319200e0b280a60b8ac0bec5 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static StringBuilder sb;
static dsu dsu;
static long fact[];
static int mod = (int) (1e9 + 7);
static void build(int node, int start, int end,int[]tree,int[]arr) {
if (start == end) {
tree[node] = arr[start];
} else {
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 90372ff567ed4e683938811e93ef48c6 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class Main {
public static FastReader sc;
public static PrintWriter out;
static class FastReader{
static BufferedReader br;
static StringTokenizer str;
public FastReader(){
br = new BufferedReader(new InputStreamReader(Sys... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 4c66bb282fe6f2f9a37cf210c5e369ba | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | /*
"Everything in the universe is balanced. Every disappointment
you face in life will be balanced by something good for you!
Keep going, never give up."
Just have Patience + 1...
*/
import java.util.*;
import java.lang... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 39c5d38c429459a6442cdac3a72ea623 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.*;
//import java.math.BigInteger;
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.nextI... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | f8c331227124a3109a561dd42fd5d7d7 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.*;
import java.util.*;
public class JavaApplication {
static BufferedReader in;
static BufferedWriter out;
static StringTokenizer st;
static String token;
String getLine() throws IOException {
return in.readLine();
}
String getToken() throws IOException {
if (st == ... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 44da367657528a737263615a1a17b41b | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.*;
public class PermutationChain {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int t = Integer.parseIn... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | ba21712bac7906bb5fcd5f35c4018e27 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
public class Solution{
public static void main(String args[]){
Scanner in = new Scanner(System.in);
long test = in.nextLong();
while(test-- > 0){
int n = in.nextInt();
int[] ans = new int[n];
for(int i=0; i<n; i++){
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 934edd88b37f0c7605614cc0e14a4277 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int A = scn.nextInt();
StringBuilder sb = new StringBuilder("");
while(A-- > 0) {
int n = scn.nextInt();
StringBuilder str = new StringBuilder("");
int[] arr = new int[n];
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 28cf3eda48e02f5528f9480595e09ceb | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.text.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception {
FastReader sc = new FastReader();
PrintWriter writer = new PrintWriter(System.out);
int t = sc.nextInt();
while(t-->0) {... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 9c29578190549ba300afbb7091333a5e | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
static class FastReader {
BufferedReader br;
StringTokenizer st;
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 40de54bef8d58a00b4153116018cec93 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.*;
import java.util.*;
public class B_PermutationChain {
public final static MyScanner sc = new MyScanner();
public static class MyScanner {
BufferedReader br;
StringTokenizer st;
public MyScanner() {
br = new BufferedReader(new InputStreamReader(System.i... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | e04f7d17ff684a830445e7e506f6ab0b | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
public class ProbB
{
public static void main(String[] args)
{
FastReader in = new FastReader();
int numOfTestCases = in.nextInt();
for(int w = 0; w < numOfTestCases; w++)
{
int n = in.nextInt();
System.out.p... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | e8a4374e1140f3b5b37864800d414e3b | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.lang.Math;
import java.io.*;
import java.util.Arrays;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
//StringTokenizer st = new... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 8663749fa0925e1f7f3ae2faa27b4618 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Codechef {
public static void main(String[] args) throws java.lang.Exception {
PrintWriter out = new PrintWriter(System.out);
FastScanner sc = new FastScanner();
int tater = sc.nextInt();
while (tater-- ... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 692fca65cfb8941820b0d47188446e88 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static class Pair {
Pair() {
}
}
public static void main(String[] args) {
takeInput();
Scanner scn = new Scanner(System.in);
int t = 1;
t = scn.nextInt();
while (t-- > 0) {
solve(scn);
}
}
public static v... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | ca7e2313e17ba5678e0785ea1ad87c7c | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
public class codeforces {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(
new InputStreamReader(System.in));
}
String next()
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 372730d72cad449487a9d823dc1e3f85 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
public class Sample {
public static void main(String[] args) {
//diptiman code
//say no to plagarism
//i dont share code nor take from anyone
Scanner xy=new Scanner(System.in);
StringBuilder ans=new StringBuilder();
//say no to plagarism
//diptiman code
//say no to plaga... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 7db53620d9af8294be9985b01e20f3ef | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
public static void main (String[] args) throws java.lang.Exception
{
Reader... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | abcd1f785b2321c5c2108e9f267e6054 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
public class d3
{
static class Node{
int left;
int right;
public Node(int left,int right){
this.left = left;
this.right = right;
}
}
static class pair1{
int number;
int nothappy;
int size ;
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 89049776b03f3ed4f1cbf0b3c71ee5e2 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Objects;
import java.util.StringTokenizer;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class B_PermutationsSeq {
public static void main(S... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 20b038fd6970105dcd1fea4e06f584f6 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | //<———My cp————
//https://takeuforward.org/interview-experience/strivers-cp-sheet/?utm_source=youtube&utm_medium=striver&utm_campaign=yt_video
import java.util.*;
import java.io.*;
public class B_Permutation_Chain{
static PrintWriter pw = new PrintWriter(System.out);
public static void main(String[]... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 1f947186c855cc48ae989cbf78179816 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
FastScanner in = new FastScanner();
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 9ec623f10fa282a3e6c214a76691f5fb | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | // Author - Diwakar Singh
//----------------------------------------------------------------------Libraries----------------------------------------------------------------------
import java.io.*;
import java.util.*;
import java.math.*;
//--------------------------------------------------------------------fas... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 0438b3580a8a00ba459dc02a07fc5c74 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
static long mod = (int)1e9+7;
static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
public static void main (String[] args) throws java.lang.Exception
{
FastReader sc =new FastReader();
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | fe9cc9c7ac3a7386506fa3f8b736126d | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int mod = 998244353;
//static int mod = (int)1e9+7;
static boolean[] prime = new boolean[1];
static int[][] dir1 = new int[][]{{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
static int[][] dir2 = new int[][]{{0, 1}, {0, -1}, {1, 0}, {-1, 0}... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | ed38a268a3de0d371decbbd95ad1d223 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
public class Main {
//-----------PrintWriter for faster output---------------------------------
public static PrintWriter out;
public static int cnt;
//-----------MyScanner class for faster input----------
public static class MySca... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 0e5cc7e4104b9b6c5a39fdbddda30749 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.lang.*;
public class Solution{
static int mod=(int)1e9+7;
static int mod1=998244353;
static FastScanner sc = new FastScanner();
static StringBuffer as=new StringBuffer("");
public stati... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | c6eab1bdec9e0f3fb68dc2797cb13d89 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.*;
import java.util.*;
public class pchain {
public static void main(String[] args) throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(in.readLine());
for (int x = 0; x < t; x++) {
int n =... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | de1e7d363fc81dd94ec5ae1d84d5775e | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Stack;
public class Main {
static long MOD = 998244353l;
int min = Integer.MAX_VALUE;
int max = 0;
char result[][];
int count = 0;
int pattern = 0;
publ... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 308ef656495b0eaf85f83cf2890455fa | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Test
{
final static private FastReader fr = new FastReader();
final static private PrintWriter out = new PrintWriter(System.out) ;
final static private long mod = (long)1e9 + 7;
private static void solve()
{
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | e11b6ae8164595347cb1e31d73571f79 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.*;
import java.util.*;
public class gotoJapan {
public static void main(String[] args) throws java.lang.Exception {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream)... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 92fd588f7db4c670d1d38ee7444d07bd | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
public class A {
static class Pair {
int x;
int y;
public Pair(int x, int y) {
this.x = x;
this.y = y;
}
}
static long gcd(long n, long m) {
if (m == 0)
return n;
else
return gcd(m, n % m);
}
static long lcm(long n, long m) {
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 11 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 7d4d6bf2a8104bfc92e8fec096df8c2e | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.util.stream.IntStream;
import static java.lang.System.out;
import static java.util.Arrays.stream;
public class B {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
while (t-->0) {
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 17 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | dc734cdb3a3ebc5aea0fcee60f06e5b5 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.util.stream.IntStream;
import static java.lang.System.out;
import static java.util.Arrays.stream;
public class B {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
while (t-->0) {
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 17 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 6480e1cfec24464c994f61d7e7e5e313 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.util.Scanner;
import java.io.IOException;
import java.util.Arrays;
import java.util.ArrayList;
public class Main{
public static void main(String[] args) throws IOException {
Scanner sc= new Scanner(System.in)... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 17 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 72d8d08c4493d6bc6127437429462041 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution extends Helper {
private static final SuperFastReader sc = new SuperFastReader();
// private static final FastReader sc = new FastReader();
// private static final Scanner sc = new Scanner(System.in);
private static final PrintWriter out = new... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 17 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 564726ae8b8ec7d3cd1438de4c5f069b | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution {
private static final SuperFastReader sc = new SuperFastReader();
private static final int MOD = (int) (1e9) + 7;// ((a + b) % MOD + MOD) % MOD
public static void main(String[] args) throws IOException {
int t = sc.Int();
for (int... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 17 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | d2284a52960741f6f3a61bba39dfbccb | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
public class CF1716B_build_permutation {
// For fast input output
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
try {
br = new BufferedReader(
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 17 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | f65203134e3bb7d38dc1fc6c5beba2ba | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
public class InVoker {
//Variables
static long mod = 1000000007;
static long mod2 = 998244353;
static FastReader inp= new FastReader();
static PrintWriter out= new PrintWriter(System.out);
public static void main(String args[]) {
InVoker g=new InVoker();
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 17 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 13034a22d7c63715be28c7a5cee9c47b | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
public class ACMP {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
System.out.println(n);
for (int i = 1; i <= n; i++) {
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 17 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 8ea0c06bce9b8ea64d2ce8b3f9a12b08 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.PrintWriter;
public class PermutationChain {
public static void main(String args[]) {
Scanner sc =new Scanner(System.in);
int tc = sc.nextInt();
PrintWriter out = new PrintWriter(System.out);
int[] arr = new int[101];
while(tc != 0){
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 17 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | a2cc062df9bdb83840a1f8ec2e973baa | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import javax.print.DocFlavor.STRING;
import java.io.*;
import java.lang.Math;
public class cp{
public static PrintWriter out;
public static FastReader sc;
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 17 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 102a9219cde4bd76364a1377c69efdbc | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.io.PrintWriter;
import java.util.*;
public class PermutationChain {
public static void main(String[] args) {
int t,n;
Scanner sc=new Scanner(System.in);
PrintWriter out=new PrintWriter(System.out);
t=sc.nextInt();
for (int g=0; g<t; g++){
n=sc... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 17 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | df3aa5bc0936a9623855537d0006b13b | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.PrintWriter;
public class MyClass {
public static void main(String args[]) {
Scanner sc =new Scanner(System.in);
int tc = sc.nextInt();
PrintWriter out = new PrintWriter(System.out);
int[] arr = new int[101];
while(tc != 0){
tc--;... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 17 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 1e28e35d8d814b5c318a6eff3fb1fff1 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes |
import java.util.*;
public class Test1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0) {
int n = sc.nextInt();
System.out.println(n);
int[] arr = new int[n+1];
StringBuilder sb = new StringBuilder();
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 17 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 6b3b1148da82b4aeab53fe2fc4f0147e | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main{
public static int[] array(BufferedReader br,int n) throws IOException{
String [] values = br.readLine().split(" ");
int [] arr = new int[n];
for(int i =0; i<n; i++){
arr[i] = Integer.parseInt(values[i]);
}
... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 17 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 5f68d784421d70cdc5d46f9d85df3d76 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | /**/
import java.io.*;
import java.util.*;
import java.lang.*;
public class PermutationChain {
public static void main(String[] args) throws IOException{
FastReader s = new FastReader();
PrintWriter out = new PrintWriter(System.out);
int t = s.nextInt();
while(t-->0){
i... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 17 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output | |
PASSED | 45e90878a7e805a351f71712928286c2 | train_109.jsonl | 1659623700 | A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p... | 256 megabytes | import static java.lang.System.out;
import static java.lang.Math.abs;
import static java.lang.Math.min;
import static java.lang.Math.max;
import static java.lang.Math.log;
import java.util.*;
import java.lang.*;
import java.io.*;
public class a_Codeforces {
public static void main(String[] args) throws... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 17 | standard input | [
"constructive algorithms",
"math"
] | 02bdd12987af6e666d4283f075f73725 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain. | 800 | For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i... | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.