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 | 26ff77284a0176ea3b8aac49ec41ac18 | 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.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
/**
*
* @author xpeng
*/
public class codeforces {
// Working program using Reader Class
public static void print... | 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 8 | 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 | 793ef3a8a03426b328b79f8fae2dfc9d | 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 {
public static void main(String[] args) {
new Thread(null, () -> new Main().run(), "1", 1 << 23).start();
}
private void run() {
FastReader scan = new FastReader();
PrintWriter out = new PrintWriter(System.out);
... | 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 8 | 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 | 39bc29c38c5ed2b57d84ef95a0bbd4ec | 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 IOException{
Scanner in=new Scanner(System.in);
PrintWriter pr = new PrintWriter(new OutputStreamWriter(System.out));
int T=in.nextInt();
int arr[]=new int [1000010];
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 8 | 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 | 8ea179a7c00c3575a54d75ed5f569b47 | 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 | /******************************************************************************
Practice,Practice and Practice....!!
*******************************************************************************/
import java.util.*;
import java.io.*;
public class Main{
static class FastReader{
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 8 | 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 | 64de16c4a91f296a65818d743426ae85 | 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 Solution {
public static void swap(int[] arr, int i, int j) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
public static void print(int[] arr) {
StringBuilder sb = new StringBuilder();
for(int a: arr)
sb.append(a).append(" ");
System.out.pr... | 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 8 | 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 | 252a101ae156ee59d5221adcd193128f | 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.Scanner;
public class Test {
private static PrintWriter out = new PrintWriter(System.out);
private static void print(int[] a) {
for(int num : a)out.print(num + " ");
out.println();
}
private static void swap(int[] a, int i, int j) {
int temp = a[i];
a... | 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 8 | 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 | ef11b7826b39c456679f79899f9eca74 | 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 Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
StringBuilder res = new StringBuilder();
while (t-- > 0) {
int N = sc.nextInt();
int[] arr = new 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 8 | 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 | f6ee5ed1adb5a13f3fbb6facad13f191 | 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 | /**
* @Jai_Bajrang_Bali
* @Har_Har_Mahadev
*/
/* Author: Sanat Kumar Dubey (sanat04)
* File: B.java
*/
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class B {
static void swap(int a[],int i,int j){
int temp=a[i];
a[i]=a[j];
... | 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 8 | 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 | a1645b4cd6a4711c5c421debbff63ce8 | 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.Scanner;
import java.util.StringTokenizer;
public class forCP {
public static void main(String[] args) throws IOException {
Fa... | 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 8 | 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 | f27869f4f30d9e6e514bbfefcb48db75 | 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.Arrays;
import java.util.StringTokenizer;
/**
* B. Permutation Chain
*/
public class Main {
static class FastReader {
BufferedReader reader;
StringTokenizer tokenizer;
FastReader(InputStream stream) {
reader = new Buffered... | 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 8 | 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 | e702786adb03604fe26df9554ad9f10c | 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 cp{
public static void main(String[] args)throws Exception{
BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
PrintWriter pw=new PrintWriter(System.out);
int t=Integer.parseInt(br.readLine());
w... | 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 8 | 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 | 5f4cae042c047203d44acd3fcffb7ed4 | 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 whatever //do not write package name here */
import java.util.*;
import java.io.*;
public class Main {
public static void main (String[] args) throws IOException{
//Scanner sc = new Scanner(System.in);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter 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 8 | 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 | 5333ba86ad7c4300b6a69082c9155a9f | 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.lang.reflect.Parameter;
import java.math.BigInteger;
import java.util.*;
public class Habd {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int tc = sc.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 8 | 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 | 971d2c3626624ec506774da959ba98a3 | 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 {
FastReader in = new FastReader();
int numCases = in.nextInt();
StringBuilder ans = new StringBuilder();
while(numCases-->0)
{
int n = 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 8 | 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 | 9422e267544da2fd17b28b364b39ab27 | 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 {
static Scanner sc;
static PrintWriter pw;
static int mod = 1000000007;
public static void main(String[] args) throws IOException, InterruptedException {
sc = new Scanner(System.in);
pw = new PrintWriter(System.... | 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 8 | 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 | 5f56a066d05f85b456ed0ff62becaecd | 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 {
static List<List<Integer>> perms = new ArrayList<>();
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int test = 0; test < t; test++) {
perms.clear()... | 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 8 | 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 | bfed50acb6f8938f05e9c986a98a67fb | 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 permchain {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
String[] perms = new String[100];
for (int i = 1; i <= 100; i++){
int start = 2;
perms[i - 1] = "";
for (int j = 0; j < i; j++){
perms[i-1] += start +... | 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 8 | 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 | cd1348424ec22acbbc08e0d107c30cd5 | 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 div_4_806_a {
public static void main(String args[]){
FScanner in = new FScanner();
PrintWriter out = new PrintWriter(System.out);
int t = in.nextInt();
while(t-->0) {
int n=in.nextInt();
out.println(n);
for(int i=1;i<=n;i++)
out... | 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 8 | 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 | f819490d4fc38c4f0d1e0804173b216b | 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.OutputStreamWriter;
import java.io.PrintWriter;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in=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 8 | 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 | a69f0dc8bd3dc78b5e7cdcb136f36ec2 | 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.math.BigInteger;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int t = in.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 8 | 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 | cbd7ac6ca5f3980f50f90b0995f3c30b | 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.text.*;
import java.math.*;
import java.util.regex.*;
public class JaiShreeRam{
static Scanner in=new Scanner();
static long systemTime;
static long mod = 1000000007;
static ArrayList<ArrayList<Integer>> adj;
static int seive[]=new int[1000001];
static ... | 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 8 | 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 | a5e0f7b5804cd10c282d1fedbe9184aa | 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;
import java.util.*;
import java.io.*;
import java.lang.*;
public class Codechef
{
public static void main(String[] args)
{
FastReader sc = new FastReader();
PrintWriter pw = new PrintWriter(System.out);
int test;
test = 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 8 | 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 | d1f9f2e9ce92fe7690e874c3d8f174eb | 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.util.StringTokenizer;
public class Permutation_Chain
{
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reade... | 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 8 | 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 | 2517bc83e40d92ac8dd75e6b2fa708fd | 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.concurrent.TimeUnit;
import java.io.*;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class B1716B{
public static void solve(){
}
public static void main(String args[])throws IOException, Pa... | 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 8 | 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 | 5bef662e676bbbc151183a2ebf35f0fb | 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.*;
/**
*
* @author eslam
*/
public class IceCave {
static class Kattio extends PrintWriter {
private BufferedReader r;
private StringTokenizer st;
// standard input
public Kattio() ... | 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 8 | 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 | f150fb34414777a8e5b75776d276cbfc | 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 kriti;
import java.math.*;
import java.io.*;
import java.util.*;
public class A
{
static PrintWriter out = new PrintWriter(System.out);
static FastReader in=new FastReader();
public static void main(String args[])throws IOException
{
int t =i();
outer: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 8 | 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 | cdb6a11d54306a3777f444e238a25ab0 | 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.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.InputMismatchException;
import java.util.List;
public class PermutationChain {
static InputReader inputReader=new InputReader(System.in);
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 8 | 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 | e29ef2c4f3fec4fc0c35a75c13298631 | 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.security.cert.X509CRL;
import java.util.*;
import java.lang.*;
import java.util.stream.Collector;
import java.util.stream.Collectors;
@SuppressWarnings("unused")
public class Main {
static InputStream is;
static PrintWriter out;
//static String INPUT = "in.txt";
static Str... | 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 8 | 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 | ae3683d37bc1a6d7cdd60458a9e74ed8 | 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 | //KENAA
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Queue;
import java.util.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 8 | 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 | 341d38ce8d7e08692fd002b35e9f9822 | 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 {
// Alphabet size (# of symbols)
public static class Pair implements Comparable < Pair > {
int d;
int i;
Pair(int i, int d) {
this.d = d;
this.i = i;
System.out.println("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 8 | 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 | d97dec2a9fe1f2a310d276ce08a300e9 | 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.InputStream;
import java.io.PrintWriter;
import java.io.*;
import java.util.*;
import java.util.LinkedList;
import java.math.*;
import java.lang.*;
import java.util.PriorityQueue;
import static java.lang.Math.*;
@SuppressWarnings("unchecked")
public class Solution 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 8 | 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 | 75d9315b2df2340aafa3a8adc7d3b254 | 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 final class Main {
//int 2e9 - long 9e18
static PrintWriter out = new PrintWriter(System.out);
static FastReader in = new FastReader();
static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(0, 1), new Pair(1, 0), new Pair(0, -1)};
static... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 8 | 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 | 57aba5155383f49e999aa97371c5a943 | 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.math.BigInteger;
import java.util.*;
import java.io.*;
public class Vaibhav {
/*-----------==============---------------------------------------------------------------------------------------------------------------------------------------------------------------------... | 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 8 | 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 | 1a72d7d9a8c663ab06e2675f49cc842d | 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.util.stream.*;
public class App {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
public static void main(String[] args) throws Except... | 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 8 | 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 | 96861ca273712c280ea9b0097bc8a86a | 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 Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
for (int i = 0; i < t; i++) {
int n = scanner.nextInt();
System.out.print(solve(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 8 | 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 | 6fcf577bcc07989980095105c45a6fd0 | 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.*;
import java.util.*;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
static PrintWriter 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 8 | 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 | 8aff86e50d906f024b77627f9cd65950 | 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.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeMap;
public class B {
public static void main(String[]args) throws IOExcept... | 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 8 | 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 | 95473647938d2360202ff7b0a013108a | 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 | /*
Goal: Become better in CP!
Key: Consistency and Discipline
Desire: SDE @ Google USA
Motto: Do what i Love <=> Love what i do
If you don't use your brain 100%, it deteriorates gradually
*/
import java.util.*;
import java.io.*;
import java.math.*;
public class C {
static StringBuffer str... | 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 8 | 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 | ab17e8539e8d66504aafa1c71d9c4116 | 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 sc = new Scanner(System.in);
StringBuilder sb = new StringBuilder();
int T= sc.nextInt();
while (T-->0) {
int n = sc.nextInt();
int[] arr = new int[n];
for (int i=0; i<n; ++i)
arr[i] = i+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 8 | 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 | 42e6adb1e323b0410c2431370a684e58 | 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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.*;
import static java.time.Year.isLeap;
public class Main {
public static voi... | 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 8 | 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 | 24f6fcc4b401d5cc0336896e86c82e6f | 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 codeforces1716B {
public static void main(String[] args) throws Exception {
FastReader in = new FastReader();
int numCases = in.nextInt();
StringBuilder ans = new StringBuilder();
while(numCases-->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 8 | 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 | 48902e1e4c791927ef5cb35482af0623 | 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.time.*;
import static java.time.temporal.ChronoUnit.MINUTES;
import javafx.util.Pair;
public class Program {
public static void print(Object str) {
System.out.print(str);
}
... | 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 8 | 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 | 0cdbe07a1af053ffd55708d87172ba79 | 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.*;
@SuppressWarnings("unused")
public class B_Permutation_Chain {
public static void main(String[] args) {
MyScanner sc = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
... | 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 8 | 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 | 5f75e47bde4187260b90ea999a6fb35b | 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);
int t = in.nextInt();
for (int zz = 0; zz < t; zz++) {
int n = in.nextInt();
int[] a = new int[n];
for(int i = 0; i < 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 8 | 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 | 377ee3c0d8ce2fc9b0a15f2b465b1725 | 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 | // "static void main" must be defined in a public class.
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
FastScanner fs=new FastScanner();
PrintWriter out=new PrintWriter(System.out);
int T = fs.nextInt();
for(int i = 0; i < T; 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 8 | 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 | 05a9fa58ab2aadddc4ab8cf76d01c46a | 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 Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
int t = Integer.parseInt(in.read... | 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 8 | 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 | 94ab2b343343ef98b774859a3fee45b7 | 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 | //created by Toufique on 04/08/2022
import java.io.*;
import java.util.*;
public class EDU_ROUND_133B {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int t = in.nextInt();
for (int tt = 0; tt ... | 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 8 | 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 | 92e1e9f52941e398be1e67b47f088bbb | 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 Codeforces {
static int M = 1_000_000_007;
static int INF = 2_000_000_000;
static int N = (int) 2e5 + 1;
static long[] factorial;
static boolean[] isPrime = new boolean[N+1];
static final FastScanner fs = new FastScanner();
stat... | 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 8 | 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 | 5893f9d0ff465c3f61c0889c24f5a4cb | 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 Cses {
static boolean[] table = new boolean[10001];
static StringBuilder sb = new StringBuilder();
static TreeSet<String> sn = new TreeSet<>();
static List<Long> sm = new ArrayList<>();
static boolean[][] visited = new boolean[7][7];
... | 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 8 | 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 | d6c124fb2c7e54579d787676631236c0 | 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.math.BigInteger;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.*;
import static java.lang.System.out;
public class app {
public static ArrayList<ArrayList<Integer>>as=new ArrayList<>();
public static Boole... | 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 8 | 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 | 79b5a12e4c2cc4478dd25fed1a4737cc | 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{
PrintWriter out = new PrintWriter(System.out);
Input in = new Input();
int test = in.getInt();
while(test-->0){
int n = in.getInt();
out.println(n);
int a[] = new int[n];
f... | 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 8 | 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 | 73bfd3bbad1e2a5036b0854c6b2dee36 | 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;
/**
*
* @author Acer
*/
public class NewClass_B {
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);
... | 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 8 | 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 | 7b0f047d1499bb4c22309eb85998c891 | 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.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
static int n, t, w;
static long cnt, mod = (int) 1e9 + 7;
static int[] time, ... | 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 8 | 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 | b9739673ed92eaa6dd6e0ff157c7a8db | 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 Main{
static int N=100010;
public static void main(String[] args) {
int t=cin.nextInt();
while(t-->0) {
int n=cin.nextInt();
out.println(n);
int a[]=new int[n+1];
for(int i=0;i<=n;i++) {
a[i]=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 8 | 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 | 004f64fa450c727546d1b9b5388f87b4 | 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.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.util.Arrays.sort;
import java.util.*; import java.io.*;import java.math.*;
public class Main{
static int mod=1000000007;
static int max=Integer.MAX_VALUE,min=Integer.MIN_VALUE;
... | 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 8 | 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 | 95707d73c22f6a6d2113f9b61cd723f4 | 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.Arrays;
import java.util.StringTokenizer;
public class round177 {
static int[] arr,segmenttree;
static PrintWriter out;
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
out=new PrintWriter(System... | 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 8 | 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 | e4b8e92b1ed4689194fd087b6ff47fa0 | 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
{
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
FastReader sc = new FastReader();
int t = 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 8 | 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 | d0163237eb258f844cf9069d6be58f9d | 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 | // 1 2 3 4 5 -> 5
// 2 1 3 4 5 -> 3
// 3 1 2 4 5 -> 2
// 4 1 2 3 5 -> 1
import java.util.*;
import java.io.*;
public class c306
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
StringBuilder sb = new StringBuilder();
while(t... | 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 8 | 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 | 23a325636bf4c1f1731a5042c46f3a81 | 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.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
public class Main {
pu... | 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 8 | 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 | 1310d7aedce3cc1ec3e25ff3d1f2f6d8 | 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 final class Codeforces2
{
public static void main (String[] args) throws java.lang.Exception
{
FastReader sc = new 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 8 | 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 | 0359ec14918f715c53594495af69562e | 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;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
public class cfContest1716 {
public static void main(String[] args) throws IOException {
Reader scan = new Reader();
int t = scan.nextInt();
StringBuilder sb = ... | 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 8 | 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 | a8dae3149526dfefb8b914fe19adf341 | 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 C {
public static long gcd(long a, long b) {
return a == 0 ? b : gcd(b, a % b);
}
public static void print(int[] a) {
for (int i = 0; i < a.length; i++) {
System.out.print(a[i] + " ");
}
System.out.println();
}
public static vo... | 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 8 | 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 | 50acc16cadd2791954722ac237422c5a | 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 codeforce.educational.r133;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Collections;
impor... | 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 8 | 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 | 6045a5d987c432282dd7a1076245c1a7 | 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 static java.lang.System.*;
public class Solution {
static MyScanner str = new MyScanner();
public static void main(String[] args) throws IOException {
long T = l();
... | 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 8 | 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 | 9011a204a03226c33b83403252d08f82 | 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 Main {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
PrintWriter out =new PrintWriter(System.out);
int t = in.nextInt();
while (t-->0){
int n = in.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 8 | 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 | 105f8f7287806aa52ef5dbc0e4292800 | 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 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintStream out = System.out;
int t = Integer.parseInt(br.readLine());
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 8 | 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 | f1cc1c7fbaeed06c1a85a471ed8708a4 | 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.sql.Array;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Map.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.System.*;
public class Main
{
public void tq() throws Exception
{
st=ne... | 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 8 | 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 | 8c04a3d7a9fdfbc9d6acb7c47840a614 | 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.util.Arrays;
import java.util.Random;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
/*
Solution Created: 16:42:22 04/08/2022
Custom Competitive programming helper.
*/
public class Main {
public static void sol... | 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 8 | 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 | 1d3cc95683950fb99ac0edd7ea1c7930 | 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 B {
public static void main(String[] args) throws IOException {
FastReader in = new FastReader(System.in);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
int t = in.nextInt();
for (int tt = 0; tt < t... | Java | ["2\n\n2\n\n3"] | 2 seconds | ["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"] | null | Java 8 | 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 | 11e5270025661075db29584bbb74e5f0 | 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.reflect.Array;
import static java.lang.Math.*;
// import java .util.Map.Entry;
public class Main
//class bhaiya
{ static int MOD = 1000000007;
static long mod=(long)1e9+7;
static int isPrimeLimit=(int)(1e6);
static class 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 8 | 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 | 23fe4c34bdfe78a775ccd72ea5402866 | 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: RonWonWon
* CREATED: 07.11.2022 17:26:52
/*==========================================================================*/
import java.io.*;
import java.util.*;
public class B {
public static void main(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 8 | 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 | 0f658881bbdf5d1bafe7e47fff786de4 | 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 {
public static void swap (int [] arr , int i , int j) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
public static void main(String[] args) throws IOException {
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 8 | 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 | b25fb6351522b72e1eccd0f92143b1b7 | 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;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
... | 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 8 | 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 | 265ae232c22536cf1483f8e8944cc4ca | 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.FileReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Solution {
static PrintWriter pw;
static FastScanner s;
static int[] a;
public static void ... | 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 8 | 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 | d292ab6cd9dd63048728035cc3b85860 | 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 B1716 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
StringBuilder out = new StringBuilder();
int T = in.nextInt();
for (int t=0; t<T; t++) {
int N = in.nextInt();
out.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 8 | 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 | 62b977581c03cb194f52ca462a977b16 | 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 {
public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
static void solve(int n){
int[] arr = new int[n];
for(int i = 0; i < n; i++){
arr[i] = i + 1;
}
out.printl... | 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 8 | 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 | 56013b62c2bebb84222809e3916445e3 | 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 kg.my_algorithms.Codeforces;
import java.io.*;
import java.util.*;
/*
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out));
FastReader fr = 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 8 | 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 | 7caa80f4eb6e44d5a032ba3fbaab9147 | 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.*;
public class Main
{
public static void main(String[] args)
{
FastScanner input = new FastScanner();
int tc = input.nextInt();
work:
while (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 8 | 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 | 024c0b0afc3953d8b51127303b1ce0c2 | 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.Math;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
public class Main {
static PrintWriter pw;
static Scanner sc;
static StringBuilder ans;
static long mod = 1000000000+... | 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 8 | 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 | 7bd7afdbfe5058635bd69af094e67bf8 | 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 B {
static Scanner in = new Scanner();
static PrintWriter out = new PrintWriter(System.out);
static StringBuilder ans = ne... | 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 8 | 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 | c744c4a1fb691619b2db4160600f1aea | 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 | ab29b151236206d8efbec2b2193e2e63 | 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.*;
public class Main {
static long M = (long) (1e9 + 7);
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = 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 | 2c1845eb8e1f2634fa7948c2ede07e8e | 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.*;
public class Main {
static long M = (long) (1e9 + 7);
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = 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 | 33643a6e3a79e2e9e97cf77d1f579769 | 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.lang.reflect.Array;
import java.math.BigInteger;
/* Name of the class has to be "Main" only if the class is public. */
public class codeforces
{
public static void solver(int i,int n) {
StringBuilder str=new StringBuilder("");
for(int j... | 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 | 9e3bac137283718d8a821163361c525c | 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.util.*;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
public class probB {
public static void main(String[] args) throws IOException{
... | 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 | 1e91864812f7a7acf9fb8615e2716454 | 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.Scanner;
/**
*
* @author Lenovo
*/
public class Main {
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) thro... | 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 | 72ac7c9969cff5e681dff3224fce425a | 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;
/**
*
* @author Lenovo
*/
public class Main {
static PrintWriter out=new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
... | 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 | 999466a4b694726021e2446fa0ab5457 | 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);
// long s =
StringBuilder sb = new StringBuilder();
for (int t= in.nextInt(); t>0; t--){
int n= in.nextInt();
int[] num = new 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 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 | 654301cc3c524f8c630c9e822469386b | 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 lll
{
static class pair{
int x,y;
pair(int x,int y){
this.x=x;
this.y=y;
}
}
static long get(long []a,int i){
return Math.max(0,Math.max(a[i-1],a[i+1])-a[i]+1);
}
static int f(char []... | 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 | cd0b2bb5a745588b04c10a08760ce95d | 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 | 9ad955ca217b7d9b525d95819fc3cc90 | 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(){
while(st==null || !st.ha... | 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 | 27e06ca65a7844dd724da861e5cadbfe | 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.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.ut... | 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 | 55ff5b6703f5292bd32820512ecdfc5f | 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.*;
import java.util.stream.Collectors;
public class P03 {
static class FastReader{
BufferedReader br ;
StringTokenizer st;
public FastReader() {br = new BufferedReader(new InputStreamReader(System.in)); }
String next() {
while(st==null ||... | 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 | 6bf9c1ff50e87b6a3d74477877c17f25 | 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 Main{
static class Node{
int s,e;
String val;
Node left, right;
}
static Node segmentTree(int s, int e, int[] arr){
Node res = new Node();
res.s= s;
res.e = e;
if(s==e){
res.val = 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 | 20b48dc14f9b45668b37c3abfcf52093 | 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.sql.PreparedStatement;
import java.util.*;
public class Main {
static class MyScanner {
BufferedReader br;
StringTokenizer st;
public MyScanner() {
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 | 934c7d2d0621c6a340c749036bdcd848 | 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.*;
public class Main {
public static void main(String[] args) throws IOException {
//Scanner sc = new Scanner(System.in);
long start = System.currentT... | 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 | 8fb856cab55b666c909e0e856890af7b | 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.Random;
import java.util.StringTokenizer;
import java.util.concurrent.ThreadLocalRandom;
// 1 2 3 4
// 2 1 3 4
// 2 3 1 4
// 2 3 4 1
public class CF {
static int[] b;
static Print... | 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 | 2eadc3fc7f35d29298dffed38ce5464b | 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 code4 {
public static void swap(int[] a, int i, int j) {
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int t = input.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 | 941a2ee81c3fd5bf575f18703a67e3bf | 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 FastScanner fs;
static FastWriter fw;
static boolean checkOnlineJudge = System.getProperty("ONLINE_JUDGE") == null;
private static final int[][] kdir = new int[][]{{-1, 2}, {-2, 1}, {-2, -1}, {-1, -2}, {1, -2}, {2, -1}, {2,... | 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 | da8616db8e9c955d077eaf61a5e38e21 | 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;
import java.util.Arrays;
public class HelloWorld {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int test_cases = scan.nextInt();
int[] n = new int[test_cases];
for(int i = 0 ; i < test_cases ; 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.