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 | b7827e040105187f94a78490e798c444 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static PrintWriter out;
static Reader in;
public static void main(String[] args) throws Exception {
input_output();
Main solver = new Main();
solver.solve();
out.close();
out.flush();
}
static int INF = (int)1e9;
static int... | Java | ["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"] | 2 seconds | ["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"] | null | Java 11 | standard input | [
"brute force",
"dfs and similar",
"graphs",
"implementation"
] | 67c748999e681fa6f60165f411e5149d | The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line... | 2,300 | For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them. | standard output | |
PASSED | c5626ac10b74a2e62e79e94dacb48853 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
public class BMain {
public static void main(String[] args) {
QuickReader in = new QuickReader(System.in);
try(PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));)
{
new BMain().solve(in, out);
}
}
int n,m;
public void s... | Java | ["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"] | 2 seconds | ["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"] | null | Java 11 | standard input | [
"brute force",
"dfs and similar",
"graphs",
"implementation"
] | 67c748999e681fa6f60165f411e5149d | The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line... | 2,300 | For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them. | standard output | |
PASSED | 1c3ebc97c9e7271ad538b9adfe8057d2 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF1607F extends PrintWriter {
CF1607F() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1607F o = new CF1607F(); o.main(); o.flush();
}
void main() {
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.... | Java | ["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"] | 2 seconds | ["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"] | null | Java 11 | standard input | [
"brute force",
"dfs and similar",
"graphs",
"implementation"
] | 67c748999e681fa6f60165f411e5149d | The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line... | 2,300 | For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them. | standard output | |
PASSED | 6abdd0302899fa71e54246161ed68bec | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
import java.util.function.*;
import java.io.*;
// you can compare with output.txt and expected out
public class Round753F {
MyPrintWriter out;
MyScanner in;
// final static long FIXED_RANDOM;
// static {
// FIXED_RANDOM = System.currentTimeMillis();
// }
final static String IMPO... | Java | ["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"] | 2 seconds | ["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"] | null | Java 17 | standard input | [
"brute force",
"dfs and similar",
"graphs",
"implementation"
] | 67c748999e681fa6f60165f411e5149d | The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line... | 2,300 | For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them. | standard output | |
PASSED | 19ab44a149b047505153fe6c5f2a0980 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
public class robot_board_2 {
static final int MAX = 2000;
static int N, M;
static int visited[][] = new int[MAX][MAX];
static int time[][] = new int[MAX][MAX];
static char map[][] = new char[MAX][MAX];
static int path_row[] = new int[MAX * MAX + 1];
static... | Java | ["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"] | 2 seconds | ["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"] | null | Java 8 | standard input | [
"brute force",
"dfs and similar",
"graphs",
"implementation"
] | 67c748999e681fa6f60165f411e5149d | The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line... | 2,300 | For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them. | standard output | |
PASSED | 2fead3d34d17b47e3ac51bbb8e30a61c | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.st... | Java | ["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"] | 2 seconds | ["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"] | null | Java 8 | standard input | [
"brute force",
"dfs and similar",
"graphs",
"implementation"
] | 67c748999e681fa6f60165f411e5149d | The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line... | 2,300 | For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them. | standard output | |
PASSED | d096497acdefb165a27154c4d7881571 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.Scanner;
import java.util.Stack;
public class RobotOnTheBoard2Stack {
public static class Node {
int d = -1;
int turnVisited;
public Node (int turnVisited){
this.turnVisited = turnVisited;
}
}
public static void calculateD(Node[][] d, char[][] d... | Java | ["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"] | 2 seconds | ["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"] | null | Java 8 | standard input | [
"brute force",
"dfs and similar",
"graphs",
"implementation"
] | 67c748999e681fa6f60165f411e5149d | The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line... | 2,300 | For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them. | standard output | |
PASSED | a903640d7a4da54ac1b905b1b7515c19 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | // Problem: F. Robot on the Board 2
// Contest: Codeforces - Codeforces Round #753 (Div. 3)
// URL: https://codeforces.com/contest/1607/problem/F
// Memory Limit: 256 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)
import java.io.*;
import java.util.*;
import static java.lang.Math.max;
im... | Java | ["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"] | 2 seconds | ["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"] | null | Java 8 | standard input | [
"brute force",
"dfs and similar",
"graphs",
"implementation"
] | 67c748999e681fa6f60165f411e5149d | The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line... | 2,300 | For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them. | standard output | |
PASSED | d794a96520c4ab8dffa92f3bfb5568c6 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.Math;
public class Main {
public class MainSolution extends MainSolutionT {
// global vars
public void init(int tests_count){}
public class TestCase extends TestCaseT
{
int n, m;
int[][] Mx;
int[][] My;
... | Java | ["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"] | 2 seconds | ["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"] | null | Java 8 | standard input | [
"brute force",
"dfs and similar",
"graphs",
"implementation"
] | 67c748999e681fa6f60165f411e5149d | The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line... | 2,300 | For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them. | standard output | |
PASSED | d067d0f021a3dce494f653b361fe7340 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | // Main Code at the Bottom
import java.util.*;
import java.io.*;
import java.sql.Time;
public class Main implements Runnable{
//Fast IO class
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
boolean env=System.getProperty("ONLINE_J... | Java | ["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"] | 2 seconds | ["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"] | null | Java 8 | standard input | [
"brute force",
"dfs and similar",
"graphs",
"implementation"
] | 67c748999e681fa6f60165f411e5149d | The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line... | 2,300 | For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them. | standard output | |
PASSED | 4df96400beba248aa1bc861e87bbaec8 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {new Main().run();}
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(System.out);
void run() {
for(int q=ni();q>0;q--){
work();
}
out.flus... | Java | ["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"] | 2 seconds | ["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"] | null | Java 8 | standard input | [
"brute force",
"dfs and similar",
"graphs",
"implementation"
] | 67c748999e681fa6f60165f411e5149d | The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line... | 2,300 | For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them. | standard output | |
PASSED | 9b1ceb39fe6ce9c4b97e959365c9b8ff | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
FastReader input=new FastReader();
PrintWriter out=new PrintWriter(System.out);
int T=input.nextInt();
while(T-->0)
{
int n=input.nextInt();
in... | Java | ["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"] | 2 seconds | ["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"] | null | Java 8 | standard input | [
"brute force",
"dfs and similar",
"graphs",
"implementation"
] | 67c748999e681fa6f60165f411e5149d | The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line... | 2,300 | For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them. | standard output | |
PASSED | 42888a2c72352cf12e5f853d9ad8cbe6 | train_108.jsonl | 1635863700 | The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
public class cf {
static FastReader in = new FastReader();
public static void main(String[] args) throws IOException {
int t = i();
while (t-- > 0) {
s();
int n = i(), m = i();
String[] mat = new String[n]... | Java | ["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"] | 2 seconds | ["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"] | null | Java 8 | standard input | [
"brute force",
"dfs and similar",
"graphs",
"implementation"
] | 67c748999e681fa6f60165f411e5149d | The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line... | 2,300 | For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them. | standard output | |
PASSED | 751ae070b2b44457685bd920a9c9cf83 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution{
static class FastReader{
BufferedReader br;
StringTokenizer st;
public FastReader(){
br = new BufferedReader(new InputStreamReader(System.in));
}
String next(){
while(st==... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | b9094d0db183e6f1aba9e8c9123f6d7a | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | f6bb4e78c5b62011f2b99790a4956eec | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes |
import java.awt.datatransfer.FlavorListener;
import java.util.*;
import java.util.regex.Pattern;
public class Main {
boolean[] visited = new boolean[4];
Stack<Integer> stack = new Stack<Integer>();
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 4c71611a425648ed1e1a711b08193c8f | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes |
import java.awt.datatransfer.FlavorListener;
import java.util.*;
import java.util.regex.Pattern;
public class Main {
boolean[] visited = new boolean[4];
Stack<Integer> stack = new Stack<Integer>();
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 7bb9399ed4814f0524a16b2f05fd550d | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes |
import java.awt.datatransfer.FlavorListener;
import java.util.*;
import java.util.regex.Pattern;
public class Main {
boolean[] visited = new boolean[4];
Stack<Integer> stack = new Stack<Integer>();
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | f06be744f158ba3036ec3788edc18e80 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.Math.sqrt;
import static java.lang.Math.pow;
import static java.lang.System.out;
import static java.lang.System.err;
import java.util.*;
import java.io.*;
import java.math.*;
public ... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 983290ac2cf8a282514c5e99cb2146ff | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes |
import java.util.*;
import java.math.*;
import java.io.*;
public class Solution {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
St... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 7285155ed81445e67d0b6a4a6214bddd | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 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.*;
public class Main {
static FastReader sc;
static StringBuilder sb = new StringBuilder();
public stat... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 89620ee12949bbb3e580ada260cbcb3c | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.*;
import java.io.*;
public class Main {
// Graph
// prefix sums
//inputs
public static void main(String args[])throws Exception{
Input sc=new Input();
precalcul... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 46d906eea925b1d42433e8b275bc259e | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/**
* @author 邶风
* @data 2022/2/20 22:33
*/
public class Main {
static class FastReader{
StringTokenizer st;
BufferedReader br... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 51dd0cbc820456298d9ffafdb07badb3 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes |
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
public class Solution {
/* -------------------------------------- Main Start ----------------------------------- */
public static void main(String[] args) throws IOException {
FastReader fs = new FastReader();
Str... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | b8c693b6ea32f17e9f14e8765738a52d | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.Scanner;
import java.util.Queue;
import java.util.LinkedList;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.io.BufferedReader;
import java.io.IOException;
public class buildthepermutation {
public static void main(String[] args) throws IOException {
cla... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | a1482c3d4755801117739eeb30567ef6 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
import java.io.*;
public class MergeKSorted {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(
new InputStreamReader(System.in));
}
String... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 3da8dd6dd11ec016eb53908f223b8900 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.BufferedReader;
import java.lang.*;
import java.io.FileReader;
import java.io.IOException;
import java.math.BigInteger;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.util.*;
impo... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | f3d09e4326971c66a1bbdba7f09c1557 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.lang.*;
import java.util.*;
import java.io.*;
import java.awt.Point;
public class A
{
static class Ans {
int x, y, z;
Ans(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
}
void solve_test() {
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 4796df47bb39565063024a0346a3ba3a | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.security.cert.X509CRL;
import java.util.*;
import java.lang.*;
import java.util.stream.Collector;
import java.util.stream.Co... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 60b3268617a8f110879bb37455ab9399 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.*;
import java.util.*;
public class codeforces {
static class in {
static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer tokenizer = new StringTokenizer("");
static String next() throws IOException {
while (!t... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 71b281d5e86d96ebe43d69fa00b6b19f | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | // package div_2_772;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class c{
public static void main(String[] args){
FastReader sc = new FastReader();
int t=sc.nextInt();
while(t-->0){
int n =sc.nextInt();
int a[]=sc.fastA... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 4ac10d12fa494b46ac1514a2cf340aa4 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | //Siddhartha Bose
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
i... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | bd6bb62f3d91c047acfe0ec4b5fc06de | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.uti... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | f50a74d191c908199f1494e89f4e92c3 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.uti... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 38e0c3c53e0498b4bc9b5668fb2142a6 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes |
import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class EG {
public static void main(String[] args) throws ArithmeticException{
FastScanner fs=new FastScanner();
int t=fs.nextInt();
while(t-->0) {
int n=fs.nextInt();
Long a[]=new Long[n];
for(int i=0;i<n;i++) {
a... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 2ee0e570bd11910d40b1b3e575bf8424 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.*;
import java.lang.*;
import java.util.*;
public class Main {
public static int mod = (int) 1e9 + 7;
// **** -----> Disjoint Set Union(DSU) Start **********
public static int findPar(int node, int[] parent) {
if (parent[node] == node)
return node;
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 2297048ffcd7b174ff5e139f6c046d0d | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.Scanner;
public class practice {
public static long fun(long ar[],int n){
long c=0;
for(int i=0;i<n-1;i++){
if(ar[i]<=ar[i+1]){
c++;
}
}
if(c==n-1){
return 0;
}
return 1;
}
pu... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 9df6b0e502964060ea93cf8b5602f853 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | // Problem: C. Differential Sorting
// Contest: Codeforces - Codeforces Round #772 (Div. 2)
// URL: https://codeforces.com/contest/1635/problem/C
// Memory Limit: 256 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)
import java.io.BufferedReader;
import java.io.*;
import java.io.I... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 77d56c40257824a5afc2f792d45b2972 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
public static class FastReader {
BufferedReader br;
StringTokenizer st;
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | df16a23e76ae1131f4de5321726e870f | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.lang.*;
public class Main{
public static PrintWriter out;
public static FastReader in;
public static int mod = 1000003;
static class FastReader{
BufferedRead... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | ca0cfdbe042b0d2c2904557a43a461d4 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
C. Differential Sorting
My idea:
1. make bigger to smaller
2. -7 5 -4 2 -1 5
need replace 5 by -7<= a[y] - a[z] < -4 min
* */
public class C {
static int... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 3d9edc2991fe4082c340ac676f54f253 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Test{
static FastReader scan;
static void solve(){
int n=scan.nextInt();... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 348902d553d2d77587f7eda8a5b7d710 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | //jai Shree Krishna
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.util.Collections;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Comparator;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 3bcd4976fb64bc8a5399c3652fa8ee07 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
static final PrintWriter out =new PrintWriter(System.out);
static final FastReader sc = new FastReader();
//I invented a new word!Plagiarism!
//Did you hear about the mathematician who’s afraid of negative numbers?He’l... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | e188d5139115c0665faed2efabe42db4 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
static final PrintWriter out =new PrintWriter(System.out);
static final FastReader sc = new FastReader();
//I invented a new word!Plagiarism!
//Did you hear about the mathematician who’s afraid of negative numbers?He’l... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 2890baaf729acc8a59729dc42a800681 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | //Utilities
import java.io.*;
import java.util.*;
public class a {
static int t;
static int n;
static long[] a;
static int res;
public static void main(String[] args) throws IOException {
t = in.iscan();
outer : while (t-- > 0) {
n = in.iscan(); a = new long[n+1];
for (int i = 1; i <= n; ... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 7d972e88085c14e41f88dd50c05ad766 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static Scanner obj = new Scanner(System.in);
public static PrintWriter out = new PrintWriter(System.out);
public static class three
{
int a;
int b;
int c;
three(int a,int b,int c)
{
this.a=a;
this.b=b;
this.c=c;
}... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | af3f26c4f2b5520c9edb8bbb67f3a100 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
import java.io.*;
public class c5{
static class Pair{
int first;
int last;
public Pair(int first , int last){
this.first = first;
this.last = last;
}
public int getFirst(){
return first;
}... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | f29e5dcb08ad6fae7b569619f70b343e | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes |
import java.io.*;
import java.math.*;
import java.util.*;
// @author : Dinosparton
public class test {
static class Pair{
long x;
long y;
Pair(long x,long y){
this.x = x;
this.y = y;
}
}
static class Sort implements Comparator<... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | fb226c562e01243f8063f2d3d9e60280 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
public class HelloWorld{
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];
int []narr=new int[n];
for(int i=0;i<... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | bc2083d776e4734a0e1c54a9d676712d | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.stream.Stream;
public class cf772c {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.pa... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | bb9f15fe8790ccfbf084fd9144046d77 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes |
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigInteger;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | b1a30ab9a0d2b54890fdf4b949b0b196 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == nul... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 262a11eea7af6cd3fe4b6227a8911243 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | //package MyPackage;
import java.util.*;
import java.io.*;
public class codec{
static class Pair
{
int x;
int y;
int z;
Pair(int x, int y, int z)
{
this.x = x;
this.y = y;
this.z = z;
}
}
static class FastReader{
BufferedReader br;
StringTokenizer st;
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | fbe901174bf739e02908e662053067a1 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
public class CF772_C {
public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
int t=cs.nextInt();
while(t-->0){
int n=cs.nextInt();
int[] a=new int[n];
int[] b=new int[n];
for(int i=0;i<n;i+... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | f84629e8e8775754533103052cf8e14d | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
public class CF772_C {
public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
int t=cs.nextInt();
while(t-->0){
int n=cs.nextInt();
int[] a=new int[n];
int[] b=new int[n];
for(int i=0;i<n;i+... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 054f300c718d3250c1ff48f56a6801d3 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
public class test extends PrintWriter {
test() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
test o = new test(); o.main(); o.flush();
}
void main() {
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 2f37b429b5e5ea060d7629c0b1d80ab9 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 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.*;
public class C_Differential_Sorting
{
public static void main(String[] args) throws Exception
{
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | ceaa503bf1fa7c25ee1593ada47ff63e | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | /**
* 02/20/22 morning
* https://codeforces.com/contest/1635/problem/C
*/
// package codeforce.cf.div2.r772;
import java.util.*;
import java.io.*;
public class C {
static PrintWriter pw;
void solve(int n, int[] a) {
if (a[n - 2] > a[n - 1]) {
pr(-1);
return;
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | ec970682e9ceed72c9f1300f1357e3c9 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.math.BigInteger;
import java.io.*;
public class q7 implements Runnable {
public static void main(String[] args) {
new Thread(null, new q7(), "whatever", 1 << 26).start();
}
//
private FastScanner sc;
private PrintWriter pw... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 3874ee8470dac838aa19ffa9677f44aa | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.math.BigInteger;
import java.io.*;
public class Main implements Runnable {
public static void main(String[] args) {
new Thread(null, new Main(), "whatever", 1 << 26).start();
}
//
private FastScanner sc;
private PrintWriter pw... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 764645e631b551399c5e767c3558434c | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | //package com.company;
import java.io.*;
import java.util.*;
public class Main{
static boolean[] primecheck = new boolean[1000002];
static ArrayList<Integer>[] adj;
static int[] vis;
static int mod = (int)1e9 + 7;
public static void main(String[] args) {
OutputStream outputS... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | f799a194ba042aea97a6f2f44402c3dc | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
/**
*
* @author eslam
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 2059368dea0c640eeec529f6891ab44d | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | /*
"Everything in the universe is balanced. Every disappointment
you face in life will be balanced by something good for you!
Keep going, never give up."
Just have Patience + 1...
*/
import java.util.*;
import java.lang.*;
impor... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | d9e77faf0a50ef4621e982da06006c9b | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 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));
// } catch (Exceptio... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 18b04e7703cf45217cd7ee78c12a6c75 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
public class pariNa {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
long t=sc.nextLong();
StringBuilder finalAnswer=new StringBuilder();
//finalAnswer.append().append('\n');
outer:
while(t-->0) {
int n=sc.nextInt();
int arr[]=new int[n];
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | fd72e507c8b9b1855110fa6c48d5fdea | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes |
// import java.io.*;
// import java.util.*;
// public class Main{
// static class FastReader {
// BufferedReader br;
// StringTokenizer st;
// public FastReader()
// {
// br = new BufferedReader(
// ... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 6072f501094578dc62802fc51ecec702 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.lang.invoke.MethodHandles;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
im... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 93b0979c00cb5908fe6f3f54632fafc1 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
public class MergeSort {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int test = sc.nextInt();
sc.nextLine();
while(test-->0){
int n = sc.nextInt();
long[] a = new long[n];
for(int i... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 77884a1488ca5c24dbdd964c3b46ddf1 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
import java.text.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception {
FastReader sc = new FastReader();
PrintWriter writer = new PrintWriter(System.out);
int t = sc.nextInt();
while(t-->0) {... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 1edcff884daba12d6e45160c4887000b | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
// when can't think of anything -->>
// 1. In sorting questions try to think about all possibilities like sorting from start, end, middle.
// 2. Two pointers, brute force.
// 3. In graph query questions try to solve it reversely or try to proc... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 764a8235e8edc33c11119079ac2118e7 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.*;
import java.util.*;
public class TimePass {
public static int[][] solve(int n,int arr[]) {
List<int[]>list=new ArrayList<>();
if(arr[n-1]<arr[n-2]) {
list.add(new int[] {Integer.MAX_VALUE});
}else {
for(int i=n-3;i>=0;i--) {
int min=Math.min(arr[i], arr[n-2]-arr[n-... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | a0d7433e6133edf8bbf6ca37aaee1d11 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes |
import java.io.*;
import java.util.*;
public class ProblemA{
static long mod = 1000000007L;
// map.put(a[i],map.getOrDefault(a[i],0)+1);
static MyScanner sc = new MyScanner();
//<----------------------------------------------WRITE HERE------------------------------------------->
stati... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | d68d01543d5dea3081737dded1cebb11 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | //package prog_temps;
import java.util.*;
import java.io.*;
public class Java_Template {
static boolean[] primecheck = new boolean[1000002];
static int M = 1000000007;
static int mn = Integer.MIN_VALUE;
static int mx = Integer.MAX_VALUE;
static int vis[];
static ArrayList<ArrayList<Integer>... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 18c7a9a1a71c332da552b132da2a2e27 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 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\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | e138b7c1843c0d67c33cb375b6a09b62 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
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();
long arr[] = new long[n];
for(int i=0;i<n;i++) {
arr[i] = sc.nextInt();
}
if(arr[n-1]... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | a30c8500db838f51176e00a07bcca312 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static class JoinSet {
int[] fa;
JoinSet(int n) {
fa = new int[n];
for (int i = 0; i < n; i++) fa[i] = i;
}
int find(int t) {
if (t != fa[t]) fa[t] = find(fa[t]);
retu... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 4f4512d7ee0160355f1b8f604c84423b | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces_1635A {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
BufferedWriter output = new BufferedWriter(new OutputStrea... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 0d9433a9685f4eed26993b83ba7373c4 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int k = input.nextInt();
while (k-- != 0) {
int n = input.nextInt();
long[] arr = new long[n];
boolean flag = true;
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | bcf33550e13988992c87ce48036aadcd | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main2 {
public static boolean sorted(int [] arr){
for (int i = arr.length-2; i >= 0; i--) {
if(arr[i] > arr[i+1])return false;
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 7b3be3aa135df481cecd333c7e10f727 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.security.KeyStore.Entry;
public class Main{
static final Random random=new Random();
static long mod=1000000007L;
static HashMap<String,Integer>map=new HashMap<>();
static class FastReader{
BufferedReader br;
StringTokeniz... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | e3cabc4068e9edfb19c3db23f05c17c1 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
import java.io.*;
public class sagar{
public static void main(String[] args)throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder("");
Reader rd = new Reader();
int t = rd.nextInt();
int n;
long[] arr;
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 3778883a11bfc784e673bb4064a7c7f1 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 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.List;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new B... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 95a442f220fcaee9d2ddebcc09623d41 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 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.List;
public class cf02 {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new B... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 2c48ef0853d48d2d126af03be6a5d787 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.*;
import java.lang.*;
import java.util.*;
public class GFG {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(
new InputStreamReader(System.in));
}
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | f0a8e270a2b43b5127c2fc509113a934 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import java.io.*;
import java.util.*;
public class C {
static int mod=(int)1e9+7;
public static void main(String[] args) {
var io = new Copied(System.in, System.out);
// int... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 878f0db9424e4600344b13fd5b25c3b6 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static MyScanner sc = new MyScanner();
static Output out = new Output();
public static void main(String[] args) {
int t=sc.nextInt();
for(int i=0;i<t;i++) {
solve();
}
out.flush();
}
public static void solve() {
int n=sc.nextI... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 1fce6c5ca7819b9af0af6f9bc2ee8d98 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 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\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 81e2372a8f9c364348a76d96936e5211 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static PrintWriter out;
static Kioken sc;
public static void main(String[] args) throws FileNotFoundException {
boolean t = true;
boolean f = false;
if (f) {
out = new PrintWriter("output.txt");
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 9d3700d3fa9b582d82dfc25469bf7cba | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 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();
long arr[] = new long[n];
for(int i=0;i<n;i++) arr[i] = sc.nextLong();
int smax[] ... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 2c1f34ec67012041988c79571e91526a | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution
{
private static class FastIO {
private static class FastReader
{
BufferedReader br;
StringTokenizer st;
FastReader()
{
br = new BufferedReader(new InputStreamRe... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | e21cf7f0ebf79022d17988a6320fecc2 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.Map.Entry;
public class codeforces {
static int mod = 1000000007;
public static void main(String[] args) {
FastReader sc = new FastReader();
try {
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | ce8f74387a3f7c1450bf28b5df1fd1ea | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.*;
import java.util.*;
public class MyClass {
public static void main(String args[])throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(br.readLine());
while(t-->0){
int n=Integer.parseInt(br.re... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 21ad13f34c86a961a37cbb1553548c16 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.*;
import java.lang.*;
import java.util.*;
public class ComdeFormces {
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
FastReader sc=new FastReader();
BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 25dcfa538a0459b79af4467b4403c104 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.*;
import java.util.*;
public class codeforces {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new Buffer... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 5472106d2125a80b098e243dbe6f26b9 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import java.util.*;
import java.io.*;
import java.math.*;
/**
*
* @Har_Har_Mahadev
*/
/**
* Main , Solution , Remove Public
*/
public class C {
public static void process() throws IOException ... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 313e0c8c217fd030058c5269a3adc8fc | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | // JAI SHREE RAM, HAR HAR MAHADEV, HARE KRISHNA
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.*;
import java.lang.*;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.io.*;
public class Eshan {
static BufferedReader br = new BufferedReader(new InputStrea... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 1f775e405d442fcf750f91602296e68f | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
public class pb6 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0){
int n = sc.nextInt();
long[] arr = new long[n];
for (int i = 0; i < n ; i++){
... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | f010d199ee73966bb6b3cf78389ca9f0 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | //<———My cp————
//https://takeuforward.org/interview-experience/strivers-cp-sheet/?utm_source=youtube&utm_medium=striver&utm_campaign=yt_video
import java.util.*;
import java.io.*;
public class Solution{
static PrintWriter pw = new PrintWriter(System.out);
static FastReader fr = new FastReader(System.in);... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output | |
PASSED | 0b67d3d101f8cce0e50e62eb430dd307 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 \leq x < y < z \leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$|a_x|$$$ need to be less than $$$10^{18}$$$.Your goal is to ... | 256 megabytes | import java.util.*;
public class DiffrentialSorting {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int n=sc.nextInt();
long arr[]=new long[n];
for(int i=0;i<n;i++)
{... | Java | ["3\n5\n5 -4 2 -1 2\n3\n4 3 2\n3\n-3 -2 -1"] | 2 seconds | ["2\n1 2 3\n3 4 5\n-1\n0"] | NoteIn the first example, the array becomes $$$[-6,-4,2,-1,2]$$$ after the first operation,$$$[-6,-4,-3,-1,2]$$$ after the second operation.In the second example, it is impossible to make the array sorted after any sequence of operations.In the third example, the array is already sorted, so we don't need to perform any... | Java 11 | standard input | [
"constructive algorithms",
"greedy"
] | c3ee6419adfc85c80f35ecfdea6b0d43 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(3 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 1,200 | For each test case, print $$$-1$$$ in a single line if there is no solution. Otherwise in the first line you should print a single integer $$$m$$$ $$$(0 \leq m \leq n)$$$ — number of operations you performed. Then the $$$i$$$-th of the following $$$m$$$ lines should contain three integers $$$x,y,z$$$ $$$(1 \leq x < ... | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.