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 | dbdea20af8a097a2670614942332e1e5 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;
import java.util.Map.Entry;
public class MacroTemplates
{
public static void main(String hi[]) throws Excep... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 8d62988e56f32adf629b3dfa4ac837fa | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;
import java.util.Map.Entry;
public class MacroTemplates
{
public static void main(String hi[]) throws Excep... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | a51e8602ed6d875a5ae96f292b84ed70 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Collections;
import java.util.Set;
import java.math.BigInteger;
import java.util.Map.Entry;
public class Codeforces
{
static FastScanner ob = new FastScanner();
static PrintWriter out = new PrintWriter(System.out);
public... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 90ad406f8d9de866ea90d07b699a6208 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Mainnn{
// static final File ip = new File("input.txt");
// static final File op = new File("output.txt");
// static {
// try {
// System.setOut(new PrintStream(op));
// System.setIn(new FileInputStream(ip));
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | c84a6972ddbb339a52c4297e2a33e3f5 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes |
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.HashMap;
public class PleasantPairs {
private static long solve(int n, HashMap<Integer, Integer> map) {
long count = 0;
for (int i = 3; i < 2 * n; i++) {
int ref =... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | e9e2bd84f91e23c8a544b8c8203a33ec | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes |
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.HashMap;
public class PleasantPairs {
private static long solve(int n, HashMap<Integer, Integer> map) {
long count = 0;
for (int i = 3; i < 2 * n; i++) {
int ref =... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 3f0d5ba79c120eb657c6138f0d54994c | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.HashMap;
public class PleasantPairs {
private static long solve(int n, HashMap<Integer, Integer> map) {
long count=0;
for (int i=3; i<2*n; i++){
for( int j=1; j<=Mat... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | a09ad8f97fca838e337e3dfcbbc19652 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
import java.lang.*;
public class App {
public static long Solution(int n, int[] arr) {
long ans = 0;
HashMap<Integer, Integer> m = new HashMap<>();
for (int i = 0; i < n; i++) {
m.put(arr[i], i + 1);
}
for (int i = 3; i < 2*n; i++)... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 202df22028c4b974a804d099eeacda4e | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | /*
JAI MATA DI
*/
import java.util.*;
import javax.print.attribute.HashAttributeSet;
import java.io.*;
import java.math.BigInteger;
import java.sql.Array;
public class Main {
static class FR{
BufferedReader br;
StringTokenizer st;
public FR() {
br = new BufferedReader... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 4de6bd8729b0a568955e27cdb812fb90 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception {
FastReader sc = new FastReader();
PrintWriter writer = new PrintWriter(System.out);
int t = sc.nextInt();
while(t-->0) {
int n = sc.nextI... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 1df46fae39cce1cee1f2aa24da8ace3a | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
private FastWriter wr;
private Reader rd;
public final int MOD = 1000000007;
/************************************************** FAST INPUT IMPLEMENTATION ***********... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | c74a3a378f98a1eb54670b68bbd74b6f | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | //package com.company;
import java.util.*;
public class Main2 {
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int n = sc.nextInt();
for(int i=0;i<n;i++){
int k= sc.nextInt();
int[] arr = new int[k+1];
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | f573c19e956c9a617ebab39612b8b314 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | //package Contest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
public class Codeforces {
public static void main(String[] args) throws IOExceptio... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 2e303ca2e32e1ea72477119bdae48dc6 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | /* You are given an array a1,a2,…,an consisting of n distinct integers.
Count the number of pairs of indices (i,j) such that i<j and ai⋅aj=i+j. */
// 1 based indexing
import java.io.*;
import java.util.*;
public class PleasantPairs {
/* Brute force:
1. Pair cannot be less than 3 (as first ... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | b207e8dbae8b52fa9164d101d0f7ded8 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | /* You are given an array a1,a2,…,an consisting of n distinct integers.
Count the number of pairs of indices (i,j) such that i<j and ai⋅aj=i+j. */
// 1 based indexing
import java.io.*;
import java.util.*;
public class PleasantPairs {
/* Brute force:
1. Pair cannot be less than 3 (as first ... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 87924088b1940fddaf35dd5367ef8dd4 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
//import java.util.Stack;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
impo... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 671e4dbc16f8ee1dcd705e1a54f0824e | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
/*
*
*
*/
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t>0) {
int n = sc.nextInt();
int a[] = new int[n + 1];
for (int i = 1; i <=... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | ca0939d4685ea19770cfcab2f63ade56 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
@SuppressWarnings("unused")
public class Round728
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
Input... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 633bf9fd33681648f62ba36fc43de6a5 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class javaTemplate {
public static void main(String[] args) {
FastScanner fs = new FastScanner();
StringBuilder output = new StringBuilder();
int t = fs.nextInt();
for (int tt = 0; tt < t; tt += 1) {
int n = fs.next... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | bee78c63225d055ffb7056a7d75c283a | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class javaTemplate {
public static void main(String[] args) {
FastScanner fs = new FastScanner();
int t = fs.nextInt();
StringBuilder allAns = new StringBuilder();
for (int tt = 0; tt < t; tt += 1) {
int n = fs.next... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | b7b032f8f077e805528c8ed9259e24fd | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int t = scn.nextInt();
while(t-- > 0) {
int n = scn.nextInt();
long [] arr = new long[n + 1];
for(int i = 1; i < n + 1; i++... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 5747277b320b929a7457cbfcc373fd99 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
import java.io.*;
public class cf {
static Reader sc = new Reader();
static PrintWriter out = new PrintWriter(System.out);
static int mod = (int) 1e9 + 7;
public static void main(String[] args) {
int t = sc.ni();
while (t-- > 0) {
int n = sc.ni();
int[] index = new ... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | dc7fd32482303ca6689c4c2805dc33be | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
import java.io.*;
public class cf {
static Reader sc = new Reader();
static PrintWriter out = new PrintWriter(System.out);
static int mod = (int) 1e9 + 7;
public static void main(String[] args) {
int t = sc.ni();
while (t-- > 0) {
int n = sc.ni();
int[] index = new ... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 6a49e3ff1aae02d130fdd825ba6a0772 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
import java.io.*;
public class cf {
static Reader sc = new Reader();
static PrintWriter out = new PrintWriter(System.out);
static int mod = (int) 1e9 + 7;
public static void main(String[] args) {
int t = sc.ni();
while (t-- > 0) {
int n = sc.ni();
int[] index = new ... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 9ee0d80c33691f1e47c2faaab872ac51 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes |
import java.io.*;
import java.util.*;
import java.lang.*;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
// Sachin_2961 submission //
public class CodeforcesA {
public void solve() {
int n = fs.nInt();
int[]ar = new int[n];
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | e0d1d289d1a9b81590714aff7b4a5bd7 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import javax.swing.*;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.*;
public class Main
{
static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
static StreamTokenizer st=new StreamTokenizer(br);
static PrintWriter pw=new PrintWriter(new Outp... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 5fc81dba5d752210d4adb7413d3d8ab2 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | // HOPE
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | e33bde585d7bcb46920aabfc95f3f090 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | // HOPE
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 702db59fb5d4dd2fd7b1202c713f6ef2 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | // HOPE
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 145cb73ee1d3f5b418724703b9c39777 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | // HOPE
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | a1d13332bf37d44de8867fb1535cd693 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int t = sc.nextInt();
for(int k=1 ; k<=t ; k++)
{
int n = sc.nextInt();
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | b32c00ff47e9cbaab8fc603bb650010d | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.Scanner;
public class codeforces1541B {
public static void main(String[] args)
{
Scanner in=new Scanner(System.in);
int testCases=in.nextInt();
while(testCases-- > 0){
int n=in.nextInt();
int x[]=new int[n+1];
for(int i=1;i<=... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 7441de9b7236efd0f20fe995714a4cd4 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
static long mod = (int)1e9+7;
static PrintWriter out=new PrintWriter(new BufferedOutputStream(System.out));
public static void main (String[] args) throws java.lang.Exception
{
FastReader sc =new FastReader(... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 8aac5ec96282021eebfe850628a3fe74 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.Scanner;
public class PleasantPairs {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
int[] a = new int[n + 1];
for (int i = 1;i <... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 6726c7ab7f3c362a9807ed61c8876f52 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.lang.*;
import java.util.*;
public class GFG {
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reader()
{
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 3361d7a1d1421c2f0d88b3b9e6c3a85e | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class PleasantPairs {
public static void main(String args[]) throws IOException {
FastReader sc = new FastReader();
PrintWriter out = new PrintWriter(System.out);
int tc, i, j;
String s;
char p;
tc = sc... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 6355bbfd6ee6a9eae295fd608726955c | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class PleasantPairs {
public static void main(String args[]) throws IOException {
FastReader sc = new FastReader();
PrintWriter out = new PrintWriter(System.out);
int tc, i, j;
String s;
char p;
tc = sc... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 84893d73e13ceb703faa413d6b003e55 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class PleasantPairs {
public static void main(String args[]) throws IOException {
FastReader sc = new FastReader();
PrintWriter out = new PrintWriter(System.out);
int tc, i, j;
String s;
char p;
tc = sc... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 21b61cdeb6bb5df7b8b34e1c2a1365fe | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes |
/*
Author : Kartikey Rana
from MSIT New Delhi
*/
import java.util.*;
import java.util.Arrays;
import java.util.Collections;
import javax.sql.rowset.serial.SerialArray;
import javax.swing.text.html.HTMLDocument.HTMLReader.PreAction;
import java.io.*;
import java.math.*;
import java.sql.Array;;
p... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 358f15cc39981caccf309d5dd4ebd60f | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class practice{
public static void main(String[] args){
FastScanner r = new FastScanner();
int t = r.i(),n,arr[];
StringBuilder ans = new StringBuilder("");
int count;
wh... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | ed25760b2dbead3f22e1efdd360b90ba | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class MyClass
{
public static void main(String []args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 14aede9a2ff521cfc47aaf830eb92993 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws java.lang.Exception{
Scanner sc=new Scanner(System.in);
int T=sc.nextInt();
while(T-->0) {
int n=sc.nextInt();
int a[]=new int[n+1];
for(int i=1;i<=n;i++) {
a[i]=sc.nextInt();
}
long c=0;
for(... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | d67495088b5ab4420089031b351fbef5 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
public class scratch{
static Scanner sc= new Scanner(System.in);
/* class Math{
static int gcd(int a,int b){
if(a==0){
return b;
}else{
return gcd(b,a%b);
}
}
static int lcm(int a,int b){
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 2f1cb82b3283a77f5d052b94ce892c19 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
public class scratch{
static Scanner sc= new Scanner(System.in);
/* class Math{
static int gcd(int a,int b){
if(a==0){
return b;
}else{
return gcd(b,a%b);
}
}
static int lcm(int a,int b){
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | dac3fc070ce4d20e3f84a69db04911db | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
// Author : Savan Patel
public class B_Pleasant_Pairs implements Runnable {
static class PP implements Comparable<PP>{
int ind,val;
PP(int k,int v){
ind=k;
val=v;
}
public int compareTo(PP x){
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 6ce35bdcca405468e942efd39ef9d45d | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;
import java.io.IOException;import java.io.InputStream;import java.io.PrintWriter;
import java.lang.annotation.Retention;import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Array;import java.lang.reflect.Field;impo... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 4107f0c82896f31b4e7304e8109cd2a6 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.HashMap;
import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int test = scn.nextInt();
while (test-- > 0) {
int n = scn.nextInt();
int count = 0;
HashMap<Inte... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | cd172194ea4434bda11765cfef0356f3 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.lang.*;
public class Codeforces {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new Bu... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 76d2c8ea7503c66dbf70953895e5c991 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes |
import java.io.*;
import java.util.*;
public class B_Pleasant_Pairs {
public static void main(String[] args) {
try {
StringBuilder ans = new StringBuilder();
FastScanner scn = new FastScanner();
int testCase = scn.nextInt();
for (int i = 0; i < tes... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 204736b6fbcdd7bbf06e181861f2dc19 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
public class PleasantPairs {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0) {
int n = sc.nextInt();
long a [] = new long [n+1];
a [0] = 0;
for(int i =1;i<=n;i++) {... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 3b126463077f6d4b738e9d03e72e1e39 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.Arrays;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Solution {
static class FastReader {
BufferedReader br;
StringTokenizer st;... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 3e4dc061b5e26a3b5b922cbe3e1f5038 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.Scanner;
/**
*
* @author Acer
*/
public class PleasandPairs_B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while(T-->0) {
int n=sc.nextInt();
int a[]=new int[n+1];
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | cea7609257d9f03630159b3dd54fadc0 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.Scanner;
/**
*
* @author Acer
*/
public class PleasandPairs_B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while(T-->0) {
int n=sc.nextInt();
int a[]=new int[n+1];
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 31da743f4659a342ad977e7967eb38e2 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes |
import java.util.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class final2
{
static class Pair{
int a;
int b;
}
static class FastReader
{
BufferedReader br;
StringTokenizer st;
publ... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 0a9ac5ce511d49bcb6df740723b08284 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class pleasentPair {
public static void main(String[] args) {
FastReader sc = new FastReader();
int t = sc.nextInt();
for(int o = 0 ; o<t;o++ ) {
int n = sc.nextInt();
int [] arr =... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 5232dbddd3649a3b5691b1724d6202a9 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes |
import java.io.*;
import java.util.*;
public class B
{
public static void main(String[] args)throws IOException
{
FastReader f=new FastReader();
StringBuffer sb=new StringBuffer();
int test=f.nextInt();
while(test-->0)
{
int n=f.nextInt();
int a[]=new int [n+1];
f... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 20d55f9f54233be4edccea6502ed879b | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
BufferedWriter output = new BufferedWrite... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | b064d14801e8cf75af8c09b16a2e964e | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces {
public static void main(String[] args) throws IOException {
FastScanner fs = new FastScanner();
int t = fs.getInt();
while (t-- > 0) {
int n = fs.getInt();
int[] ar = fs.getIntArray(n);
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 482ff8e9383ab2809cf19b94450344b4 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 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.Iterator;
import java.util.LinkedList;
import java.util.StringTokenizer;
public class Solve {
static int mod ... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 51010b04d5deca4b1b227cd8cd65fe41 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 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.Iterator;
import java.util.LinkedList;
import java.util.StringTokenizer;
public class Solve {
static int mod ... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | d7504ba87a0feb60e08f0fbab0bef211 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class cp{
//======================================================================================//
//======================================================================================//
static void sopint(int a) {Syst... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 1a9367c75d0f0bfcfd098cc28b14be5c | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
// Created by @thesupremeone on 25/06/21
public class B {
void solve() throws IOException {
int ts = getInt();
for (int t = 1; t <= ts; t++){
int n = getInt();
int[] a = new int[n+1];
for (int i = 1; i <= ... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | b0efcbbcbcae413a956864ba779465b4 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes |
import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
for (int o = 0; o < t; o++) {
int n = scanner.nextInt();
int[] a = new int[n+1];
for (int... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | ada3aa2b7876de553c68cc237799c860 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
/*
array 𝑎1,𝑎2,…,𝑎𝑛
Count the number of pairs of indices (𝑖,𝑗) such that 𝑖<𝑗 and 𝑎𝑖⋅𝑎𝑗=𝑖+𝑗.
3 : testCases
2 : length of array 𝑎
3 1: 𝑛 space separated integers 𝑎1,𝑎2,…,𝑎𝑛 (1≤𝑎𝑖≤2⋅𝑛)
----
3
6 1 5
----
5
3 1 5 9 2
*/
public class Main {... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | b11ad11e62d22c268fd9c75fd1fdc742 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.BufferedReader;
import java.util.StringTokenizer;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
public class B {
public static void main(String[] args) {
FastReader fr = new FastReader();
PrintWriter out = new Pr... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 11 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 5940d0fd2749ce7b4e23c0f4022c6dd9 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Collectors;
public class CFMain {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
int[] values = new int[t];
for (int i = 0; i < t; i++) {
values[i] = sc.nextInt();
... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 8b61ff6af487fb698ee2c087d04c6275 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.*;
public class pretty{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t>0)
{int n,a[];
n=sc.nextInt();
a=new int[n];
for(int i=0;i<n;i++)
{
a[i]=i+1;
}
if(n==2)
{System.out.println(2+" "+1);}
else
if(n==3)
{System.out.... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 0ef52dc0df1f48d01f35a23788c83ebd | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
int n = sc.nextInt();
int arr[] = new int[n];
... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 8faf014ab4701c13b60d9a281b1fd562 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.awt.image.AreaAveragingScaleFilter;
import java.io.*;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.*;
public class Pratice {
static final long mod = 1000000007;
static StringBuilder sb = new StringBuilder();
static int xn = (int) (2e5 + 10);
static... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | ee6b2ca9e073d8e9aab168bede2df6fd | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.*;
public class PrettyPermutations {
// public static int[] permutation(int start, int end, int[] array){
// if (end -start == 2){
// array[end-1] = end - 1 ;
// array[end-2] = start ;
// array[start-1] = end ;
// return array;
// ... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | a04fff628ef44ef2bc2572c208f54934 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in).useLocale(Locale.US);
int t = sc.nextInt();
for(int i = 0; i<t; i++) {
System.out.println(solve(sc));
}
}
public static Stri... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 2ae5bc127b953041cca0f06b63d5f194 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.*;
public class Solution{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
int n = sc.nextInt();
int arr[] = new int[n];
for(int i=0; i<n; i++){
arr[... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 42780d6dfa06d760f25c42969eead0b4 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.*;
public class Solution{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
int n = sc.nextInt();
int arr[] = new int[n];
for(int i=0; i<n; i++){
arr[... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 07efb83b8fbd81f4fc025f969dbff382 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class Solution {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int t = ni()... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 06bc0078d23bf7313af16cfcb972141c | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main
{
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int test = Integer.parseInt(br.readLine());
... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | eaf37f3127b932f3c481818be44c468b | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution{
public static void main(String args[]) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t= Integer.parseInt(br.readLine());
while(t-->0){
int n=Integer.parseInt... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 81b94a21c6de630be6107ee60c03c360 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputSt... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 94b2af9559dad1fa866c7a1708741fb8 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes |
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.Input... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 252a0537eb7d8cca47c140bfeceda429 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class PrettyPermutation {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | ed73a2b61183afd5dbaa0a2ec9947db2 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputSt... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 43c2273ed48831caeb2df0b7512a3cee | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.*;
public class Code {
public static void main(String[] args) {
Scanner Sc = new Scanner(System.in);
int t = Sc.nextInt();
while(t-- >0) {
int n = Sc.nextInt();
int arr[] = new int[n];
for(int i=0;i<n;i++){
arr[i] = i+1;
}
for(int i=0;i<n-1;i... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 2de5a216f78152a9fa28763d87227a96 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.io.*;
import java.util.*;
public class div_2_728_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();
if(n==2 || n==3)
{ out.print(n+" ");
for(int i=1... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 89611eea287f430ebd5ce243631c3b56 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while (t-- > 0) {
int n = in.nextInt();
int i = 0;
// if (n <= 3) {
// for (i = n; i >= 1;... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | e9fc4aa273ef7b338b4ac4f027251392 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.Scanner;
public class Permutations {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
int i, n;
while (t-- > 0) {
n = in.nextInt();
if (n % 2 != 0) {
System.out.prin... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | f2243d0f9d170b668b0b0f1c540bea74 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static void main(String args[] ) throws Exception
{
Solve instance = Solve.getInstance();
instance.test();
}
}
class So... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 072273f0f63293c4817c22b52116f660 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 866255e081b2b6dfd5c621989d4498e4 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.Scanner;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Sanjeev
*/
public class prettypermutations {
public static void main(... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 67f7f2181bbe941efe21e23c263d3336 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes |
// Working program with FastReader
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
static class FastReader {
BufferedReader br;
StringTokenizer st;
pub... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | d7935875384ecedb7e41c80901481cff | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args) throws IOException {
OutputStreamWriter osr = new OutputStreamWriter(System.out);
PrintWriter o = new PrintWriter(osr);
FastReader fr = new FastReader();
... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 027b393d3a3a1a8f9b3af65f6ec99db2 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
public static void main(String[] args) {
// write your code here
PrintWriter out = new PrintWriter(System.out);
FastReader sc... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 1df7ef25a77e9bd8df707b0963cf80bc | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.Scanner;
public class Rough2 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int test_cases = sc.nextInt();
for(int i=0; i<test_cases; i++) {
int cats = sc.nextInt();
int k = 1;
if(cats%2==0)
while(k<cats) {
if(k==1)
... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | b79b56130e75ddffcfb35106ed20039d | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class A_PrettyPermutations_800 {
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 = ... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 1d09e9cf946b749647a616f500f82ee3 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class snippet {
static StringBuilder sb;
static dsu dsu;
static long fact[];
static int mod = (int) (1e9 + 7);
static void solve() {
int n = i();
if(n%2==0){
for(int i=0;i<n;i+=2){
System.out.print((i+2)+" "+(i+1)+" ");... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 73a05f26f51f7a34c8847029c638d8ba | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.Scanner;
public class A {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int t = sc.nextInt();
while (t-- > 0) {
solve();
}
}
private static void solve() {
int n = sc.nextInt();
if (... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 88ef6a6f91fcf5e79834bd7f1d8fc740 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | /*==========================================================================
* AUTHOR: RonWonWon
* CREATED: 27.06.2021 22:50:23
/*==========================================================================*/
import java.io.*;
import java.util.*;
public class A {
public static void main(St... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 467912e1413503f121a6d7e2365d79ae | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.*;
public class PrettyPermutatios {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while(t-->0)
{
int n = in.nextInt();
if(n%2!=0)
{
for(int i=0; i<n-... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | ac5f9bb6b7f3b8756c1239790a8cf444 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes |
import java.util.Scanner;
public class Pretty_Permutations {
public static void solve(int n){
int[] arr=new int[n+1];
for (int i=1;i<=n;i++){
arr[i]=i;
}
if (n%2==1){
int temp=arr[n-1];
arr[n-1]=arr[n];
arr[n]=temp;
... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 9cbfb3385dbceb36240cf549d5b40681 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | //Utilities
import java.io.*;
import java.util.*;
public class A {
static int t;
static int n;
public static void main(String[] args) throws IOException {
t = in.iscan();
while (t-- > 0) {
n = in.iscan();
if (n % 2 == 1) {
out.print("3 1 2 ");
for (int i = 4; i <= n; i += 2) {
... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 2dd9c42e9cc59ca2cb04a2e9c8c81353 | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | //--------I---------
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
//--------O---------
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.OutputStreamWriter;
//--------Arrays---------
import java.u... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output | |
PASSED | 6373b039b5552c6dc63a07df5cb0dbcd | train_107.jsonl | 1624635300 | There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
import java.util.stream.*;
public class Main {
public static void main(String[] args) throws Exception {
FastScanner sc=new FastScanner();
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
new... | Java | ["2\n2\n3"] | 1 second | ["2 1 \n3 1 2"] | NoteFor the first test case, there is only one possible permutation that satisfies the conditions: $$$[2, 1]$$$.The second test case was described in the statement. Another possible answer is $$$[2, 3, 1]$$$. | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"implementation"
] | f89bd4ec97ec7e02a7f67feaeb4d3958 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first and only line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the number of cats. It can be proven that under the constraints of the problem, an ans... | 800 | Output $$$t$$$ answers, one for each test case. Each answer consists of $$$n$$$ integers — a permutation with the minimum total distance. If there are multiple answers, print any. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.