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 | 1564041efee057a0c2c1ddd5b1940e20 | train_001.jsonl | 1495877700 | In his spare time Vladik estimates beauty of the flags.Every flag could be represented as the matrix n × m which consists of positive integers.Let's define the beauty of the flag as number of components in its matrix. We call component a set of cells with same numbers and between any pair of cells from that set there e... | 256 megabytes | //package round416;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class E {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni(), m = n... | Java | ["4 5 4\n1 1 1 1 1\n1 2 2 3 3\n1 1 1 2 5\n4 4 5 5 5\n1 5\n2 5\n1 2\n4 5"] | 2 seconds | ["6\n7\n3\n4"] | NotePartitioning on components for every segment from first test case: | Java 8 | standard input | [
"data structures",
"dsu",
"graphs"
] | 167594e0be56b9d93e62258eb052fdc3 | First line contains three space-separated integers n, m, q (1 ≤ n ≤ 10, 1 ≤ m, q ≤ 105) — dimensions of flag matrix and number of segments respectively. Each of next n lines contains m space-separated integers — description of flag matrix. All elements of flag matrix is positive integers not exceeding 106. Each of next... | 2,600 | For each segment print the result on the corresponding line. | standard output | |
PASSED | bc29c986563d39c44660ae548353fed0 | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | import java.io.*;
import java.util.*;
public class CODEFORCES
{
private InputStream is;
private PrintWriter out;
int time = 0, DP[], start[], end[], dist[], black[], MOD = (int) (1e9 + 7),
arr[], weight[][], x[], y[], parent[];
int MAX = 10000010, N, K;
long red[];
ArrayList<Integer>[] amp;
ArrayL... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | 44abfc7d0fc0c200e1df07956caa8a57 | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | import java.io.*;
import java.util.*;
public class First {
private static final Scanner sc = new Scanner(System.in);
private static final PrintWriter pw = new PrintWriter(System.out);
private static StringBuffer ans = new StringBuffer();
private static final long mod = 1000000007L;
private static H... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | 29086252364919032b3881df6abb03ab | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author k... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | 2e7b5f16afec9aa02aa81a2d4bcd30fb | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | /*
Keep solving problems.
*/
import java.util.*;
import java.io.*;
public class CFA {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
final long MOD = 1000L * 1000L * 1000L + 7;
int n;
List<List<Integer>> graph;
int cnt;
boolean[] vis;
void solve() throws... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | a8f602d90ba312ae54376849bd106f92 | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | import java.math.*;
import java.util.*;
public class Main {
static class Max {
long val;
long key;
public Max(long value,long Key){
val=value;
key=Key;
}
public long getKey() {
return key;
}
public long getVal() {
... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | 6a96b227012ef81e3d720e87416e444e | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | import javax.xml.stream.util.EventReaderDelegate;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.security.KeyPair;
import java.util.*;
public class Main {
static long[][] c ;
static int[] arr;
... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | 06a769a3915abcb6ceacc07d56e57522 | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.*;
import java.io.*;
im... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | d7349b1f2ede2d8ca5bc70da24e8910d | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
static class Reader
{
private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
public int read() {if (nu... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | cb3efd075f463176aa54e98b5c6da255 | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Col... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | 179e6b8bdcda1f207c502957cecfa6b3 | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | import java.util.*;
import java.io.*;
public class CF884C {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] child = new int[n+1];
for(int i = 1; i < child.length; i++){
child[i] = sc.nextInt();
}
long[] sizes = new... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | 131e7cc6c669f55c497bcb9ef9459fe8 | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
/**
* Created by Giorgi on 9/12/2015.
*/
public class Main {
private static boolean[] marked;
private static int[] path;
private static long count;
private static int n;
private static List... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | fd098c5d50120a10e9fff9ddc3e3014f | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.InputMismatchException;
import java.util.List;
public class Main {
private static final int MAXN... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | 9e87f8738db938ac1fb18295de7e6287 | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | import java.awt.image.IndexColorModel;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class A {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni();
int p[] = new int[n+1];
for(i... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | ffd8c26715e4356465c40e69db3b2ffc | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
public class P884C {
private static class HpReader {
private BufferedReader in;
private String containingDirPath;
public HpReader(String dir, String inFile, Strin... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | b010a847d687992a4f752aa598f976e0 | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Ha... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | 1c74b850deb83e051b74000942d644ee | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | /* package whatever; // 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 Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner scan = new Scanner(System.in);
i... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | e36ee9f09b6158517b77bd7f422aa7dc | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | import java.io.*;
import java.util.*;
/*
TASK: CFC
LANG: JAVA
*/
public class CFC {
static int n , cnt;
static int[] p;
static long[] sz;
static boolean[] seen;
public static void main(String[] args) throws IOException {
FastScanner in = new FastScanner(System.in);
n = in.nextInt()... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | 1b93ec016d781334ee6574807fa3d727 | train_001.jsonl | 1509113100 | The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.There are n stations in the subway. It was built according to the Bertown Transport Law: For each station i there exists exactly one train that goes from this station. Its dest... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.Stream;
import java.util.Collection;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Collections;
import java.util.stream.Collectors;
import java... | Java | ["3\n2 1 3", "5\n1 5 4 3 2"] | 1 second | ["9", "17"] | NoteIn the first example the mayor can change p2 to 3 and p3 to 1, so there will be 9 pairs: (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).In the second example the mayor can change p2 to 4 and p3 to 5. | Java 8 | standard input | [
"dfs and similar",
"greedy",
"math"
] | ad9fd71025c5f91cece740ea95b0eb6f | The first line contains one integer number n (1 ≤ n ≤ 100000) — the number of stations. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — the current structure of the subway. All these numbers are distinct. | 1,500 | Print one number — the maximum possible value of convenience. | standard output | |
PASSED | fcc6963fe21f950fbf1570cb9efc2d67 | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes |
import java.util.Arrays;
import java.util.Scanner;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author KHALED
*/
public class XeniaandDivisors {
public static voi... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 52f4239aa9f6afde59ab6aa1d80405b8 | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.Comparator;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import jav... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 7b9b79056f0ca39864542427f446b6ee | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static BufferedReader br;
static FileInputStream fis;
static InputStreamReader isr;
static FileWriter fw;
public static void main(String[] args) throws IOException{
//fis = new FileInputStream("input.txt");
//isr = new InputStreamReader(fis);
isr = ... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | f0ca71106798d7003545ce925231c68b | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.HashMap;
import java.util.Scanner;
/**
* Author: Trofimov Artem
* Date: 07.09.13
*/
public class Index {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int array[] = new int[n];
for (int i = 0; i < n... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | a3d3536446bf3a72bc0774ba5c9c48c0 | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes |
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
public class _Solution implements Runnable{
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader in;
PrintWriter out;
... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 51bb727c5f8d40582074305e88cd857c | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.*;
import java.math.BigInteger;
public class zad {
private static BufferedReader in;
private static StringTokenizer tok;
private static PrintWriter out;
private static String readToken() throws IOException {
while (tok == null || !tok.hasMoreTo... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 06da3f72ebcbe74de9258fa631c4e76a | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes |
import java.util.Scanner;
public class XeniaAndDivisors {
public static void main(String asd[])throws Exception
{
Scanner in=new Scanner(System.in);
int n=in.nextInt();
int a[]=new int[8];
for(int i=0;i<n;i++)
a[in.nextInt()]++;
int k=n/3;
if(a[1]==k... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 38842b041932633ddec133156299bf9a | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.*;
public class xad
{
public static void main(String ar[])
{
Scanner obj=new Scanner(System.in);
int n=Integer.parseInt(obj.nextLine());
int arr[]=new int[n];
int a,b,c;
for(int i=0;i<n;i++)
arr[i]=obj.nextInt();
Arrays.sort(arr);
int count=0;
for(int j=0;j<n/3;j++)
{
a=arr[j];
b=arr[j+(n/3)];
c=arr... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | d84f6188c0691d01f7cc4c35e1a7091e | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.*;
import java.util.*;
public class mierda{
public static void main(String args[]) throws IOException{
BufferedReader lector = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(lector.readLine());
String t[] = lector.readLine().split(" ");
int tal[] = new int[8];
boolean pail... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 4e56de08980e14321971e9a170010e7a | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
StringBuilder out = new StringBuilder();
int n = in.nextInt();
int[] a = new int[7+1];
for (int i = 0; i < n; i++) {
a[in.nextInt()]++;
}
... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | e8c28afcd6085cb228cbec13f4cde789 | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.PrintWriter;
import java.util.Scanner;
public class A342 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int count[] = new int[8];
for (int i = 0; i < n; ++i) {
count[in.nextInt()]++;
}
... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 3a6926219e8734ba94072708bf9652fb | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class solver {
BufferedReader in;
PrintWriter out;
StringTokenizer tok;
final boolean OJ=System.getProperty("ONLINE_JUDGE")!=null;
String readString() throws IOException{
while (tok==null || !tok.hasMoreTok... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 2ef94160885ca152a7babb1c98936ac5 | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.math.BigDecimal;
import java.io.BufferedWriter;
import java.util.Locale;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigIntege... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 43861b3a05bcad73d2c142b09935c8b7 | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class con199_A {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
St... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 2d633850171b9df52f43201d078a4537 | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.*; //Scanner;
import java.io.PrintWriter; //PrintWriter
public class R199_Div2_A //Name: Xenia and Divisors
{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
solve(in, out);
out.close();
in.close();
}
pub... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | cd84379d05a669452d991f5310e2d45b | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.Scanner;
public class XeniaAndDivisors {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] deg = new int[8];
for (int i = 0; i < n; i++)
deg[scan.nextInt()]++;
int[][] ret = solve(n, deg);
if (ret == null) {
System.out.p... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | d63e807a4402b0add15abcaf5e151c28 | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int inputs = scan.nextInt(), firstcheck = 0, secondcheck = 0, thirdcheck = 0, fourthcheck = 0;
int[] values = new int[inputs];
for ... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 63775cdbff8f9205523e3bcc8dd7851c | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int inputs = scan.nextInt(), firstcheck = 0, secondcheck = 0, thirdcheck = 0, fourthcheck = 0;
int[] values = new int[inputs];
for ... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | c1c6f7b1fc86f1096af6a5687e344bbc | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.Scanner;
/**
*
* @author afrooz
*/
public class XeniaAndDivisors {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner input=new Scanner(System.in);
int te=Integer.parseInt(in... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | c5cdc367985be224866da371c8b02d3b | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.Scanner;
public class XeniaAndDivisors {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int n, s, a=0, b=0, c=0, d=0, e=0, m1=0, m2=0, m3=0;
String g="", g1="1 2 4", g2="1 2 6", g3= "1 3 6";
n=input.nextInt();
for(int i=0; i<n;... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 8751d120510c2cbc8e070ef5d684a911 | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.*;
public class XeniaAndDivisors {
public static void main(String ar[]) {
Scanner cin = new Scanner(System.in);
int n = Integer.parseInt(cin.nextLine());
int arr[] = new int[n];
int a, b, c;
for (int i = 0; i < n; i++) {
arr[i] = cin.nextInt();
... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 3a7891f06272409f972eef9f6c368c56 | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
/**
* @author kperikov
*/
public class A implements Runnable {
PrintWriter out;
BufferedReader br;
StringTokenizer st;
public static void main(String[] args) throws IOException {
new Thread(new A()).start();
... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 3a3ce85976649a5e804ea8b0d84221fb | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
public class A199 {
void run() {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int[] integers = new int[n];
for (int i =... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | d5dd8b2e9c46d09176b6ddfb383882a5 | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.Scanner;
public class Divisors {
public static int[] prepare(){
int[] count = new int[8];
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
sc.nextLine();
String[] line = sc.nextLine().split(" ");
for (String str : line) {
int... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | cb6989d9de18e68142a10d3edc6c44f0 | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.Scanner;
public class xenia_and_div {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int[] arr=new int[10];
for(int i=0;i<n;i++)
arr[sc.nextInt()]++;
if(arr[7]>0||arr[5]>0||arr[... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | fb5af6dd991b63ad6d25439153a93c0f | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] m = new int[n];
int[] a = new int[6];
boolean flag = false;
for(int i = 0; i < n; i++) {
m[i] = in.ne... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 668bfbc6e5f39862c4de79b1a3081736 | train_001.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held: a < b < c; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.IOException;
public class Code{
BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
PrintWriter writer=new PrintWriter(System.out);
int [] readInts() throws IOExc... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 7 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 8ee383a80370d3d8f7df93d9e5fac27d | train_001.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.BigInteger;
import java.lang.*;
public class Main {
public static void main(String[] args) throws java.lang.Exception {
try{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(br.readLine());
while(t>0){
String st... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | 2aa71de849529b5aab14d8a8c85f86dc | train_001.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution {
private static final String NO = "NO";
private static final String YES = "YES";
public static BufferedWriter bw;
public static FastReader sc;
private static final int LIMIT = (int) Math.pow(10, 6);
public static void main(String[] ... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | 7de9abb515bf07bc38d13f5f25ec9132 | train_001.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.util.*;
/**
* Created by rkarumuru on 5/3/20
**/
public class Arrays {
private static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
int t = parseInt();
for (int i = 0; i < t; i++) {
printBeatyArray(nextInt(), parseInt());
}
}
private st... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | 597d7e77f90d854f4fa33c11545942ed | train_001.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.io.*;
import java.util.*;
public class cf638B {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
while(t-- > 0)
{
St... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | cf630c69aedbb22878bebaefd1d350f0 | train_001.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.util.*;
public class newFile {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while (T-- > 0) {
int n = sc.nextInt(); int k = sc.nextInt();
HashSet<Integer> set = new HashSet<Integer>();
... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | b2dd1ee27fd80ddcaf018db4a24e2169 | train_001.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 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 {
try{
int testCases = GetInput.getInt();
while (testCases-->0) {
int []ins... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | ada2604d34f84b3a3055f5fee3ae911d | train_001.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes |
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class Main {
public static void main(String[] args) throws IOException {
Reader sc = new Reader();
i... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | 32423f6f4543c9c8c12339c491e71db8 | train_001.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution{
static PrintWriter out=new PrintWriter(System.out);
public static void main (String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String[] temp=br.readLine().trim().split(" ");
int numTestCa... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | acdbc01a0c71b3d5c7d492d5047722a1 | train_001.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 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.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
public static void main(Strin... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | 0ac3142a17a91adbe704624db56c7150 | train_001.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 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.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.TreeSet;
import java.util.StringTokenizer;
public class Main
... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | a3ba26d97be5707d376d4e4f16735d32 | train_001.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.io.*;
import java.util.*;
public class A implements Runnable {
boolean judge = false;
FastReader scn;
PrintWriter out;
String INPUT = "4\r\n" + "4 2\r\n" + "1 2 2 1\r\n" + "4 3\r\n" + "1 2 2 1\r\n" + "3 2\r\n" + "1 2 3\r\n" + "4 4\r\n"
+ "4 3 4 2\r\n" + "";
void solve() {
int t = scn.nextInt();
... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | a632d59d1d327f180c2de21b073529a9 | train_001.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.lang.*;
import java.io.*;
import java.util.*;
public class PhoneixArray
{
static Scanner sc = new Scanner(System.in);
static int getInt() throws Exception {
int n = 0;
if(sc.hasNext())
n = sc.nextInt();
return n;
}
static boolean check(int T) ... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | f7bae8e0d53ea10e0cb1b351f8ceee87 | train_001.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Main{
public static void main(String[] args) throws Exception {
IO io = new IO();
PrintWriter out = new PrintWriter(System.out);
Solver sr = new Solver();
sr.solve(io,out);
out.flush();
out.close();
}
static class Solver
{
... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | e0446c60622a7038d3aab2cfa8c4e419 | train_001.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Sol4{
public static void main(String[] args) throws IOException{
FastIO sc = new FastIO(System.in);
PrintWriter out = new PrintWriter(System.out);
int t = sc.nextInt();
wh: while(t-->0) {
int n = sc.nextInt();
int k = sc.nextInt();
int arr[] = new int... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | 3d67c54f69f468599278e0559e237b73 | train_001.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | // Main Code at the Bottom
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigInteger;
public class Main {
//Fast IO class
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
boolean env=System.getProperty("ONLINE_JUD... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | a67d58fe4abb31eaab603311665a612f | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 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.io.Writer;
import java.io.OutputStreamWri... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | 0e59c805b9dd5a42db7f436a0a8a50e5 | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | import java.util.*;
public class asd
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
int t=s.nextInt();
while(t-->0)
{
int n=s.nextInt();
... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | 7dd8dcea0184451da5a1c6c1fa2eeb60 | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Random;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
i... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | 45963a75a5fbdfbddcb73e88b3b971b2 | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | import java.util.*;
public class Barrels {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
int k = sc.nextInt();
Long[] arr = new Long[n];
for (int i... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | e78d56b09145b70b5368e76150d5116d | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Barrels {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
for (int i = 0; i < t; i++) {
int n = scanner.nextInt();
in... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | df335307cac6ed61f67419efd43b1edb | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | //package com.company;
import java.util.*;
import java.util.Arrays;
//import java.lang.Math.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
int t = scan.nextInt();
for(int j=0;j<t;j++)
{
int n= scan.nextInt();
... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | c2912ec8eb94db1c46eaf33662873c91 | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | import java.util.*;
public class dd{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
int k=sc.nextInt();
Long[] arr=new Long[n];
for (int i=0;i<n ;i++ ) {
arr[i]=sc.nextLong();
}
long sum=0;
Arrays.sort... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | 9b1dc31337fcc3c162619a9a30b9ccf8 | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | import java.io.*;
import java.util.*;
public class B {
public static void main(String[] args) {
Scanner fs=new Scanner(System.in);
int T=fs.nextInt();
for (int tt=0; tt<T; tt++) {
int n=fs.nextInt(), k=fs.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++) a[i]=fs.nextInt();
long sum=0;
//Arrays... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | ccdfeb5b9349a9808f828d34f2f70aea | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | import java.util.*;
public class Solution{
public static void main(String args[])
{
Scanner take=new Scanner(System.in);
int t=take.nextInt();
int i,j;
for(int li=1;li<=t;li++)
{
int n=take.nextInt();
int k=take.nextInt();
int a[]=new int[(int)n];
for(i=0;i<n;i++) a[i]=take.nextInt();
... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | fc08352679615a7a7fe023893a034b1e | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | import java.io.*;
import java.util.*;
public class B {
public static void main(String[] args) {
Scanner fs=new Scanner(System.in);
int T=fs.nextInt();
for (int tt=0; tt<T; tt++) {
int n=fs.nextInt(), k=fs.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++) a[i]=fs.nextInt();
long sum=0;
sort(a);... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | f296674cc0180b435891016dc2c7ca0e | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public class B {
public static void main(String[] args) {
FastScanner fs=new FastScanner();
int T=fs.nextInt();
for (int tt=... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | 2662e1d9d6f35fedaa8bd0a566c30063 | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Scanner;
public class heapBarrels {
// https://codeforces.com/problemset/problem/1430/B
public static void main(String[] args) {
/*
* PriorityQueue<Integer> barrels = new
* PriorityQueue<Integer>(Collections.reverseOrder()); bar... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | 033774eb44f5a9a345bc458d006071d1 | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;
import java.io.PrintWriter;
public class bEdu96 {
static int [] dx = {1,0,-1,0}, dy = {0,1,0,-1};
public... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | 731275a30136d7ce3d86047c46bc9153 | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void solve(InputReader in, OutputWriter out) {
int n = in.readInt();
int k = in.readInt();
Integer a[] = new Integer[n];
for(int i = 0; i<n; i++)
a[i] = in.readInt();
Arrays.sort(a);
long sum = a[n-1];
for(int i = n-2; k--... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | cb99e4c9ffa981202557d66044fa3915 | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Tanzim Ibn Patowary
*/
public class Main {
public static void main(S... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | 47d4eda64ad177204e6ef97814126ea6 | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | import java.util.*;
public class p1430B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
for (int t = sc.nextInt(); t-- > 0;) {
Integer n = sc.nextInt(), k = sc.nextInt(), a[] = new Integer[n];
for (int i = 0; i < n; i++) a[i] = sc.nextInt();
Arrays.sort(a);
long sum = a[... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | 6a8c5687d6c70bd92154843cf312bd94 | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | // package Education96;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.*;
public class typeB {
public static void main(String[] args) {
FastReader s = new FastReader();
PrintWriter out = ne... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | 65d26f3af2f3e5e3c4cdec1b7328849a | train_001.jsonl | 1602407100 | You have $$$n$$$ barrels lined up in a row, numbered from left to right from one. Initially, the $$$i$$$-th barrel contains $$$a_i$$$ liters of water.You can pour water from one barrel to another. In one act of pouring, you can choose two different barrels $$$x$$$ and $$$y$$$ (the $$$x$$$-th barrel shouldn't be empty) ... | 256 megabytes | import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
public class B {
public static void main(String[] args) {
FastScanner scan = new FastScanner();
int t = scan.n... | Java | ["2\n4 1\n5 5 5 5\n3 2\n0 0 0"] | 2 seconds | ["10\n0"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | 08c797a7972fae99f8b64b47c53d8aeb | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k < n \le 2 \cdot 10^5$$$) — the number of barrels and the number of pourings you can make. The second line contains $$$n$$$ integers $... | 800 | For each test case, print the maximum possible difference between the maximum and the minimum amount of water in the barrels, if you can pour water at most $$$k$$$ times. | standard output | |
PASSED | b5b49367ce33fc3e8dfc55bf387a4d8b | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class GenericProblem
{
/*
* This FastReader code is taken from GeeksForGeeks.com
* https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
*
* The article was written by Rishabh Mahrsee
*/
public static class F... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 8 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 6ff2970bfca01dbce7aeaea212d3f9c0 | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int n = sc.nextInt();
long[] a = new long[n];
... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 8 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 6626d68512bc646226c0f1534a6450c8 | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | import java.util.Scanner;
public class Mafia {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int[] arr=new int[n];
long m=0,sum=0, res=0;
for(int i=0;i<n;i++){
arr[i]=sc.nextInt();
sum+=arr[i];
m... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | db7d2a9606555822f89cc24f8cd0eba6 | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
int n = Integer.parseInt(br.readLine());
... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | fdaa337dc3d3bf7da286cce2106d4959 | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
/*
br = new BufferedReader(new FileReader("input.txt"));
pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
br = new BufferedReader(new InputStreamRead... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 360be9052fc4a58447ccb62a611d6fe5 | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class A {
BufferedReader reader;
StringTokenizer tokenizer;
PrintWriter out;
public void solve() throws IOException {
int N = nextInt();
long[] A ... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | b06921b08fbaa245cade8a9b84a3396c | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
reader.readLine();
String[] nums = re... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | e5c2423f62a646cef606dd0ed99a0702 | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | import java.io.*;
import java.util.*;
public class A implements Runnable {
private void solve() throws IOException {
int n = nextInt();
long[] a = new long[n];
long sum = 0, max = 0;
for (int i = 0; i < n; i++) {
a[i] = nextLong();
max = Math.max(max, a[i]);
sum += a[i];
}
print(Math.max((sum + ... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | e1ae38d24b1298d6b890e1c39067b10d | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | import java.util.*;
import java.io.*;
public class a {
static long mod = 1000000007;
public static void main(String[] args) throws IOException {
// Scanner input = new Scanner(new File("input.txt"));
// PrintWriter out = new PrintWriter(new File("output.txt"));
input.init(System.in);
... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | c5a79bc2f0ddc1e12877f754603fe472 | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class MafiaCF {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
solve();
}
public static void solve(){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] mas = new int[... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 8fd995d219a14be13c2d04900c651ec8 | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | import java.util.*;
import java.io.*;
public class A {
public static void main(String[] args) throws IOException {
BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
long n = Integer.parseInt(rd.readLine());
StringTokenizer st = new StringTokenizer(rd.readLine());
long s = 0, max = 0;
... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | fa5d3509aaf25534e95ef952b63af448 | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import static java.lang.Math.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
/**
*
* @author pttrung
*/
public class C {
public static long Mod = 1000000007;
public static double Epsilon = 1e-5;
... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 62f695e1041133ae3d0612537f3118f1 | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | //package round202;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class A {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni();
int... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 95ea1217bc9cb46b3eacc4aa6ce7ba19 | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | import java.util.*;
import java.io.*;
public class first
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
long sum=0;
long max=0;
for(int i=0;i<n;i++)
{
long k = sc.nextLong();
if(k>max)max=k;
sum+=k;
}
long result=sum/(n-1);
if(sum%(n-... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 2f345f93016d88b61788e2ace1c07014 | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | import java.util.*;
import java.util.Map.Entry;
import java.io.*;
import java.awt.Point;
import java.math.BigInteger;
import static java.lang.Math.*;
public class Codeforces_Solution_A implements Runnable{
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader in;
... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 7cd5e89f3c7c1781d11215f042319422 | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | import java.util.*;
public class Mafia348A
{
public static void main(String[] args)
{
// Set up scanner
Scanner sc = new Scanner(System.in);
// System.out.println("Enter n");
long n = sc.nextLong();
long maximum = 0;
long sum = 0;
for (int i=0;... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 0604efe25cbad1f4e9b11ca6ee9b6528 | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Mafia {
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String numberSpace = br.readLine();
String integers = br.readLine();
int numInts = Integer... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 7d9ff31ff12ad24e88385f42aea2fbfe | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | import java.util.Scanner;
public class Mafia {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
long num = 0;
long num2 = 0;
long max = 0;
for(int i=0;i<n; i++) {
num2 = sc.nextInt();
if(num2 > max) max = num2;
num += num2;
}
if((num / (n-1) + 1) ... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | d297f4f697b3179ab372d7003e8df420 | train_001.jsonl | 1380295800 | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class round202A {
public static boolean can(long rounds, int [] wants){
long spect = 0;
for(int i = 0 ; i < wants.length ; ++i){
if(wants[i] > rounds)
... | Java | ["3\n3 2 2", "4\n2 2 2 2"] | 2 seconds | ["4", "3"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | Java 6 | standard input | [
"binary search",
"sortings",
"math"
] | 09f5623c3717c9d360334500b198d8e0 | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | 1,600 | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | c583ffa99427a2538a28016ab1a51c2d | train_001.jsonl | 1576401300 | There are $$$n$$$ blocks arranged in a row and numbered from left to right, starting from one. Each block is either black or white. You may perform the following operation zero or more times: choose two adjacent blocks and invert their colors (white block becomes black, and vice versa). You want to find a sequence of o... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static class Scan {
private byte[] buf=new byte[1024];
private int index;
private InputStream in;
private int total;
public Scan()
{
in=System.in;
}
public int scan()throws IOExcepti... | Java | ["8\nBWWWWWWB", "4\nBWBB", "5\nWWWWW", "3\nBWB"] | 2 seconds | ["3\n6 2 4", "-1", "0", "2\n2 1"] | NoteIn the first example, it is possible to make all blocks black in $$$3$$$ operations. Start with changing blocks $$$6$$$ and $$$7$$$, so the sequence is "BWWWWBBB". Then change blocks $$$2$$$ and $$$3$$$, so the sequence is "BBBWWBB". And finally, change blocks $$$4$$$ and $$$5$$$, so all blocks are black.It is impo... | Java 11 | standard input | [
"greedy",
"math"
] | 3336662e6362693b8ac9455d4c2fe158 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 200$$$) — the number of blocks. The second line contains one string $$$s$$$ consisting of $$$n$$$ characters, each character is either "W" or "B". If the $$$i$$$-th character is "W", then the $$$i$$$-th block is white. If the $$$i$$$-th character is "B", then ... | 1,300 | If it is impossible to make all the blocks having the same color, print $$$-1$$$. Otherwise, print an integer $$$k$$$ ($$$0 \le k \le 3 \cdot n$$$) — the number of operations. Then print $$$k$$$ integers $$$p_1, p_2, \dots, p_k$$$ $$$(1 \le p_j \le n - 1)$$$, where $$$p_j$$$ is the position of the left block in the pai... | standard output | |
PASSED | 5e3145234937712c2f4379e47294ade8 | train_001.jsonl | 1576401300 | There are $$$n$$$ blocks arranged in a row and numbered from left to right, starting from one. Each block is either black or white. You may perform the following operation zero or more times: choose two adjacent blocks and invert their colors (white block becomes black, and vice versa). You want to find a sequence of o... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
static int mod = (int)(Math.pow(10, 9) + 7);
public static void main(String[] args) {
MyScanner sc = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
int n =sc.nextInt();
String s= sc.next();
... | Java | ["8\nBWWWWWWB", "4\nBWBB", "5\nWWWWW", "3\nBWB"] | 2 seconds | ["3\n6 2 4", "-1", "0", "2\n2 1"] | NoteIn the first example, it is possible to make all blocks black in $$$3$$$ operations. Start with changing blocks $$$6$$$ and $$$7$$$, so the sequence is "BWWWWBBB". Then change blocks $$$2$$$ and $$$3$$$, so the sequence is "BBBWWBB". And finally, change blocks $$$4$$$ and $$$5$$$, so all blocks are black.It is impo... | Java 11 | standard input | [
"greedy",
"math"
] | 3336662e6362693b8ac9455d4c2fe158 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 200$$$) — the number of blocks. The second line contains one string $$$s$$$ consisting of $$$n$$$ characters, each character is either "W" or "B". If the $$$i$$$-th character is "W", then the $$$i$$$-th block is white. If the $$$i$$$-th character is "B", then ... | 1,300 | If it is impossible to make all the blocks having the same color, print $$$-1$$$. Otherwise, print an integer $$$k$$$ ($$$0 \le k \le 3 \cdot n$$$) — the number of operations. Then print $$$k$$$ integers $$$p_1, p_2, \dots, p_k$$$ $$$(1 \le p_j \le n - 1)$$$, where $$$p_j$$$ is the position of the left block in the pai... | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.