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 | 5485e6782da37da8f22191e6fa7da85a | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.pa... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 0c7d8d987d097208a5ed69be4243325b | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.*;
public class cf135a {
public static void main(String[] args) {
FastScanner in = new FastScanner(System.in)... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 97ea2668baacc573f8ab7ae6f4db31af | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class solver {
FastScanner in = new FastScanner(System.in);
PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
new solver().solve();
}
int thr (int first,... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 200099c9646effcf765c70f445acc7ed | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Replacemente {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(bf.readLi... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 4b665d481c79a50c16ec8ad61f67f4d2 | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Replacement {
void run() throws Exception {
BufferedReader bfd = new BufferedReader(
new InputStreamReader(System.in));
int n = Integer.par... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 394a7190af0d3ecb138b4dd61a931365 | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Replacement {
void run() throws Exception {
BufferedReader bfd = new BufferedReader(
new InputStreamReader(System.in));
int n = Integer.parseInt... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | acdd0dba9ef2ea28df771960a344b52b | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class C {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
boolean flag = true;
List<Integer> list = new A... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 19b63b1160a769af620eebf9ad873682 | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
//BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
Scanner in=new Scanner(new InputStreamReader(System.in));
PrintWriter out=new PrintWriter(System.out);
int n=in... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | d6c4d4d3119fcfc6805dc28f422f2401 | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | //package c;
import java.util.*;
import java.io.*;
public class Main {
BufferedReader in;
StringTokenizer str = null;
private int nextInt() throws Exception{
if (str == null || !str.hasMoreElements())
str = new StringTokenizer(in.readLine());
return Integer.parseInt(str.nextToken());
}
private void ru... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 99c852754a054638475258d90d9403ba | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
public class Replacement {
/**
* @param args
* @throws IOException
* @throws NumberFormatException
*/
public static void main(String[] args) throws NumberFormatE... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 47c3203f61ad4f98bbfebb39f77ee5e8 | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.*;
public class C
{
BufferedReader in;
PrintStream out;
StringTokenizer tok;
public C() throws NumberFormatException, IOException
{
in = new Buffe... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | fac7161224b4426f3e5e5851f6a0cdea | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 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.Arrays;
public class ProblemC implements Runnable{
public void solve() throws IOException{
int n=intArr()[0];
... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | c052a90dfe14809d4fec90e1dd5b592f | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Arrays;
public class C {
static StreamTokenizer st;
public static voi... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 5ba97a1fb3c32b647f1beb4796130ae2 | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.io.BufferedInputStream;
import java.util.Arrays;
import static java.lang.Math.*;
public class C136C {
public void solve() throws Exception {
int n = nextInt();
int[] arr = new int[n];
for (int i = 0; i < arr.length; i++) {
arr[i] = nextInt();
}
Arrays.sort(arr);
if (arr[arr.length - 1] == ... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | a08695560b246dd6d5cfce042fbcb615 | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new Exchange().solve();
}
}
class Exchange {
public void solve() {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(Syst... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | e3cd0ae5ba6a5242200f8077a49d4b41 | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 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 C implements Runnable {
private void Solution() throws IOException {
int n = nextInt(), max = 0, maxi = 0;
ArrayLis... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 05c655c30e2f58fa38d0943180893023 | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes |
//package codeforces;
/**
*
* @author Siddharth
*/
import java.io.*;
public class MergeSortArray {
private long[] theArray;
private int nElems;
public MergeSortArray(int max) {
theArray = new long[max];
nElems = 0;
}
public void insert(long value) {
theArray[nElems] = value; // insert... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | d4bb2befc24535ba6ba34b276e8107f9 | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class CF136C {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] ls = new int[n];
int max = 0;
for (int i = 0; i < n; i++) {
ls[i] = sc.nextInt();
... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 6539b83acd38c63fc87de8485c74acc9 | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Substitution implements Runnable {
private BufferedReader reader;
private StringTokenizer tokenizer;
private Prin... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | a0fc80d678ae608e208080348627900f | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class C {
public static void main(String... args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
sc.nextLine();
int[] x = new int[n];
int max=0, pos=-1;
for(int i=0; i<n; i++)... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | bf210fdab412f14905492167192ff25c | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Rou97_C {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
long []a = new long[n];
long max = -1;
int ind = -1;
for(int i =0 ;i < n;i++)
{
... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 534098a94ba4b30876e8649aa5f0adbd | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
//package codeforces;
import java.util.Scanner;
/**
*
* @author DELL
*/
public class Replacement {
public static void Merge(int A[], int p, int q, int r) {
// System.out.println("\nin merge " + p + " "... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 6b481d70d021d40be401d0f58c85cec4 | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.io.BufferedInputStream;
import java.util.Arrays;
import java.util.Scanner;
public class Replacement { //Round #97 - Replacement
public static void main(String[] args) {
Scanner sc = new Scanner(new BufferedInputStream(System.in));
int arrayLen = sc.nextInt();
int[] numbers = new int[arrayLen];
... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 4e92e63fb16ded88c0d447f5010a534e | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Test {
static BufferedReader reader;
static StringTokenizer tokenizer;
static PrintWriter writer;
static int nextInt() th... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 0db9cb386c399e45c625f96f19579359 | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
public class C {
private void solve() throws IOException {
int n = nextInt();
int[] a = new int[n];
for (int i = 0; i <... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 352c9f6298575ecb33d80f6ea47a47f8 | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | //package beta97;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class C
{
public static BufferedReader br;
public static StringTokenizer inp;
public static PrintWriter out;
p... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | 6f0231551c66cb1f8f90081ad7eeac6a | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class three {
public static void main(String[] args) throws NumberFormatException,
IOException {
BufferedReader buf = new BufferedReader(
new InputStream... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | e884e2337be07328bd94e929b65b20e0 | train_001.jsonl | 1323443100 | Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als... | 256 megabytes | import java.util.*;
import java.io.*;
public class C97C{
static BufferedReader br;
public static void main(String args[])throws Exception{
br=new BufferedReader(new InputStreamReader(System.in));
long n=toLong();
long num[]=toLongArray();
if(n==1){
if(num[0]>1)
... | Java | ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"] | 2 seconds | ["1 1 2 3 4", "1 2 3 4 5", "1 2 2"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"greedy"
] | 1cd10f01347d869be38c08ad64266870 | The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive. | 1,300 | Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed. | standard output | |
PASSED | e46ffd3809c94850a74da184cb8029a6 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.util.spi.AbstractResourceBundleProvider;
public class Main {
public static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader(String s) {
try {
br = new BufferedReader(new FileReader(s... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | 29f4bf03511c82a602adf70836567193 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class StringDeletion {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | b19a701aeff67c2ca28aef4a46a57c5b | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class StringDeletion {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | e74020b15152f951989114534b3ddb55 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class StringDeletion {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb ... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | 4c50f230138f3081dae057d19295951e | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static void solve() {
int t = ni();
for(int i=0;i<t;i++)testCase();
}
static void testCase() {
int n = ni();
var s = ns(n);
var ls = new ArrayList<Integer>();
int cnt = 1;
var q = new ArrayDeque<Integer>();
for(int i=0;i<n-1;i++) {
i... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | a81d8e35f270d3545bbb5a4fb4e13685 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve(int TC) throws Exception {
int n = ni();
char[] s = ns(n);
int one=0,zero=0;
ArrayList<Integer> al = new ArrayList<>();
for(int i=0;i<n;i... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | 9deddf412f5e2d0c68b98089a9db513d | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.util.*;
import java.io.*;
public class _1430_D {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
int t = Integer.parseInt(in.readLine());
for(int i = 0; i < t; i++) {
... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | ad5a6b154633e2ecd05ed99ef8ab618e | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
public class Main implements Runnable
{
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | 96a801042cacd3e0c894bc82dbfba1e4 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | // practice with kaiboy
import java.io.*;
import java.util.*;
public class CF1430D extends PrintWriter {
CF1430D() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1430D o = new CF1430D(); o.main(); o.flush();
}
void main() {
int t = sc.nextInt();
while (t... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | 5b34b474ec761ff78459ee257d9e5d89 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class A4_1 {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int test = scan.nextInt();
for (int o = 0; o < test; o ++) {
int a = scan.nextInt();
String t = scan.next();
... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | 11fe2bc15adf695c3fcc6f43a2a828b9 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.io.*;
import java.util.*;
public class ques5
{
public static void main(String[] args)throws Exception{ new ques5().run();}
long mod=1000000000+7;
void solve() throws Exception
{
for(int ii=ni();ii>0;ii--)
{
int n=ni();
String s=ns(); s=s+"x";
ArrayList<Integer> al = new ArrayList<>();
... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | eb565ca2e51432dcf7f8471a964eb64b | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class CP{
public static OutputStream out=new BufferedOutputStream(System.out);
static Scanner sc=new Scanner(System.in);
static long MOD=998244353l;
static int INF=10000000;
static long[] fact;
static long[] inv_fact;
static int[] rr=n... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | ebc310146fdfa60856c8a56e7bdc4e9c | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.util.*;
import java.io.*;
public class D{
static class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
private SpaceCharFilter filter;
public InputReader(InputStream stream) {
... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | d0b4d27f4182aa187466dd7f9e7c25d6 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.util.*;
// 111111
public class Main{
static Scanner sc = new Scanner(System.in);
static int mod = 1_000_000_007;
public static void main(String[] args){
int i = sc.nextInt();
for (int i1 = 0; i1 < i; i1++)
solve();
}
private static void solve() {
int n ... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | 1bdfd8585d73e75fe701f0f33f82ac46 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
private static PrintWriter pw = new PrintWriter(System.out);
private static InputReader sc = new InputReader();
static class InputReader{
private static BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
pr... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | 1a94848962b39f93a014d2d3ed3d6260 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | /**
* @author vivek
* programming is thinking, not typing
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class D {
private static void solveTC(int __) {
/* For Google */
// ans.append("Case #").append(__).append(": ");
... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | 7a56c0660b59df339505d87335d50b87 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class cf1430d {
public static void main(String[] args) throws IOException {
int t = ri();
while (t --> 0) {
int n = ri(), del_ind = 0, cur = 0, ans = 0;
char[] s ... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | 0897c616252006fd82844f54175c9785 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.util.*;
import java.math.*;
public class Solution {
final static int MOD = 1000000007;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = Integer.parseInt(in.next());
for(int tt = 0; tt < t; tt++) {
int n = Integer.parseInt(in.next());
String ss = in.next();
... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | d68242b477d927a156b4158ff0026d9b | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
public static void main (String[] args) throws java.lang.Exception
{
// Scanner sc=new Scanner(System.in);
FastReader sc=new FastReader();
Writer w=new PrintWriter(System.out);
int t=sc.nextInt();
while(t-->0){
int n=sc.n... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | d7ce3e06aed04ea4f8f48cfd35678333 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class D {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | 736698ef4c088f078e1dae834898903f | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
import java.util.List;
import java.util.ArrayList;
public class Main {
public static void main(final String[] args) {
// FastScanner sc = new FastScanner("in.txt");
// PrintWriter out;
// try {
// out = new PrintWriter("out.tx... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | 7d71ba4494c3b8f674ba25001b8748d3 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.io.*;
import java.util.*;
public class TEST
{
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
private DataInputStream din;
private byte[] buffer;
private int buffe... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | cc0a253b7932655f88852786f39a3943 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int t=s.nextInt();
while(t-->0)
{
int n=s.nextInt();
String str=s.next();
ArrayList<Integer> list=new ArrayList<>();
for(int i=0;i<n;){
char c=str.charAt(i);
... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | 11d45c35ad4c673e831b73e995d61fc6 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | //package edu96;
import java.io.*;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
// What's the smallest input?
// Check * for int/long overflow.
// Check / for accidental rounding.
// Are you using doubles? Can you avoid it?
// Never compare after taking mod.
// Mod the f... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | 92a8c881f8cdb2b4a78e21e4b10cf3ca | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.Closeable;
import java.io.DataInputStream;
import java.io.Flushable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Tre... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | bace33d0641eb15fd8092e17dc2b9a98 | train_001.jsonl | 1602407100 | You have a string $$$s$$$ consisting of $$$n$$$ characters. Each character is either 0 or 1.You can perform operations on the string. Each operation consists of two steps: select an integer $$$i$$$ from $$$1$$$ to the length of the string $$$s$$$, then delete the character $$$s_i$$$ (the string length gets reduced by ... | 256 megabytes | import java.util.*;
import java.util.Scanner;
import java.util.Arrays;
import java.util.Set;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
int t;
int n;
String s;
long a[] = new long[200005];
t=cin.nextInt();
while((t--) > 0) {
n = cin.nextInt();
... | Java | ["5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010"] | 2 seconds | ["3\n1\n1\n1\n3"] | NoteIn the first test case, you can, for example, select $$$i = 2$$$ and get string 010 after the first operation. After that, you can select $$$i = 3$$$ and get string 1. Finally, you can only select $$$i = 1$$$ and get empty string. | Java 11 | standard input | [
"data structures",
"two pointers",
"binary search",
"greedy"
] | d0030996e6b29c8580463fae43bb04d4 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains string $$$s$$$ of $$$n$$$ characters. Each character is e... | 1,700 | For each test case, print a single integer — the maximum number of operations you can perform. | standard output | |
PASSED | 3cbe0c26f429065747fff60823d0127a | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | //package Test;
import java.util.*;
public class A {
static class Solution {
void solve(int[] A, List<Integer> newA, List<Integer> fixPos){
if(fixPos.size() == A.length) {
for(int i = 0; i < A.length; i++) {
System.out.print(A[i] + " ");
}
... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | cf033ed40a1e25899efbe416e1aa991f | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int tc = 0; tc < t; ++tc) {... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | 1d388e964ba9d016a3dae7edb0fe6a47 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.util.*;
public class b {
static Scanner in = new Scanner(System.in);
public static void main(String[] args) {
int t = in.nextInt();
while(t-- > 0) {
int n = in.nextInt();
int[] tab = new int[n];
int[] l = new int[n];
for(int i = 0; i < n; i++) tab[i] = in.nextInt();
fo... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | d16fcad25af4a8bf992eda066ad86111 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | 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 t = ni();
while(t-->0)
{
int n = ni();
int a[] = new int[n];
... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | 1525950bf25b8a3d7bcd5f6935718a26 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
public class c1 {
public static FScanner scan;
public static PrintWriter out;
public static void main(String[] args) {
scan=new FScanner();
out=new PrintWriter(new BufferedOutputStream(System.out));
// int t=1;
int t=... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | da173a52d48b46ba89a7c7d14944179b | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.List;
import java.util.*;
public class realfast implements Runnable
{
private static final int INF = (int) 1e9;
long in= 998244353;
long fac[]= new long[3000];
public void solv... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | 53aedf3b3568a5586539fcf10a8a554b | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.Math;
public class Main{
static BufferedReader reader;
static StringTokenizer tokenizer;
static PrintWriter writer;
static int nextInt() throws IOException {
return Integer.parseInt(nextToken());
}
static long nextLong() throws IOException {
return Lon... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | 50c085733317ece4d63ca1f59a48db71 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | /*package whatever //do not write package name here */
import java.util.*;
public class a{
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t--!=0){
int n = sc.nextInt(),i=0,j=0;
int a[] = new int[n], l[] = new int[n];
List<Integer> li... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | f4162e29e2285678e0120f427b5147f1 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Euler {
public static void main(String[] args){
FastReader in = new FastReader();
PrintWriter o = new PrintWriter(System.out);
int t = in.nextInt();
while (t-- > 0) {
int n = in.nextInt();
int[... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | e89e2c2d1887b0e83c79fe536a17f71f | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Collecti... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | 4a2f69ebed1934a21cd6c286e950a1d3 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | //package com.company;
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int tc = sc.nextInt();
while (tc-->0)
{
int n;
n = sc.nextInt();
int[] arr = new int[100005], tp = new int[10005], state = new int[100005];
for (int i=0; i<n; ... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | 185983d26906ae62a6645d13ff8fc9d9 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | //package com.company;
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int tc = sc.nextInt();
while (tc-->0)
{
int n;
n = sc.nextInt();
int[] arr = new int[100005], tp = new int[10005], state = new int[100005];
for (int i=0; i<n; ... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | ee375262df524b4cb43b6f0e2a0ae887 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
public class Main {
final static long MOD = 1000000007;
public static void main(String[] args) {
FastScanner fs = new FastScanner();
PrintWriter out = ... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | dd37c9683a7277042f0fcac4815f167a | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;
import java.util.Arrays;
import java.util.Comparator;
public class Main
{
... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | b243f78af60488612766df7d9854cbb8 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
public static void main(String[] args) {
// Scanner sc = new Scanner(System.in);
FastScanner sc = new FastScanner();
PrintWriter out... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | cc711dc587bd2f9f70f05fb6d0091174 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
public static void main(String[] args) {
// Scanner sc = new Scanner(System.in);
FastScanner sc = new FastScanner();
PrintWriter out... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | bffbbbab7b41095fae195e4011116482 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.util.*;
public class Solution
{
public static void main(String []args)
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0)
{
int n = sc.nextInt();
int arr[] = new int[n];
lon... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | 0d562ec881f5d48c82652512bae748c6 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes |
import javafx.print.Collation;
import java.io.*;
import java.math.BigInteger;
import java.text.CollationElementIterator;
import java.util.*;
import java.lang.*;
import java.util.Comparator;
public class ai {
InputStream is;
PrintWriter out;
long mod = (long)(1e9 + 7), inf = (long)(3e18);
int cnt[];
... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | 638602e72cb285e996c0fd98bcf43230 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
public class Code {
public static void main(String[] args) throws java.lang.Exception{
// TODO Auto-generated method stub
Reader sc=new Reader();
PrintWriter out=new PrintWriter(System.out);
int t=sc.nextInt();
... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | 25ad0a69c3dc38cabb4afda6d589b116 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes |
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import javafx.util.Pair;
import java.util.ArrayList;
public class CodeForce {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static StringBuilder sb = new StringBuilder();
stat... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | e76b1e68c931a2ea8622c18d54f27539 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static PrintWriter pw;
static Scanner sc;
static ArrayList<Integer>[] adj;
static boolean[] visit;
static int[][][] dp;
static long ceildiv(long x, long y) { return (x+y-1)/y; }
static int mod(long x, int m) { return (int)((x%m+m)%m)... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | 90b221f480d881166add5b95f2d0f60c | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes |
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
public class Solution {
static long[][] dp;
static long maxval(int[] a,int len,boolean sta) {
if(len==a.length) return 0;
int lans=a[len];
int ind =0... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | b4f34bccb8a15502d42a2c2be42dfbf3 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
// BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int t=1;
t=sc.nextInt();
// int t=... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | 5f91b9c5be929371f67c57c84521805d | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | //package codeforces;
import java.io.IOException;
import java.util.*;
import java.util.InputMismatchException;
/**
* @author muhossain
* @since 2020-10-01
*/
public class B1418 {
public static void main(String[] args) {
FasterScanner fs = new FasterScanner();
int T = fs.nextInt();
... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | 83b1fdce9b1b6124bc4bf62781485409 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.u... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | f4e0a3d528d923328863c0924ab4668a | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 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;
public class NegativePrefix {
public static void main(String[] args) throws Exception {
BufferedReader sc = new BufferedReader(new InputStr... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | e32da142fcac03e57548826c8094841f | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
public class NegativePrefix {
public static void main(String[] args) throws Exception {
BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
int test,size;
String lin... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | 10787db0084c678d6bc66e0398d955d9 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int t = sc.nextInt();
while (t-- > 0) {
int n=sc.nextInt();
int a[]=sc.intArr(n);
int b[]=sc.intArr(n);
... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | 26fc67886f6bfbb9e98651ff60992fe7 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main
{
public static void main(String[] args) {
new Thread(null, new Runnable() {
public void run() {
FastReader fr =new FastReader(); PrintWriter op =new ... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | 9cfd11eefd0c9a4845d6a7f99b5fcbb9 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes | import java.io.PrintWriter;
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int t = Integer.parseInt(in.nextLine());
for(int a = 0; a < t; a++)
... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | 14ab1589578a25fd07710130158b2595 | train_001.jsonl | 1600094100 | You are given an array $$$a$$$, consisting of $$$n$$$ integers.Each position $$$i$$$ ($$$1 \le i \le n$$$) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them back into the unlocked positions. You are not allowed to remove any values, ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class C {
public static void main(String[] args) throws IOException{
try {
FastScanner fs = new FastScanner();
int t = fs.nextInt();
while(t-->0)
{
int n =fs.nextInt();
int... | Java | ["5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1"] | 2 seconds | ["1 2 3\n2 -3 4 -1\n-8 -6 1 4 4 7 -2\n-4 0 1 6 3\n-1 4 7 -8 10 -1"] | NoteIn the first testcase you can rearrange all values however you want but any arrangement will result in $$$k = 0$$$. For example, for an arrangement $$$[1, 2, 3]$$$, $$$p=[1, 3, 6]$$$, so there are no $$$j$$$ such that $$$p_j < 0$$$. Thus, $$$k = 0$$$.In the second testcase you are not allowed to rearrange any el... | Java 8 | standard input | [
"sortings",
"greedy"
] | 9ef180b33717e4d6a21b4c5bb855e15b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then $$$t$$$ testcases follow. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array $$$a$$$. The second line of each testcase contains $$$n$$$ i... | 1,300 | Print $$$n$$$ integers — the array $$$a$$$ after the rearrangement. Value $$$k$$$ (the maximum $$$j$$$ such that $$$p_j < 0$$$ (or $$$0$$$ if there are no such $$$j$$$)) should be minimum possible. For each locked position the printed value should be equal to the initial one. The values on the unlocked positions sho... | standard output | |
PASSED | fba88da5fc57d4d1f0bc7edabb126ae4 | train_001.jsonl | 1593610500 | A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In... | 256 megabytes | import java.util.*;
import java.io.*;
public class ZeroRem {
public static void main(String[] args) throws IOException {
Scanner scn=new Scanner(System.in);
int t = scn.nextInt();
while(t-->0){
int n = scn.nextInt(),k = scn.nextInt();
int arr[][] = new int[n][n];
for(int i=0;i<n;i++... | Java | ["4\n2 2\n3 8\n1 0\n4 16"] | 1 second | ["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"] | NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 0f18382d450be90edf1fd1a3770b232b | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g... | 1,600 | For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin... | standard output | |
PASSED | 02996182591c52542e7462f80929b79f | train_001.jsonl | 1593610500 | A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In... | 256 megabytes | import java.io.*;
import java.util.*;
public class CP {
static long startTime;
static long endTime;
static Boolean [] prime ;
static Scanner sc = new Scanner(System.in);
static class FastReader{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
... | Java | ["4\n2 2\n3 8\n1 0\n4 16"] | 1 second | ["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"] | NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 0f18382d450be90edf1fd1a3770b232b | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g... | 1,600 | For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin... | standard output | |
PASSED | 96e656c337e7d4398134057b731a7eeb | train_001.jsonl | 1593610500 | A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
private static void solver(InputReader sc, PrintWriter out) throws Exception {
int test = sc.nextInt();
for (int ii = 0; ii < test; ii++) {
int n = sc.nextInt();
int k = sc.nextInt();
int arr[][] = new in... | Java | ["4\n2 2\n3 8\n1 0\n4 16"] | 1 second | ["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"] | NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 0f18382d450be90edf1fd1a3770b232b | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g... | 1,600 | For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin... | standard output | |
PASSED | 9759d15ffc6d5ea591bcfb1d2ab87932 | train_001.jsonl | 1593610500 | A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
private static void solver(InputReader sc, PrintWriter out) throws Exception {
int test = sc.nextInt();
for (int ii = 0; ii < test; ii++) {
int n = sc.nextInt();
int k = sc.nextInt();
int arr[][] = new in... | Java | ["4\n2 2\n3 8\n1 0\n4 16"] | 1 second | ["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"] | NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 0f18382d450be90edf1fd1a3770b232b | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g... | 1,600 | For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin... | standard output | |
PASSED | fda8d7ea9cc906be88a28501ceab8829 | train_001.jsonl | 1593610500 | A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
public class file
{
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
static INPUT sc = new INPUT(br);
static int INF ... | Java | ["4\n2 2\n3 8\n1 0\n4 16"] | 1 second | ["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"] | NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 0f18382d450be90edf1fd1a3770b232b | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g... | 1,600 | For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin... | standard output | |
PASSED | 7e041e80458088a89f1853e1e552b14a | train_001.jsonl | 1593610500 | A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
Writer w=new PrintWriter(System.out);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();int k=sc.nextInt();
int[... | Java | ["4\n2 2\n3 8\n1 0\n4 16"] | 1 second | ["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"] | NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 0f18382d450be90edf1fd1a3770b232b | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g... | 1,600 | For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin... | standard output | |
PASSED | 46b285234c579beedc0b0a34f1cb1c30 | train_001.jsonl | 1593610500 | A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In... | 256 megabytes |
import java.util.*;
import java.lang.*;
public class untitled1 {
public static void main (String[] args) {
Scanner s=new Scanner(System.in);
int t=s.nextInt();
for(int i=0;i<t;i++)
{
int n=s.nextInt();
int k=s.nextInt();
int[][] arr=new int[n][n];
int [] col=new int[n];
int [] row=new int[n];
i... | Java | ["4\n2 2\n3 8\n1 0\n4 16"] | 1 second | ["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"] | NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 0f18382d450be90edf1fd1a3770b232b | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g... | 1,600 | For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin... | standard output | |
PASSED | 3a873118f8170ac986dc5d34a22e0150 | train_001.jsonl | 1593610500 | A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.StringTokenizer;
public class Pd{
public static void main(String[] args) throws IOException{
FastReader sc =... | Java | ["4\n2 2\n3 8\n1 0\n4 16"] | 1 second | ["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"] | NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 0f18382d450be90edf1fd1a3770b232b | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g... | 1,600 | For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin... | standard output | |
PASSED | d942ad0192fb23e6ee6cea893bd9de1e | train_001.jsonl | 1593610500 | A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In... | 256 megabytes | import java.util.Scanner ;
import java.util.ArrayList ;
import java.util.Collections ;
public class firstjava
{
public static void main( String[ ] args )
{
Scanner in = new Scanner( System.in ) ;
int t = 1 ;
t = in.nextInt( ) ;
while( t -- != 0 )
{
long n = in.nextLong( ) ;
long k = in.nextLong( ) ;
... | Java | ["4\n2 2\n3 8\n1 0\n4 16"] | 1 second | ["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"] | NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 0f18382d450be90edf1fd1a3770b232b | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g... | 1,600 | For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin... | standard output | |
PASSED | 0837bf0788655f4d6152cd05b1545ff1 | train_001.jsonl | 1593610500 | A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Bui... | Java | ["4\n2 2\n3 8\n1 0\n4 16"] | 1 second | ["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"] | NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 0f18382d450be90edf1fd1a3770b232b | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g... | 1,600 | For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin... | standard output | |
PASSED | 0d095413223fdace107ac845e26a3e8a | train_001.jsonl | 1593610500 | A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class hello2
{static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
... | Java | ["4\n2 2\n3 8\n1 0\n4 16"] | 1 second | ["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"] | NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 0f18382d450be90edf1fd1a3770b232b | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g... | 1,600 | For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin... | standard output | |
PASSED | ca290c17b38670bbe13cc143d8de0edb | train_001.jsonl | 1593610500 | A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args) {
InputReader in=new InputReader(System.in);
PrintWriter out=new PrintWriter(System.out);
///v!=c first type
///v==c second type
///m<=min
///n<=max
int t=in.nextInt();
while(t-->0) {
int... | Java | ["4\n2 2\n3 8\n1 0\n4 16"] | 1 second | ["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"] | NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 0f18382d450be90edf1fd1a3770b232b | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g... | 1,600 | For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin... | standard output | |
PASSED | 438a7049d773178c93036125d6a26e05 | train_001.jsonl | 1593610500 | A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In... | 256 megabytes | // 1 0
// 1 1
// 2 0
// 2 1
// 2 2
// 2 3
// 2 4
// 3 0
// 3 1
// 3 2
// 3 3
// 3 4
// 3 5
// 3 6
// 3 7
// 3 8
// 3 9
// 4 0
// 4 1
// 4 2
// 4 3
// 4 4
// 4 5
// 4 6
// 4 7
// 4 8
// 4 9
// 4 10
// 4 11
// 4 12
// 4 13
// 4 14
// 4 15
// 4 16
// 5 0
// 5 1
// 5 2
// 5 3
// 5 4
/... | Java | ["4\n2 2\n3 8\n1 0\n4 16"] | 1 second | ["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"] | NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 0f18382d450be90edf1fd1a3770b232b | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g... | 1,600 | For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin... | standard output | |
PASSED | fb03088bc78b29e334b30c9f697a9523 | train_001.jsonl | 1593610500 | A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In... | 256 megabytes |
import java.io.*;
import java.sql.Array;
import java.util.*;
public class Main {
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reader()
{
... | Java | ["4\n2 2\n3 8\n1 0\n4 16"] | 1 second | ["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"] | NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 0f18382d450be90edf1fd1a3770b232b | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g... | 1,600 | For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin... | standard output | |
PASSED | 8ace214442636a6b20ea76da36c03728 | train_001.jsonl | 1593610500 | A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In... | 256 megabytes |
import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
//System.out.println("Kickstart baby!!");
int test=s.nextInt();
while(test-->0)
{
int n=s.nextInt();
int k=s.next... | Java | ["4\n2 2\n3 8\n1 0\n4 16"] | 1 second | ["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"] | NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 0f18382d450be90edf1fd1a3770b232b | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g... | 1,600 | For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin... | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.