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 | 159cf74be849e5abf38d419d6ac524e5 | train_108.jsonl | 1635518100 | Berland State University has received a new update for the operating system. Initially it is installed only on the $$$1$$$-st computer.Update files should be copied to all $$$n$$$ computers. The computers are not connected to the internet, so the only way to transfer update files from one computer to another is to copy... | 256 megabytes | import java.util.Scanner;
public class codeforcesround<n> {
public static Scanner read = new Scanner(System.in);
public static void main(String[] args) {
int t = Integer.parseInt(read.nextLine().trim());
while (t-- > 0) {
solve();
}
}
private static void solve() {
long n = read.nextLong()... | Java | ["4\n8 3\n6 6\n7 1\n1 1"] | 2 seconds | ["4\n3\n6\n0"] | NoteLet's consider the test cases of the example: $$$n=8$$$, $$$k=3$$$: during the first hour, we copy the update files from the computer $$$1$$$ to the computer $$$2$$$; during the second hour, we copy the update files from the computer $$$1$$$ to the computer $$$3$$$, and from the computer $$$2$$$ to the computer... | Java 11 | standard input | [
"greedy",
"implementation",
"math"
] | 5df6eb50ead22b498bea69bb84341c06 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Each test case consists of a single line that contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^{18}$$$) — the number of computers and the number of patch cables. | 1,100 | For each test case print one integer — the minimum number of hours required to copy the update files to all $$$n$$$ computers. | standard output | |
PASSED | 99332b68b1b04397546d57ff837424b5 | train_108.jsonl | 1635518100 | Berland State University has received a new update for the operating system. Initially it is installed only on the $$$1$$$-st computer.Update files should be copied to all $$$n$$$ computers. The computers are not connected to the internet, so the only way to transfer update files from one computer to another is to copy... | 256 megabytes | import java.util.*;
public class updateFiles {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
while(t-- > 0) {
long ncm = scan.nextLong();
long ncb = scan.nextLong();
long cm = 1L, cb = 1L, h = 0L;
while(cm < ncm) {
h += 1;
c... | Java | ["4\n8 3\n6 6\n7 1\n1 1"] | 2 seconds | ["4\n3\n6\n0"] | NoteLet's consider the test cases of the example: $$$n=8$$$, $$$k=3$$$: during the first hour, we copy the update files from the computer $$$1$$$ to the computer $$$2$$$; during the second hour, we copy the update files from the computer $$$1$$$ to the computer $$$3$$$, and from the computer $$$2$$$ to the computer... | Java 11 | standard input | [
"greedy",
"implementation",
"math"
] | 5df6eb50ead22b498bea69bb84341c06 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Each test case consists of a single line that contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^{18}$$$) — the number of computers and the number of patch cables. | 1,100 | For each test case print one integer — the minimum number of hours required to copy the update files to all $$$n$$$ computers. | standard output | |
PASSED | 195ae3129cd464abc910e86bdbfe68a3 | train_108.jsonl | 1635518100 | Berland State University has received a new update for the operating system. Initially it is installed only on the $$$1$$$-st computer.Update files should be copied to all $$$n$$$ computers. The computers are not connected to the internet, so the only way to transfer update files from one computer to another is to copy... | 256 megabytes | import java.io.PrintWriter;
import java.util.Scanner;
public class UpdateFiles {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int t = sc.nextInt();
for (int x = 0; x < t; x++) {
long ... | Java | ["4\n8 3\n6 6\n7 1\n1 1"] | 2 seconds | ["4\n3\n6\n0"] | NoteLet's consider the test cases of the example: $$$n=8$$$, $$$k=3$$$: during the first hour, we copy the update files from the computer $$$1$$$ to the computer $$$2$$$; during the second hour, we copy the update files from the computer $$$1$$$ to the computer $$$3$$$, and from the computer $$$2$$$ to the computer... | Java 11 | standard input | [
"greedy",
"implementation",
"math"
] | 5df6eb50ead22b498bea69bb84341c06 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Each test case consists of a single line that contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^{18}$$$) — the number of computers and the number of patch cables. | 1,100 | For each test case print one integer — the minimum number of hours required to copy the update files to all $$$n$$$ computers. | standard output | |
PASSED | 1882d09227c803e1a7bc258a8bb8329c | train_108.jsonl | 1635518100 | Berland State University has received a new update for the operating system. Initially it is installed only on the $$$1$$$-st computer.Update files should be copied to all $$$n$$$ computers. The computers are not connected to the internet, so the only way to transfer update files from one computer to another is to copy... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter w = new BufferedWriter(new OutputStreamWriter(System.out));
Scanner sc = new S... | Java | ["4\n8 3\n6 6\n7 1\n1 1"] | 2 seconds | ["4\n3\n6\n0"] | NoteLet's consider the test cases of the example: $$$n=8$$$, $$$k=3$$$: during the first hour, we copy the update files from the computer $$$1$$$ to the computer $$$2$$$; during the second hour, we copy the update files from the computer $$$1$$$ to the computer $$$3$$$, and from the computer $$$2$$$ to the computer... | Java 11 | standard input | [
"greedy",
"implementation",
"math"
] | 5df6eb50ead22b498bea69bb84341c06 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Each test case consists of a single line that contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^{18}$$$) — the number of computers and the number of patch cables. | 1,100 | For each test case print one integer — the minimum number of hours required to copy the update files to all $$$n$$$ computers. | standard output | |
PASSED | cb8f8b3df811927261d87b1641bc5803 | train_108.jsonl | 1635518100 | Berland State University has received a new update for the operating system. Initially it is installed only on the $$$1$$$-st computer.Update files should be copied to all $$$n$$$ computers. The computers are not connected to the internet, so the only way to transfer update files from one computer to another is to copy... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args) throws IOException{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0) {
Long n=sc.nextLong();
Long k=sc.nextLong();
Long ans= Long.va... | Java | ["4\n8 3\n6 6\n7 1\n1 1"] | 2 seconds | ["4\n3\n6\n0"] | NoteLet's consider the test cases of the example: $$$n=8$$$, $$$k=3$$$: during the first hour, we copy the update files from the computer $$$1$$$ to the computer $$$2$$$; during the second hour, we copy the update files from the computer $$$1$$$ to the computer $$$3$$$, and from the computer $$$2$$$ to the computer... | Java 11 | standard input | [
"greedy",
"implementation",
"math"
] | 5df6eb50ead22b498bea69bb84341c06 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Each test case consists of a single line that contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^{18}$$$) — the number of computers and the number of patch cables. | 1,100 | For each test case print one integer — the minimum number of hours required to copy the update files to all $$$n$$$ computers. | standard output | |
PASSED | fdcbeacef9c68c75997304765de7f677 | train_108.jsonl | 1635518100 | Berland State University has received a new update for the operating system. Initially it is installed only on the $$$1$$$-st computer.Update files should be copied to all $$$n$$$ computers. The computers are not connected to the internet, so the only way to transfer update files from one computer to another is to copy... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.abs;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.System.out;
public class B {
public static Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
int ... | Java | ["4\n8 3\n6 6\n7 1\n1 1"] | 2 seconds | ["4\n3\n6\n0"] | NoteLet's consider the test cases of the example: $$$n=8$$$, $$$k=3$$$: during the first hour, we copy the update files from the computer $$$1$$$ to the computer $$$2$$$; during the second hour, we copy the update files from the computer $$$1$$$ to the computer $$$3$$$, and from the computer $$$2$$$ to the computer... | Java 11 | standard input | [
"greedy",
"implementation",
"math"
] | 5df6eb50ead22b498bea69bb84341c06 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Each test case consists of a single line that contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^{18}$$$) — the number of computers and the number of patch cables. | 1,100 | For each test case print one integer — the minimum number of hours required to copy the update files to all $$$n$$$ computers. | standard output | |
PASSED | 3e9e130580d106cf714b623301f33a6a | train_108.jsonl | 1635518100 | Berland State University has received a new update for the operating system. Initially it is installed only on the $$$1$$$-st computer.Update files should be copied to all $$$n$$$ computers. The computers are not connected to the internet, so the only way to transfer update files from one computer to another is to copy... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.lang.*;
import static java.lang.Math.*;
// Sachin_2961 submission //
public class Codeforces {
static void solve(){
long n = fs.nLong(), k = fs.nLong();
long ans = 0,cur = 1L;
while( cur < k ){
... | Java | ["4\n8 3\n6 6\n7 1\n1 1"] | 2 seconds | ["4\n3\n6\n0"] | NoteLet's consider the test cases of the example: $$$n=8$$$, $$$k=3$$$: during the first hour, we copy the update files from the computer $$$1$$$ to the computer $$$2$$$; during the second hour, we copy the update files from the computer $$$1$$$ to the computer $$$3$$$, and from the computer $$$2$$$ to the computer... | Java 11 | standard input | [
"greedy",
"implementation",
"math"
] | 5df6eb50ead22b498bea69bb84341c06 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Each test case consists of a single line that contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^{18}$$$) — the number of computers and the number of patch cables. | 1,100 | For each test case print one integer — the minimum number of hours required to copy the update files to all $$$n$$$ computers. | standard output | |
PASSED | 0bf0dfe342c75e355175f1c28c1699ee | train_108.jsonl | 1635518100 | Berland State University has received a new update for the operating system. Initially it is installed only on the $$$1$$$-st computer.Update files should be copied to all $$$n$$$ computers. The computers are not connected to the internet, so the only way to transfer update files from one computer to another is to copy... | 256 megabytes | import java.util.*;
import java.util.Map.Entry;
import java.io.*;
import static java.util.Map.Entry.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
static long mod=(long) (1e9+7);
static ArrayList<Integer>[] itemsList;
public static void main (String[] ar... | Java | ["4\n8 3\n6 6\n7 1\n1 1"] | 2 seconds | ["4\n3\n6\n0"] | NoteLet's consider the test cases of the example: $$$n=8$$$, $$$k=3$$$: during the first hour, we copy the update files from the computer $$$1$$$ to the computer $$$2$$$; during the second hour, we copy the update files from the computer $$$1$$$ to the computer $$$3$$$, and from the computer $$$2$$$ to the computer... | Java 11 | standard input | [
"greedy",
"implementation",
"math"
] | 5df6eb50ead22b498bea69bb84341c06 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Each test case consists of a single line that contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^{18}$$$) — the number of computers and the number of patch cables. | 1,100 | For each test case print one integer — the minimum number of hours required to copy the update files to all $$$n$$$ computers. | standard output | |
PASSED | 735eefc59bd8649a8f35398ca0948468 | train_108.jsonl | 1635518100 | Berland State University has received a new update for the operating system. Initially it is installed only on the $$$1$$$-st computer.Update files should be copied to all $$$n$$$ computers. The computers are not connected to the internet, so the only way to transfer update files from one computer to another is to copy... | 256 megabytes | import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;
import java.io.IOException;import java.io.InputStream;import java.io.PrintWriter;
import java.security.AccessControlException;import java.util.List;public class _B {
static public void main(final String[] args) throws IOException{B... | Java | ["4\n8 3\n6 6\n7 1\n1 1"] | 2 seconds | ["4\n3\n6\n0"] | NoteLet's consider the test cases of the example: $$$n=8$$$, $$$k=3$$$: during the first hour, we copy the update files from the computer $$$1$$$ to the computer $$$2$$$; during the second hour, we copy the update files from the computer $$$1$$$ to the computer $$$3$$$, and from the computer $$$2$$$ to the computer... | Java 11 | standard input | [
"greedy",
"implementation",
"math"
] | 5df6eb50ead22b498bea69bb84341c06 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Each test case consists of a single line that contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^{18}$$$) — the number of computers and the number of patch cables. | 1,100 | For each test case print one integer — the minimum number of hours required to copy the update files to all $$$n$$$ computers. | standard output | |
PASSED | 239832f48ab0661845ceba13a1220ac0 | train_108.jsonl | 1635518100 | Berland State University has received a new update for the operating system. Initially it is installed only on the $$$1$$$-st computer.Update files should be copied to all $$$n$$$ computers. The computers are not connected to the internet, so the only way to transfer update files from one computer to another is to copy... | 256 megabytes |
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
public class EduB {
private static long solve(long n, long k) {
if (n == 1)
return 0;
if (k == 1)
return n - 1l;
long hours = 1l;
long pow = 1l;
... | Java | ["4\n8 3\n6 6\n7 1\n1 1"] | 2 seconds | ["4\n3\n6\n0"] | NoteLet's consider the test cases of the example: $$$n=8$$$, $$$k=3$$$: during the first hour, we copy the update files from the computer $$$1$$$ to the computer $$$2$$$; during the second hour, we copy the update files from the computer $$$1$$$ to the computer $$$3$$$, and from the computer $$$2$$$ to the computer... | Java 11 | standard input | [
"greedy",
"implementation",
"math"
] | 5df6eb50ead22b498bea69bb84341c06 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Each test case consists of a single line that contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^{18}$$$) — the number of computers and the number of patch cables. | 1,100 | For each test case print one integer — the minimum number of hours required to copy the update files to all $$$n$$$ computers. | standard output | |
PASSED | 396317c855e4a19110d41f97b5da367b | train_108.jsonl | 1635518100 | Berland State University has received a new update for the operating system. Initially it is installed only on the $$$1$$$-st computer.Update files should be copied to all $$$n$$$ computers. The computers are not connected to the internet, so the only way to transfer update files from one computer to another is to copy... | 256 megabytes |
// import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;
public class Test {
static BufferedReader br;
static do... | Java | ["4\n8 3\n6 6\n7 1\n1 1"] | 2 seconds | ["4\n3\n6\n0"] | NoteLet's consider the test cases of the example: $$$n=8$$$, $$$k=3$$$: during the first hour, we copy the update files from the computer $$$1$$$ to the computer $$$2$$$; during the second hour, we copy the update files from the computer $$$1$$$ to the computer $$$3$$$, and from the computer $$$2$$$ to the computer... | Java 11 | standard input | [
"greedy",
"implementation",
"math"
] | 5df6eb50ead22b498bea69bb84341c06 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Each test case consists of a single line that contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^{18}$$$) — the number of computers and the number of patch cables. | 1,100 | For each test case print one integer — the minimum number of hours required to copy the update files to all $$$n$$$ computers. | standard output | |
PASSED | f586afee9c73438dc28edcf724698cc4 | train_108.jsonl | 1635518100 | Berland State University has received a new update for the operating system. Initially it is installed only on the $$$1$$$-st computer.Update files should be copied to all $$$n$$$ computers. The computers are not connected to the internet, so the only way to transfer update files from one computer to another is to copy... | 256 megabytes | import java.util.Scanner;
public class Simple{
public static void main(String args[]){
//System.out.println("Hello Java");
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while (t>0){
long n = s.nextLong();
long k = s.nextLong();
... | Java | ["4\n8 3\n6 6\n7 1\n1 1"] | 2 seconds | ["4\n3\n6\n0"] | NoteLet's consider the test cases of the example: $$$n=8$$$, $$$k=3$$$: during the first hour, we copy the update files from the computer $$$1$$$ to the computer $$$2$$$; during the second hour, we copy the update files from the computer $$$1$$$ to the computer $$$3$$$, and from the computer $$$2$$$ to the computer... | Java 11 | standard input | [
"greedy",
"implementation",
"math"
] | 5df6eb50ead22b498bea69bb84341c06 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Each test case consists of a single line that contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^{18}$$$) — the number of computers and the number of patch cables. | 1,100 | For each test case print one integer — the minimum number of hours required to copy the update files to all $$$n$$$ computers. | standard output | |
PASSED | fb670e8393920e1c5e29d2bc0956d5b3 | train_108.jsonl | 1635518100 | Berland State University has received a new update for the operating system. Initially it is installed only on the $$$1$$$-st computer.Update files should be copied to all $$$n$$$ computers. The computers are not connected to the internet, so the only way to transfer update files from one computer to another is to copy... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
// Your code here!
Scanner sc=new Scanner(System.in);
int t= sc.nextInt();
while(t-->0)
{
long n = sc.nextLong();
long k = sc.nextLong();
... | Java | ["4\n8 3\n6 6\n7 1\n1 1"] | 2 seconds | ["4\n3\n6\n0"] | NoteLet's consider the test cases of the example: $$$n=8$$$, $$$k=3$$$: during the first hour, we copy the update files from the computer $$$1$$$ to the computer $$$2$$$; during the second hour, we copy the update files from the computer $$$1$$$ to the computer $$$3$$$, and from the computer $$$2$$$ to the computer... | Java 11 | standard input | [
"greedy",
"implementation",
"math"
] | 5df6eb50ead22b498bea69bb84341c06 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Each test case consists of a single line that contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^{18}$$$) — the number of computers and the number of patch cables. | 1,100 | For each test case print one integer — the minimum number of hours required to copy the update files to all $$$n$$$ computers. | standard output | |
PASSED | 4a9bb0e17ac59296651c70a0d486510e | train_108.jsonl | 1635518100 | You are given a matrix, consisting of $$$n$$$ rows and $$$m$$$ columns. The $$$j$$$-th cell of the $$$i$$$-th row contains an integer $$$a_{ij}$$$.First, you have to color each row of the matrix either red or blue in such a way that at least one row is colored red and at least one row is colored blue.Then, you have to ... | 256 megabytes | import java.util.*;
import java.util.function.*;
import java.io.*;
// you can compare with output.txt and expected out
public class RoundEdu116D {
MyPrintWriter out;
MyScanner in;
// final static long FIXED_RANDOM;
// static {
// FIXED_RANDOM = System.currentTimeMillis();
// }
final static String I... | Java | ["3\n5 5\n1 5 8 8 7\n5 2 1 4 3\n1 6 9 7 5\n9 3 3 3 2\n1 7 9 9 8\n3 3\n8 9 8\n1 5 3\n7 5 7\n2 6\n3 3 3 2 2 2\n1 1 1 4 4 4"] | 4 seconds | ["YES\nBRBRB 1\nNO\nYES\nRB 3"] | NoteThe coloring and the cut for the first testcase: | Java 17 | standard input | [
"brute force",
"constructive algorithms",
"implementation",
"sortings"
] | 10751c875f4d7667ba21685c57cddd9e | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 5 \cdot 10^5$$$; $$$n \cdot m \le 10^6$$$) — the number of rows and the num... | 2,400 | For each testcase print an answer. If there are no perfect colorings and cuts in the matrix, then print "NO". Otherwise, first, print "YES". Then a string, consisting of $$$n$$$ characters: the $$$i$$$-th character should be 'R' if the $$$i$$$-th row is colored red and 'B' if it's colored blue. The string should contai... | standard output | |
PASSED | b127ead70ef77fd3df87780c16539f8d | train_108.jsonl | 1635518100 | You are given a matrix, consisting of $$$n$$$ rows and $$$m$$$ columns. The $$$j$$$-th cell of the $$$i$$$-th row contains an integer $$$a_{ij}$$$.First, you have to color each row of the matrix either red or blue in such a way that at least one row is colored red and at least one row is colored blue.Then, you have to ... | 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) {
int n = i(), m = i();
int[][] a = new int[n][m];
for (int ... | Java | ["3\n5 5\n1 5 8 8 7\n5 2 1 4 3\n1 6 9 7 5\n9 3 3 3 2\n1 7 9 9 8\n3 3\n8 9 8\n1 5 3\n7 5 7\n2 6\n3 3 3 2 2 2\n1 1 1 4 4 4"] | 4 seconds | ["YES\nBRBRB 1\nNO\nYES\nRB 3"] | NoteThe coloring and the cut for the first testcase: | Java 8 | standard input | [
"brute force",
"constructive algorithms",
"implementation",
"sortings"
] | 10751c875f4d7667ba21685c57cddd9e | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 5 \cdot 10^5$$$; $$$n \cdot m \le 10^6$$$) — the number of rows and the num... | 2,400 | For each testcase print an answer. If there are no perfect colorings and cuts in the matrix, then print "NO". Otherwise, first, print "YES". Then a string, consisting of $$$n$$$ characters: the $$$i$$$-th character should be 'R' if the $$$i$$$-th row is colored red and 'B' if it's colored blue. The string should contai... | standard output | |
PASSED | 0b021dafe6f3a0083351bc38c8090986 | train_108.jsonl | 1635518100 | You are given a matrix, consisting of $$$n$$$ rows and $$$m$$$ columns. The $$$j$$$-th cell of the $$$i$$$-th row contains an integer $$$a_{ij}$$$.First, you have to color each row of the matrix either red or blue in such a way that at least one row is colored red and at least one row is colored blue.Then, you have to ... | 256 megabytes | /*
stream Butter!
eggyHide eggyVengeance
I need U
xiao rerun when
*/
import static java.lang.Math.*;
import java.util.*;
import java.io.*;
import java.math.*;
public class x1606D
{
public static void main(String hi[]) throws Exception
{
FastScanner infile = new FastScanner();
in... | Java | ["3\n5 5\n1 5 8 8 7\n5 2 1 4 3\n1 6 9 7 5\n9 3 3 3 2\n1 7 9 9 8\n3 3\n8 9 8\n1 5 3\n7 5 7\n2 6\n3 3 3 2 2 2\n1 1 1 4 4 4"] | 4 seconds | ["YES\nBRBRB 1\nNO\nYES\nRB 3"] | NoteThe coloring and the cut for the first testcase: | Java 8 | standard input | [
"brute force",
"constructive algorithms",
"implementation",
"sortings"
] | 10751c875f4d7667ba21685c57cddd9e | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 5 \cdot 10^5$$$; $$$n \cdot m \le 10^6$$$) — the number of rows and the num... | 2,400 | For each testcase print an answer. If there are no perfect colorings and cuts in the matrix, then print "NO". Otherwise, first, print "YES". Then a string, consisting of $$$n$$$ characters: the $$$i$$$-th character should be 'R' if the $$$i$$$-th row is colored red and 'B' if it's colored blue. The string should contai... | standard output | |
PASSED | 220420e16b8c303c4ad8f2247095314f | train_108.jsonl | 1635518100 | You are given a matrix, consisting of $$$n$$$ rows and $$$m$$$ columns. The $$$j$$$-th cell of the $$$i$$$-th row contains an integer $$$a_{ij}$$$.First, you have to color each row of the matrix either red or blue in such a way that at least one row is colored red and at least one row is colored blue.Then, you have to ... | 256 megabytes | // Problem: D. Red-Blue Matrix
// Contest: Codeforces - Educational Codeforces Round 116 (Rated for Div. 2)
// URL: https://codeforces.com/contest/1606/problem/D
// Memory Limit: 256 MB
// Time Limit: 4000 ms
//
// Powered by CP Editor (https://cpeditor.org)
import java.io.*;
import java.util.*;
import static java.l... | Java | ["3\n5 5\n1 5 8 8 7\n5 2 1 4 3\n1 6 9 7 5\n9 3 3 3 2\n1 7 9 9 8\n3 3\n8 9 8\n1 5 3\n7 5 7\n2 6\n3 3 3 2 2 2\n1 1 1 4 4 4"] | 4 seconds | ["YES\nBRBRB 1\nNO\nYES\nRB 3"] | NoteThe coloring and the cut for the first testcase: | Java 8 | standard input | [
"brute force",
"constructive algorithms",
"implementation",
"sortings"
] | 10751c875f4d7667ba21685c57cddd9e | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 5 \cdot 10^5$$$; $$$n \cdot m \le 10^6$$$) — the number of rows and the num... | 2,400 | For each testcase print an answer. If there are no perfect colorings and cuts in the matrix, then print "NO". Otherwise, first, print "YES". Then a string, consisting of $$$n$$$ characters: the $$$i$$$-th character should be 'R' if the $$$i$$$-th row is colored red and 'B' if it's colored blue. The string should contai... | standard output | |
PASSED | 9832fbeceb5baa9dba567125b35f367f | train_108.jsonl | 1635518100 | You are given a matrix, consisting of $$$n$$$ rows and $$$m$$$ columns. The $$$j$$$-th cell of the $$$i$$$-th row contains an integer $$$a_{ij}$$$.First, you have to color each row of the matrix either red or blue in such a way that at least one row is colored red and at least one row is colored blue.Then, you have to ... | 256 megabytes | /* || श्री राम समर्थ ||
|| जय जय रघुवीर समर्थ ||
*/
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.*;
import static java.util.Arrays.sort;
/*
... | Java | ["3\n5 5\n1 5 8 8 7\n5 2 1 4 3\n1 6 9 7 5\n9 3 3 3 2\n1 7 9 9 8\n3 3\n8 9 8\n1 5 3\n7 5 7\n2 6\n3 3 3 2 2 2\n1 1 1 4 4 4"] | 4 seconds | ["YES\nBRBRB 1\nNO\nYES\nRB 3"] | NoteThe coloring and the cut for the first testcase: | Java 8 | standard input | [
"brute force",
"constructive algorithms",
"implementation",
"sortings"
] | 10751c875f4d7667ba21685c57cddd9e | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 5 \cdot 10^5$$$; $$$n \cdot m \le 10^6$$$) — the number of rows and the num... | 2,400 | For each testcase print an answer. If there are no perfect colorings and cuts in the matrix, then print "NO". Otherwise, first, print "YES". Then a string, consisting of $$$n$$$ characters: the $$$i$$$-th character should be 'R' if the $$$i$$$-th row is colored red and 'B' if it's colored blue. The string should contai... | standard output | |
PASSED | d8018ee2ba2fb29123590afeb769077f | train_108.jsonl | 1635518100 | You are given a matrix, consisting of $$$n$$$ rows and $$$m$$$ columns. The $$$j$$$-th cell of the $$$i$$$-th row contains an integer $$$a_{ij}$$$.First, you have to color each row of the matrix either red or blue in such a way that at least one row is colored red and at least one row is colored blue.Then, you have to ... | 256 megabytes | import java.util.*;
import java.util.Map.Entry;
import java.math.*;
import java.io.*;
public class Main {
static final int INF = 1 << 30;
static int n;
static int m;
static int[][] a;
static int[][] leftMin;
static int[][] leftMax;
static int[][] rightMin;
static int[][] rightMax;
public static void main(... | Java | ["3\n5 5\n1 5 8 8 7\n5 2 1 4 3\n1 6 9 7 5\n9 3 3 3 2\n1 7 9 9 8\n3 3\n8 9 8\n1 5 3\n7 5 7\n2 6\n3 3 3 2 2 2\n1 1 1 4 4 4"] | 4 seconds | ["YES\nBRBRB 1\nNO\nYES\nRB 3"] | NoteThe coloring and the cut for the first testcase: | Java 8 | standard input | [
"brute force",
"constructive algorithms",
"implementation",
"sortings"
] | 10751c875f4d7667ba21685c57cddd9e | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 5 \cdot 10^5$$$; $$$n \cdot m \le 10^6$$$) — the number of rows and the num... | 2,400 | For each testcase print an answer. If there are no perfect colorings and cuts in the matrix, then print "NO". Otherwise, first, print "YES". Then a string, consisting of $$$n$$$ characters: the $$$i$$$-th character should be 'R' if the $$$i$$$-th row is colored red and 'B' if it's colored blue. The string should contai... | standard output | |
PASSED | ee5ece4587f8264ddf1b88b4bfeec25d | train_108.jsonl | 1635518100 | You are given a matrix, consisting of $$$n$$$ rows and $$$m$$$ columns. The $$$j$$$-th cell of the $$$i$$$-th row contains an integer $$$a_{ij}$$$.First, you have to color each row of the matrix either red or blue in such a way that at least one row is colored red and at least one row is colored blue.Then, you have to ... | 256 megabytes |
import java.io.*;
import java.util.*;
public final class Main {
static PrintWriter out = new PrintWriter(System.out);
static FastReader in = new FastReader();
static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(0, 1), new Pair(1, 0), new Pair(0, -1)};
static int mod = (int) (1e9 + 7);... | Java | ["3\n5 5\n1 5 8 8 7\n5 2 1 4 3\n1 6 9 7 5\n9 3 3 3 2\n1 7 9 9 8\n3 3\n8 9 8\n1 5 3\n7 5 7\n2 6\n3 3 3 2 2 2\n1 1 1 4 4 4"] | 4 seconds | ["YES\nBRBRB 1\nNO\nYES\nRB 3"] | NoteThe coloring and the cut for the first testcase: | Java 8 | standard input | [
"brute force",
"constructive algorithms",
"implementation",
"sortings"
] | 10751c875f4d7667ba21685c57cddd9e | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 5 \cdot 10^5$$$; $$$n \cdot m \le 10^6$$$) — the number of rows and the num... | 2,400 | For each testcase print an answer. If there are no perfect colorings and cuts in the matrix, then print "NO". Otherwise, first, print "YES". Then a string, consisting of $$$n$$$ characters: the $$$i$$$-th character should be 'R' if the $$$i$$$-th row is colored red and 'B' if it's colored blue. The string should contai... | standard output | |
PASSED | 1835af9f247e24f8a2c8360cddcace8a | train_108.jsonl | 1635518100 | You are given a matrix, consisting of $$$n$$$ rows and $$$m$$$ columns. The $$$j$$$-th cell of the $$$i$$$-th row contains an integer $$$a_{ij}$$$.First, you have to color each row of the matrix either red or blue in such a way that at least one row is colored red and at least one row is colored blue.Then, you have to ... | 256 megabytes | // coached by rainboy
import java.io.*;
import java.util.*;
public class CF1606D extends PrintWriter {
CF1606D() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1606D o = new CF1606D(); o.main(); o.flush();
}
static final int INF = 1000001;
void main() {
i... | Java | ["3\n5 5\n1 5 8 8 7\n5 2 1 4 3\n1 6 9 7 5\n9 3 3 3 2\n1 7 9 9 8\n3 3\n8 9 8\n1 5 3\n7 5 7\n2 6\n3 3 3 2 2 2\n1 1 1 4 4 4"] | 4 seconds | ["YES\nBRBRB 1\nNO\nYES\nRB 3"] | NoteThe coloring and the cut for the first testcase: | Java 11 | standard input | [
"brute force",
"constructive algorithms",
"implementation",
"sortings"
] | 10751c875f4d7667ba21685c57cddd9e | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 5 \cdot 10^5$$$; $$$n \cdot m \le 10^6$$$) — the number of rows and the num... | 2,400 | For each testcase print an answer. If there are no perfect colorings and cuts in the matrix, then print "NO". Otherwise, first, print "YES". Then a string, consisting of $$$n$$$ characters: the $$$i$$$-th character should be 'R' if the $$$i$$$-th row is colored red and 'B' if it's colored blue. The string should contai... | standard output | |
PASSED | a23c069c110bac9a7dfd65ca71549562 | train_108.jsonl | 1635518100 | You are given a matrix, consisting of $$$n$$$ rows and $$$m$$$ columns. The $$$j$$$-th cell of the $$$i$$$-th row contains an integer $$$a_{ij}$$$.First, you have to color each row of the matrix either red or blue in such a way that at least one row is colored red and at least one row is colored blue.Then, you have to ... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
public class Main {
static final long MOD1=1000000007;
static final long MOD=998244353;
static int[] ans;
public static void main(String[] a... | Java | ["3\n5 5\n1 5 8 8 7\n5 2 1 4 3\n1 6 9 7 5\n9 3 3 3 2\n1 7 9 9 8\n3 3\n8 9 8\n1 5 3\n7 5 7\n2 6\n3 3 3 2 2 2\n1 1 1 4 4 4"] | 4 seconds | ["YES\nBRBRB 1\nNO\nYES\nRB 3"] | NoteThe coloring and the cut for the first testcase: | Java 11 | standard input | [
"brute force",
"constructive algorithms",
"implementation",
"sortings"
] | 10751c875f4d7667ba21685c57cddd9e | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 5 \cdot 10^5$$$; $$$n \cdot m \le 10^6$$$) — the number of rows and the num... | 2,400 | For each testcase print an answer. If there are no perfect colorings and cuts in the matrix, then print "NO". Otherwise, first, print "YES". Then a string, consisting of $$$n$$$ characters: the $$$i$$$-th character should be 'R' if the $$$i$$$-th row is colored red and 'B' if it's colored blue. The string should contai... | standard output | |
PASSED | f6ff01349a554b8205627dec04f01cee | train_108.jsonl | 1635518100 | You are given a matrix, consisting of $$$n$$$ rows and $$$m$$$ columns. The $$$j$$$-th cell of the $$$i$$$-th row contains an integer $$$a_{ij}$$$.First, you have to color each row of the matrix either red or blue in such a way that at least one row is colored red and at least one row is colored blue.Then, you have to ... | 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 | ["3\n5 5\n1 5 8 8 7\n5 2 1 4 3\n1 6 9 7 5\n9 3 3 3 2\n1 7 9 9 8\n3 3\n8 9 8\n1 5 3\n7 5 7\n2 6\n3 3 3 2 2 2\n1 1 1 4 4 4"] | 4 seconds | ["YES\nBRBRB 1\nNO\nYES\nRB 3"] | NoteThe coloring and the cut for the first testcase: | Java 11 | standard input | [
"brute force",
"constructive algorithms",
"implementation",
"sortings"
] | 10751c875f4d7667ba21685c57cddd9e | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 5 \cdot 10^5$$$; $$$n \cdot m \le 10^6$$$) — the number of rows and the num... | 2,400 | For each testcase print an answer. If there are no perfect colorings and cuts in the matrix, then print "NO". Otherwise, first, print "YES". Then a string, consisting of $$$n$$$ characters: the $$$i$$$-th character should be 'R' if the $$$i$$$-th row is colored red and 'B' if it's colored blue. The string should contai... | standard output | |
PASSED | 9c5cbeccb9ce4abfa2cf4035071555c2 | train_108.jsonl | 1635518100 | You are given a matrix, consisting of $$$n$$$ rows and $$$m$$$ columns. The $$$j$$$-th cell of the $$$i$$$-th row contains an integer $$$a_{ij}$$$.First, you have to color each row of the matrix either red or blue in such a way that at least one row is colored red and at least one row is colored blue.Then, you have to ... | 256 megabytes | import java.util.*;
import java.io.*;
public class _116 {
public static void main(String[] args) {
MyScanner sc = new MyScanner();
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
int t = sc.nextInt();
outer: while (t-- > 0) {
int n = sc.... | Java | ["3\n5 5\n1 5 8 8 7\n5 2 1 4 3\n1 6 9 7 5\n9 3 3 3 2\n1 7 9 9 8\n3 3\n8 9 8\n1 5 3\n7 5 7\n2 6\n3 3 3 2 2 2\n1 1 1 4 4 4"] | 4 seconds | ["YES\nBRBRB 1\nNO\nYES\nRB 3"] | NoteThe coloring and the cut for the first testcase: | Java 11 | standard input | [
"brute force",
"constructive algorithms",
"implementation",
"sortings"
] | 10751c875f4d7667ba21685c57cddd9e | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 5 \cdot 10^5$$$; $$$n \cdot m \le 10^6$$$) — the number of rows and the num... | 2,400 | For each testcase print an answer. If there are no perfect colorings and cuts in the matrix, then print "NO". Otherwise, first, print "YES". Then a string, consisting of $$$n$$$ characters: the $$$i$$$-th character should be 'R' if the $$$i$$$-th row is colored red and 'B' if it's colored blue. The string should contai... | standard output | |
PASSED | f95248dd6f12024fd72d59605c82ac07 | train_108.jsonl | 1635518100 | You are given a matrix, consisting of $$$n$$$ rows and $$$m$$$ columns. The $$$j$$$-th cell of the $$$i$$$-th row contains an integer $$$a_{ij}$$$.First, you have to color each row of the matrix either red or blue in such a way that at least one row is colored red and at least one row is colored blue.Then, you have to ... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
static int MOD = 1000000007;
// After writing solution, quick scan for:
// array out of bounds
// special cases e.g. n=1?
// npe, particularly in maps
//
// Big numbers arithmetic bugs:
// in... | Java | ["3\n5 5\n1 5 8 8 7\n5 2 1 4 3\n1 6 9 7 5\n9 3 3 3 2\n1 7 9 9 8\n3 3\n8 9 8\n1 5 3\n7 5 7\n2 6\n3 3 3 2 2 2\n1 1 1 4 4 4"] | 4 seconds | ["YES\nBRBRB 1\nNO\nYES\nRB 3"] | NoteThe coloring and the cut for the first testcase: | Java 11 | standard input | [
"brute force",
"constructive algorithms",
"implementation",
"sortings"
] | 10751c875f4d7667ba21685c57cddd9e | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 5 \cdot 10^5$$$; $$$n \cdot m \le 10^6$$$) — the number of rows and the num... | 2,400 | For each testcase print an answer. If there are no perfect colorings and cuts in the matrix, then print "NO". Otherwise, first, print "YES". Then a string, consisting of $$$n$$$ characters: the $$$i$$$-th character should be 'R' if the $$$i$$$-th row is colored red and 'B' if it's colored blue. The string should contai... | standard output | |
PASSED | 8a75e7741d5bccd3033ccd549ba66c8d | train_108.jsonl | 1635518100 | You are given a matrix, consisting of $$$n$$$ rows and $$$m$$$ columns. The $$$j$$$-th cell of the $$$i$$$-th row contains an integer $$$a_{ij}$$$.First, you have to color each row of the matrix either red or blue in such a way that at least one row is colored red and at least one row is colored blue.Then, you have to ... | 256 megabytes | import java.util.*;
import java.io.*;
public class _116 {
public static void main(String[] args) {
MyScanner sc = new MyScanner();
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
int t = sc.nextInt();
outer: while (t-- > 0) {
int n = sc.... | Java | ["3\n5 5\n1 5 8 8 7\n5 2 1 4 3\n1 6 9 7 5\n9 3 3 3 2\n1 7 9 9 8\n3 3\n8 9 8\n1 5 3\n7 5 7\n2 6\n3 3 3 2 2 2\n1 1 1 4 4 4"] | 4 seconds | ["YES\nBRBRB 1\nNO\nYES\nRB 3"] | NoteThe coloring and the cut for the first testcase: | Java 11 | standard input | [
"brute force",
"constructive algorithms",
"implementation",
"sortings"
] | 10751c875f4d7667ba21685c57cddd9e | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 5 \cdot 10^5$$$; $$$n \cdot m \le 10^6$$$) — the number of rows and the num... | 2,400 | For each testcase print an answer. If there are no perfect colorings and cuts in the matrix, then print "NO". Otherwise, first, print "YES". Then a string, consisting of $$$n$$$ characters: the $$$i$$$-th character should be 'R' if the $$$i$$$-th row is colored red and 'B' if it's colored blue. The string should contai... | standard output | |
PASSED | 1149da4a5f0fd65cc1d80206d8407bff | train_108.jsonl | 1635518100 | You are given a matrix, consisting of $$$n$$$ rows and $$$m$$$ columns. The $$$j$$$-th cell of the $$$i$$$-th row contains an integer $$$a_{ij}$$$.First, you have to color each row of the matrix either red or blue in such a way that at least one row is colored red and at least one row is colored blue.Then, you have to ... | 256 megabytes | import java.util.*;
public class D {
public static final int MOD998 = 998244353;
public static final int MOD100 = 1000000007;
public static void main(String[] args) throws Exception {
ContestScanner sc = new ContestScanner();
ContestPrinter cp = new ContestPrinter();
int T = sc.ne... | Java | ["3\n5 5\n1 5 8 8 7\n5 2 1 4 3\n1 6 9 7 5\n9 3 3 3 2\n1 7 9 9 8\n3 3\n8 9 8\n1 5 3\n7 5 7\n2 6\n3 3 3 2 2 2\n1 1 1 4 4 4"] | 4 seconds | ["YES\nBRBRB 1\nNO\nYES\nRB 3"] | NoteThe coloring and the cut for the first testcase: | Java 11 | standard input | [
"brute force",
"constructive algorithms",
"implementation",
"sortings"
] | 10751c875f4d7667ba21685c57cddd9e | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 5 \cdot 10^5$$$; $$$n \cdot m \le 10^6$$$) — the number of rows and the num... | 2,400 | For each testcase print an answer. If there are no perfect colorings and cuts in the matrix, then print "NO". Otherwise, first, print "YES". Then a string, consisting of $$$n$$$ characters: the $$$i$$$-th character should be 'R' if the $$$i$$$-th row is colored red and 'B' if it's colored blue. The string should contai... | standard output | |
PASSED | 9a8f32505e9fc45db11f44179fec3f3a | train_108.jsonl | 1657982100 | You are given a connected undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. The weight of the $$$i$$$-th edge is $$$i$$$.Here is a wrong algorithm of finding a minimum spanning tree (MST) of a graph:vis := an array of length ns := a set of edgesfunction dfs(u): vis[u] := true iterate through each... | 256 megabytes | // upsolve with kaiboy, coached by rainboy
import java.io.*;
import java.util.*;
public class CF1708E extends PrintWriter {
CF1708E() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1708E o = new CF1708E(); o.main(); o.flush();
}
int[] ds;
int find(int i) {
... | Java | ["5 5\n1 2\n3 5\n1 3\n3 2\n4 2", "10 11\n1 2\n2 5\n3 4\n4 2\n8 1\n4 5\n10 5\n9 5\n8 2\n5 7\n4 6"] | 1 second | ["01111", "0011111011"] | NoteHere is the graph given in the first example. There is only one minimum spanning tree in this graph. A minimum spanning tree is $$$(1,2),(3,5),(1,3),(2,4)$$$ which has weight $$$1+2+3+5=11$$$.Here is a part of the process of calling findMST(1): reset the array vis and the edge set s; calling dfs(1); vis[1] := t... | Java 11 | standard input | [
"dfs and similar",
"graphs",
"greedy"
] | 2bf41400fa51f472f1d3904baa06d6a8 | The first line of the input contains two integers $$$n$$$, $$$m$$$ ($$$2\le n\le 10^5$$$, $$$n-1\le m\le 2\cdot 10^5$$$) — the number of vertices and the number of edges in the graph. Each of the following $$$m$$$ lines contains two integers $$$u_i$$$ and $$$v_i$$$ ($$$1\le u_i, v_i\le n$$$, $$$u_i\ne v_i$$$), describi... | 2,400 | You need to output a binary string $$$s$$$, where $$$s_i=1$$$ if findMST(i) creates an MST, and $$$s_i = 0$$$ otherwise. | standard output | |
PASSED | 497d3dc3b27d616320e1328101b000f0 | train_108.jsonl | 1657982100 | You are given a connected undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. The weight of the $$$i$$$-th edge is $$$i$$$.Here is a wrong algorithm of finding a minimum spanning tree (MST) of a graph:vis := an array of length ns := a set of edgesfunction dfs(u): vis[u] := true iterate through each... | 256 megabytes | //package com.example.practice.codeforces.sc2400;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
//E. DFS Trees
public class Solution2 {
public static void main (String [] args) ... | Java | ["5 5\n1 2\n3 5\n1 3\n3 2\n4 2", "10 11\n1 2\n2 5\n3 4\n4 2\n8 1\n4 5\n10 5\n9 5\n8 2\n5 7\n4 6"] | 1 second | ["01111", "0011111011"] | NoteHere is the graph given in the first example. There is only one minimum spanning tree in this graph. A minimum spanning tree is $$$(1,2),(3,5),(1,3),(2,4)$$$ which has weight $$$1+2+3+5=11$$$.Here is a part of the process of calling findMST(1): reset the array vis and the edge set s; calling dfs(1); vis[1] := t... | Java 11 | standard input | [
"dfs and similar",
"graphs",
"greedy"
] | 2bf41400fa51f472f1d3904baa06d6a8 | The first line of the input contains two integers $$$n$$$, $$$m$$$ ($$$2\le n\le 10^5$$$, $$$n-1\le m\le 2\cdot 10^5$$$) — the number of vertices and the number of edges in the graph. Each of the following $$$m$$$ lines contains two integers $$$u_i$$$ and $$$v_i$$$ ($$$1\le u_i, v_i\le n$$$, $$$u_i\ne v_i$$$), describi... | 2,400 | You need to output a binary string $$$s$$$, where $$$s_i=1$$$ if findMST(i) creates an MST, and $$$s_i = 0$$$ otherwise. | standard output | |
PASSED | 62b4a67a4e6db7a45e3ed470e34b4297 | train_108.jsonl | 1657982100 | You are given a connected undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. The weight of the $$$i$$$-th edge is $$$i$$$.Here is a wrong algorithm of finding a minimum spanning tree (MST) of a graph:vis := an array of length ns := a set of edgesfunction dfs(u): vis[u] := true iterate through each... | 256 megabytes | //package com.example.practice.codeforces;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.StringTokenizer;
public clas... | Java | ["5 5\n1 2\n3 5\n1 3\n3 2\n4 2", "10 11\n1 2\n2 5\n3 4\n4 2\n8 1\n4 5\n10 5\n9 5\n8 2\n5 7\n4 6"] | 1 second | ["01111", "0011111011"] | NoteHere is the graph given in the first example. There is only one minimum spanning tree in this graph. A minimum spanning tree is $$$(1,2),(3,5),(1,3),(2,4)$$$ which has weight $$$1+2+3+5=11$$$.Here is a part of the process of calling findMST(1): reset the array vis and the edge set s; calling dfs(1); vis[1] := t... | Java 11 | standard input | [
"dfs and similar",
"graphs",
"greedy"
] | 2bf41400fa51f472f1d3904baa06d6a8 | The first line of the input contains two integers $$$n$$$, $$$m$$$ ($$$2\le n\le 10^5$$$, $$$n-1\le m\le 2\cdot 10^5$$$) — the number of vertices and the number of edges in the graph. Each of the following $$$m$$$ lines contains two integers $$$u_i$$$ and $$$v_i$$$ ($$$1\le u_i, v_i\le n$$$, $$$u_i\ne v_i$$$), describi... | 2,400 | You need to output a binary string $$$s$$$, where $$$s_i=1$$$ if findMST(i) creates an MST, and $$$s_i = 0$$$ otherwise. | standard output | |
PASSED | 696e09106dbd64c96566217c80e79cb8 | train_108.jsonl | 1657982100 | You are given a connected undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. The weight of the $$$i$$$-th edge is $$$i$$$.Here is a wrong algorithm of finding a minimum spanning tree (MST) of a graph:vis := an array of length ns := a set of edgesfunction dfs(u): vis[u] := true iterate through each... | 256 megabytes | import java.util.*;
import java.util.function.*;
import java.io.*;
// you can compare with output.txt and expected out
public class Round808E {
MyPrintWriter out;
MyScanner in;
// final static long FIXED_RANDOM;
// static {
// FIXED_RANDOM = System.currentTimeMillis();
// }
final static String IMPO... | Java | ["5 5\n1 2\n3 5\n1 3\n3 2\n4 2", "10 11\n1 2\n2 5\n3 4\n4 2\n8 1\n4 5\n10 5\n9 5\n8 2\n5 7\n4 6"] | 1 second | ["01111", "0011111011"] | NoteHere is the graph given in the first example. There is only one minimum spanning tree in this graph. A minimum spanning tree is $$$(1,2),(3,5),(1,3),(2,4)$$$ which has weight $$$1+2+3+5=11$$$.Here is a part of the process of calling findMST(1): reset the array vis and the edge set s; calling dfs(1); vis[1] := t... | Java 17 | standard input | [
"dfs and similar",
"graphs",
"greedy"
] | 2bf41400fa51f472f1d3904baa06d6a8 | The first line of the input contains two integers $$$n$$$, $$$m$$$ ($$$2\le n\le 10^5$$$, $$$n-1\le m\le 2\cdot 10^5$$$) — the number of vertices and the number of edges in the graph. Each of the following $$$m$$$ lines contains two integers $$$u_i$$$ and $$$v_i$$$ ($$$1\le u_i, v_i\le n$$$, $$$u_i\ne v_i$$$), describi... | 2,400 | You need to output a binary string $$$s$$$, where $$$s_i=1$$$ if findMST(i) creates an MST, and $$$s_i = 0$$$ otherwise. | standard output | |
PASSED | 01363b84d3712abc3978597c6acbc423 | train_108.jsonl | 1657982100 | You are given a connected undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. The weight of the $$$i$$$-th edge is $$$i$$$.Here is a wrong algorithm of finding a minimum spanning tree (MST) of a graph:vis := an array of length ns := a set of edgesfunction dfs(u): vis[u] := true iterate through each... | 256 megabytes | import java.util.*;
import java.util.function.*;
import java.io.*;
// you can compare with output.txt and expected out
public class Round808E {
MyPrintWriter out;
MyScanner in;
// final static long FIXED_RANDOM;
// static {
// FIXED_RANDOM = System.currentTimeMillis();
// }
final static String IMPO... | Java | ["5 5\n1 2\n3 5\n1 3\n3 2\n4 2", "10 11\n1 2\n2 5\n3 4\n4 2\n8 1\n4 5\n10 5\n9 5\n8 2\n5 7\n4 6"] | 1 second | ["01111", "0011111011"] | NoteHere is the graph given in the first example. There is only one minimum spanning tree in this graph. A minimum spanning tree is $$$(1,2),(3,5),(1,3),(2,4)$$$ which has weight $$$1+2+3+5=11$$$.Here is a part of the process of calling findMST(1): reset the array vis and the edge set s; calling dfs(1); vis[1] := t... | Java 17 | standard input | [
"dfs and similar",
"graphs",
"greedy"
] | 2bf41400fa51f472f1d3904baa06d6a8 | The first line of the input contains two integers $$$n$$$, $$$m$$$ ($$$2\le n\le 10^5$$$, $$$n-1\le m\le 2\cdot 10^5$$$) — the number of vertices and the number of edges in the graph. Each of the following $$$m$$$ lines contains two integers $$$u_i$$$ and $$$v_i$$$ ($$$1\le u_i, v_i\le n$$$, $$$u_i\ne v_i$$$), describi... | 2,400 | You need to output a binary string $$$s$$$, where $$$s_i=1$$$ if findMST(i) creates an MST, and $$$s_i = 0$$$ otherwise. | standard output | |
PASSED | 7896b589d1e05d4745669b5107aeae6b | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 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 | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 8 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 1fc3e267a79e130d5d49a5c9c9c4e3ee | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static FastReader sc=new FastReader();
static PrintWriter out=new PrintWriter(System.out);
static int dx[]={0,0,-1,1},dy[]={-1,1,0,0};
static final double pi=3.1415926536;
static long mod=1000000007;
// static long mod=998244353;
static int ... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 8 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 2c20808db67ef8cae130f316960dc73a | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.util.*;
import java.io.*;
// res.append("Case #"+(p+1)+": "+hh+" \n");
////***************************************************************************
/* public class E_Gardener_and_Tree implements Runnable{
public static void main(String[] args) throws Exception {
new Thr... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 8 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | c89ab8fe56f6ecdafca2c6571ec3e4de | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
StringBuffer out = new StringBuffer();
BufferedReader br = ne... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 8 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 54b93e1361ecabc16f3fa2b38627932a | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | //package d;
import java.util.*;
import java.io.*;
public class D {
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw=new PrintWriter(System.out);
int cases=Integer.parseInt(br.readLine());... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 8 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | ade4331e9d348b6fb3022589d21f1507 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.security.KeyStore.Entry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Coll... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 8 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 3d0595f036d985bd473716244aa17753 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 8 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | fc1df46eed0f9fdb06d46cecb40cac28 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | /* || श्री राम समर्थ ||
|| जय जय रघुवीर समर्थ ||
*/
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.*;
import static java.util.Arrays.sort;
/*
... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 8 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 0e457c5937cfc1e1cc8f08fe92753920 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static long startTime = System.currentTimeMillis();
// for global initializations and methods starts here
// global initialisations and methods end here
static void run() {
boolean tc = true;
AdityaFastIO r = new... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 8 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | e1093f72621c6759df5e809f06077d7a | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
import java.util.TreeSet;
public class D1708 {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int tests = scan.nextInt();
for(int t = 0; t < tests; t ++){
int n = scan.nextInt();
// ... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 8 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 360bdf04d063f3171bc4cb7ad67f9a6f | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.TreeMap;
public class D {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader in = new BufferedReader(new InputStrea... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 8 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 8c38514da03d284a06bede6e57f5b3f8 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.*;
import java.text.*;
import java.util.*;
import java.util.function.*;
/**
* Provide prove of correctness before implementation. Implementation can cost a lot of time.
* Anti test that prove that it's wrong.
* <p>
* Do not confuse i j k g indexes, upTo and length. Do extra methods!!! Write... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 17 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 0ef18595fbb00361c26c5dd3715a1475 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.util.*;
import java.util.function.*;
import java.io.*;
// you can compare with output.txt and expected out
public class Round808D {
MyPrintWriter out;
MyScanner in;
// final static long FIXED_RANDOM;
// static {
// FIXED_RANDOM = System.currentTimeMillis();
// }
final static String IMPO... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 17 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | ffd1209e3f5a013bb1ad7229a481d63c | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | //package com.example.practice.codeforces;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Solution {
final static int[] map = new int[500001... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 17 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | ecb31e547370f57e900a9fd56fa212e2 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | //package com.example.practice.codeforces;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;
public class Solution {
final sta... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 17 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 27016e93bc4633fc58d72d2a7b873184 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.*;
import java.util.*;
public class D {
Input in;
PrintWriter out;
public D() {
in = new Input(System.in);
out = new PrintWriter(System.out);
}
public static void main(String[] args) {
D solution = new D();
for (int t = solution.in.ne... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 17 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | c1c1393f327204d9d1fc5e0785ea2317 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Map;
import java.io.Writer;
import j... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 17 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | a120fda905fcf0bdafe0aeaf4d0084e5 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt(), cnt[] = new int[500001];
while (t-- > 0) {
int n = scanner.nextInt();
Array... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | ed28cd666e9418cc7a41a30bfe50aa68 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt(), cnt[] = new int[500001];
while (t-- > 0) {
int n = scanner.nextInt();
Array... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | c6a0a5226e5cc584920cb263d5773911 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t>0)
{
... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 273a4ab3968afb4c2bd3e19585775dbd | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.*;
import java.util.*;
public class codeforces_808_D {
private static void solve(FastIOAdapter in, PrintWriter out) {
int n = in.nextInt();
int[] a = in.readArray(n);
Map<Integer, Integer> map = new TreeMap<>();
for (int i = 1; i < n; i++) {
int... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 7df057b17fd510caa0311fafd78b4889 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 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 void main(String[] args) {
int len = obj.nextInt();
while (len-- != 0) {
int n = obj.nextInt();
Vector<Intege... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 0985d3252a1604bdb5ed92e9ab3adb3f | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.*;
import java.util.*;
public class new1{
static int mod = 998244353;
public static long gcd(long a, long b)
{
if (a == 0)
return b;
return gcd(b%a, a);
}
public static void main(String[] args) throws IOException{
BufferedWriter output = new Buffered... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | af39bc297381912aa43d136b618f5e85 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.*;
import java.util.*;
// whole solution
public class new1{
static int mod = 998244353;
public static long gcd(long a, long b)
{
if (a == 0)
return b;
return gcd(b%a, a);
}
public static void main(String[] args) throws IOException{
BufferedWriter ou... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | e2d9a1c5b8d27bec0b4af7957282da13 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import java.util.TreeMap;
import java.util.StringTokenizer;
im... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | af28f1e6aa3435dd584cd485ad4ab541 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import java.util.TreeMap;
import java.util.StringTokenizer;
im... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | f7edc83e958402db07cd2007cf2d681b | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main{
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader(){
br = new BufferedReader(new InputStreamReader(System.in));
}
String next(){
while (st == null ... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 663bf8c55615c126e2795dd5cf557878 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static PrintWriter pw;
static Scanner sc;
public static void main(String[] args) throws Exception {
sc = new Scanner(System.in);
pw = new PrintWriter(System.out);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
Array... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | c3bfbe079b6e335a64fb62e3d0409b6e | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.*;
import java.util.Arrays;
public class DifferenceArray {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 812f466374583c529e411c105cdb4633 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.util.*;
import java.io.*;
public class practise {
static boolean multipleTC = true;
final static int Mod = 1000000007;
final static int Mod2 = 998244353;
final double PI = 3.14159265358979323846;
int MAX = 1000000007;
void pre() throws Exception {
}
void DFSUtil(int v, boolean[] vi... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 129701570a1b3d4a88b2f233b3d6c1ef | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
public class D {
public static void println (Object o) {System.out.println(o);}
public static void print ... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | cf2655438a9a4cbc365085716fcb2dbe | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | // package c1708;
//
// Codeforces Round #808 (Div. 2) 2022-07-16 07:35
// D. Difference Array
// https://codeforces.com/contest/1708/problem/D
// time limit per test 1 second; memory limit per test 256 megabytes
// public class Pseudo for 'Source should satisfy regex [^{}]*public\s+(final)?\s*class\s+(\w+).*'
//
// Y... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 41c63083e98f2e9b9ac3925ef5d933f7 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
//BufferedReader f = new BufferedReader(new FileReader("uva.in"));
//PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("milkvisits.out")));
Buffered... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 2d1544656b97605982d0b55e1cd9005c | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | //Utilities
import java.io.*;
import java.util.*;
public class a {
static int t;
static int n;
static ArrayList<Integer> a;
public static void main(String[] args) throws IOException {
t = in.iscan();
while (t-- > 0) {
n = in.iscan();
a = new ArrayList<Integer>();
int zeroCnt = 0;
f... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | eed68d727561eb56572cad1bbb6efe70 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.util.*;
import java.util.Map.Entry;
import javax.swing.ToolTipManager;
import org.xml.sax.HandlerBase;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.*;
import jav... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 422ae79d7d714871b210b4c4d856ad43 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
public class DifferenceArray {
/*
XqnbwZPKcYZgS6Dv43F1xCyaWzekaw7DAlE0lECn+9uoFKfCeFcSralYFcgaMLe157XJfdm5fP5lDd9ZDu5GhmKrCZasI2xq0h73lK6cLkvLaE2o+demx5... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | cea12805dd856da0b72f6020d04c48eb | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 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 CodeForces {
static private final String INPUT = "input.txt";
s... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 0785631f7e6c096751bf1a6d56440fca | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static ContestScanner sc = new ContestScanner(System.in);
static PrintWriter pw = new PrintWriter(System.out);
static StringBuilder sb = new StringBuilder();
static long mod = (long) 1e9 + 7;
public static void main(String[] args) ... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 90f7a35ba7fe235f591dab3533636481 | train_108.jsonl | 1657982100 | You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. It is guaranteed that $$$a$$$ is sorted from small to large.For each operation, we generate a new array $$$b_i=a_{i+1}-a_{i}$$$ for $$$1 \le i < n$$$. Then we sort $$$b$$$ from small to large, replace $$$a$$$ with $$$b$$$, and decrease $$$n$... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF1708D extends PrintWriter {
CF1708D() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1708D o = new CF1708D(); o.main(); o.flush();
}
void main() {
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.... | Java | ["5\n\n3\n\n1 10 100\n\n4\n\n4 8 9 13\n\n5\n\n0 0 0 8 13\n\n6\n\n2 4 8 16 32 64\n\n7\n\n0 0 0 0 0 0 0"] | 1 second | ["81\n3\n1\n2\n0"] | NoteTo simplify the notes, let $$$\operatorname{sort}(a)$$$ denote the array you get by sorting $$$a$$$ from small to large.In the first test case, $$$a=[1,10,100]$$$ at first. After the first operation, $$$a=\operatorname{sort}([10-1,100-10])=[9,90]$$$. After the second operation, $$$a=\operatorname{sort}([90-9])=[81]... | Java 11 | standard input | [
"brute force",
"sortings"
] | 499b1440d8bb528d089724910e37e226 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$2\le n\le 10^5$$$) — the length of the array $$$a$$$. The second lin... | 1,900 | For each test case, output the answer on a new line. | standard output | |
PASSED | 131c5376dd1fa580162791d6013916e9 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Collectors;
public class coding {
static class Fa... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | cf5e2cd8e3b2ce1d089aee56355192d6 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Collectors;
public class coding {
static class Fas... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 09e336aaeba34065cae038ca3863cc43 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | // Working program with FastReader
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
import java.lang.*;
import java.util.stream.*;
import java.util.stream.Collectors;
public class Main... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 531ddce7adf1987923d9ba055ccb5fb0 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class cf {
public static int gcd(int a, int b){
if(b == 0){
return a;
}
return gcd(b, a % b);
}
public static boolean isok(long x, long h, long k){
long sum = 0;
if(h > k){
long t... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 335ead3be0c4562dedee7c307ddf460c | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.lang.*;
import java.io.*;
import java.util.*;
public class codeforces {
static int max = Integer.MAX_VALUE, min = Integer.MIN_VALUE;
long maxl = Long.MAX_VALUE, minl = Long.MIN_VALUE;
static PrintWriter pw = new PrintWriter(System.out);
static StringBuilder sb = new StringBuilder();... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 712b435aa879b0fdf95608443b930a2e | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
public class B {
public static void main(String[] args) throws java.lang.Exception {
Reader scan = new Reader();
int tc = scan.nextInt();
for (int i = 0; i < tc; i++) {
int n = scan.nextInt()... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 6edfb2ecfc995fcece8e83e7ceccf492 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.*;
public class weird_algrithm {
static BufferedWriter output = new BufferedWriter(
new OutputStreamWriter(Syst... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 91ec1c3454ef3e06d18e33d7421b3f0a | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.*;
public class Main{
static int total=0;
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int t=in.nextInt();
for(int h=0;h<t;h++){
long n=in.nextInt();
long l=in.nextInt();
long r=in.nextInt();
boolean ans=true;
... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 21230b148307e7144b9b178b7c009d41 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.*;
public class Main{
static int total=0;
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int t=in.nextInt();
for(int h=0;h<t;h++){
long n=in.nextInt();
long l=in.nextInt();
long r=in.nextInt();
boolean ans=true;
... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 92f30175da817221637a7a69d901a7ab | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.*;
public class DifferenceOfGCDs {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
outer:
while(t-->0) {
int n=sc.nextInt();
int l=sc.nextInt();
int k=l;
int r=sc.nextInt();
// if(t==10000-4318) {
// System.out.pri... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | b9a1c9e7763e8b5de49b028012ccc289 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.Scanner;
public class DifferenceOfGCDs {
public static void main(String[] args) {
Scanner input=new Scanner (System.in);
int t=input.nextInt();
for(int i=0;i<t;i++)
{
int n=input.nextInt();
long arr[]=new long[n];boolean flag=true;
lo... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 6f33434ad5f26633dd8e90aca12a416d | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class DifferenceOfGCDs {
public static void main(String[] args) {
Scanner input=new Scanner (System.in);
long t=input.nextInt();
for(int i=0;i<t;i++)
{
long n=input.nextInt();
ArrayList<Long> arr=ne... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 78c9990e7a0063ae18eb3583b7430618 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.*;
public class DifferenceOfGCDs {
public static void main(String[] args) {
Scanner input=new Scanner (System.in);
int t=input.nextInt();
for(int i=0;i<t;i++)
{
StringBuilder sb = new StringBuilder();
int n=input.nextInt();
// Arra... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | f9593134621faffefa680eb16aa83b3a | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.Scanner;
import java.util.Arrays;
import java.util.stream.Collectors;
import static java.lang.Math.max;
import static java.lang.Math.min;
public class B {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int t = input.nextInt();
... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 135ef6e434a6ea12d3f40d1187f13861 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes |
import java.util.*;
import java.lang.*;
import java.io.*;
public class Codechef {
public static void main(String[] args) throws java.lang.Exception {
PrintWriter out = new PrintWriter(System.out);
FastScanner sc = new FastScanner();
int t=sc.nextInt();
while(t-->0)
... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 458d885d68a8d95ddc99496ae86e2191 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(Sys... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 992759c3a5e9ee2d078e5d6879a50e48 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static long mod = 1000000007;
static int[]parent;
static int[]rank;
static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
public static void main(String[] args) throws IOException {
FastReader sc = new FastReader(... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | ac5de6807c63e40ef33df935f48a13d7 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static long mod = 1000000007;
static int[]parent;
static int[]rank;
static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
public static void main(String[] args) throws IOException {
FastReader sc = new FastReader(... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 8732c42ebccda5145edca84b27323470 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.*;
import java.io.*;
public class mm
{
public static void main (String[] args) throws IOException
{
Scanner sc=new Scanner (System.in);
int t=sc.nextInt();
while(t-->0){
long n=sc.nextLong();
long l=sc.nextLong();
long r=sc.nextLong... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 28864bcfcea34920c6d60fdd2faa3f6a | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.*;
public class Main {
public static long gcd(long a,long b)
{
if(a==0)return b;
return gcd(b%a,a);
}
public static void main(String[] args)
{
Scanner obj=new Scanner(System.in);
int len=obj.nextInt();
while(len--!=0)
{
... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | e49c67dbbc4013acb9cd7382de5c964e | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.Scanner;
public class div2B {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int k = in.nextInt();
for(int j =0; j<k ;j ++) {
int n =in.nextInt();
long l =in.nextLong();
long q =in.nextLong();
long[] niz = new long[n];
niz[0] = l;... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 768f5049c6870c3b21f91fb44817836c | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main extends PrintWriter {
Main() { super(System.out); }
static boolean cases = true;
// Solution
void solve(int t) {
int n = sc.nextInt();
int l = sc.nextInt();
int r = sc.nextInt()... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 86c10a0ba0510df8f19725298fb901c6 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.Scanner;
public class B {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int t = sc.nextInt();
for (int i = 0; i < t; i++) {
solve();
}
}
public static void solve(){
int n=sc.nextInt();
... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | ed920a6a563761cd8916a9fd0a6b2402 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.ArrayList;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
public class DifferenceOfGCSs {
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
privat... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | c3b3ecb273ea1010f47c8d68347887fc | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.HashSet;
import java.util.StringTokenizer;
public class cf799 {
static class FastReader{
BufferedReader br;
StringTokenizer st;
public FastReader(){
br=new BufferedReader(new InputStreamReader(System.in));
... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 8ccfe21796669159672115cf40386202 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.Scanner;
/*
gcd(a[i], i) = i
Therefore, multiples of each i, bigger than the one just lesser than L should be less than R.
*/
public class B {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
int T = sc.nextInt();
while (T-... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 56dee05e151ddb035103bde81c03c601 | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Qb {
static int mod = (int) (1e9 + 7);
static void solve() {
long n = l();
long l = i();
long r = l();
long[] arr = new long[(int) (n+1)];
for (int i = 1; i <=n; i++) {
long next=(( l+i-1)/i)*i;
... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | d32c8f3a314792ba61b0d33574dc582a | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int tc=0;tc<t;tc++){
int n = sc.nextInt();
int l = sc.nextInt();
int r = sc.nextInt();
... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output | |
PASSED | 809a8e23330b4c84b4fd41aa39784f2e | train_108.jsonl | 1657982100 | You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces {
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
pu... | Java | ["4\n5 1 5\n9 1000 2000\n10 30 35\n1 1000000000 1000000000"] | 1 second | ["YES\n1 2 3 4 5\nYES\n1145 1926 1440 1220 1230 1350 1001 1000 1233\nNO\nYES\n1000000000"] | NoteIn the first test case, $$$\gcd(1,a_1),\gcd(2,a_2),\ldots,\gcd(5,a_5)$$$ are equal to $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$5$$$, respectively. | Java 11 | standard input | [
"constructive algorithms",
"math"
] | d2cc6efe7173a64482659ba59efeec16 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed... | 1,100 | For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.