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 | fd07da69d479a1452d0d358c2cd2b960 | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int j=0; j<t; j++){
int n = sc.nextInt();
for(int i=0; i<n; i++){
for(int k=0; k<n; k++){
if(i==k || i==k-1 || i== k+1)... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | af0c042eeb00fb2b8ed6bbc251484d1e | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.sqrt;
public class Main implements Runnable {
public static void main(String[] args) throws IOException, InterruptedException {
Thread t = new Thread(null, new Main(), "solutionThread", 1 << 28);
t.start();
// System.setIn(n... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | c927ed4359dbac3453d4fbd588a99dce | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main implements Runnable {
public static void main(String[] args) throws IOException, InterruptedException {
Thread t = new Thread(null, new Main(), "solutionThread", 1 << 28);
t.start();
// System.setIn(new FileInputStream("input.txt"));
//... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | 0ffef88ab48d667bdffc3d1979f65d4c | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | /*package whatever //do not write package name here */
import java.io.*;
import java.util.*;
public class GFG {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0) {
int n = sc.nextInt();
int ans[][] = new int[n][n];
for(int i = ... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | f43b683d6ca4d4316c5feb5e5e023caa | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes |
import java.io.*;
import java.util.*;
public class B {
public static void main(String[] args) {
FastScanner in = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int t = in.nextInt();
while(t-->0) {
int n = in.nextInt();
int zeros = 0;
... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | 4ea84e7a330c79122c00c61f495b7b54 | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Stack;
import java.util.String... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | 454946e2483105ad373eb4dd7df32d59 | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes |
import java.util.*;
import java.io.*;
public class Prb84 {
static FastReader sc = new FastReader();
public static void main(String[] args) {
int t = sc.nextInt();
while(t--!=0){
int n = sc.nextInt();
int j = 0;
int k = n-1;
boolean f =... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | 4dc3166e9b44f9e6149d55b50d2f1393 | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | //package CodeForces.Round678Div2;
import java.io.*;import java.util.*;import java.math.*;
public class B
{
static long mod=1000000007l;
static int max=Integer.MAX_VALUE,min=Integer.MIN_VALUE;
static long maxl=Long.MAX_VALUE,minl=Long.MIN_VALUE;
static BufferedReader br=new BufferedReader(new InputStre... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | 7ea180e09de9c5ab5434ef3fefb7d6b4 | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | //package round_678_div2;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class B {
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine());
while(... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | 006d8ccf951bc932e2aadcf9187f8f0b | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | import java.util.Scanner;
public class prime_square_codeforce {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int pp = sc.nextInt();
for(int k =1;k<=pp;k++){
int n = sc.nextInt();
int arr[][] = new int[n][n];
for(int i =0;i<n;i++){
... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | e3cc2dbced4c37cb9fb3beab4cd99f9c | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class B {
static BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws java.lang.... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | 293f815a8c772dbccc55bd74f92cc81f | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class B678
{
public static void printMatrix(int arr[][]){
int n = arr.length;
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
System.out.print(arr[i][j] + " ");
}
System.ou... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | 407f122ea35bd7b5cce6c7df8689a1a0 | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | import java.util.Scanner;
public class PrimeSquare {
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int tests = sc.nextInt();
while(tests -- > 0)
{
int n = sc.nextInt();
int[][] ans = new int[n][n];
for(int i =... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | 5eb8971dcd07872351f434215867e6a4 | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class PSQ {
public static void main(String[] args) throws Exception {
BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
int test=Integer.parseInt(sc.readLine());
int n;
int prime;
... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | 90d32abdcd63dde5abd3b25efc06bf4d | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
import java.util.Set;
import java.util.StringTokenizer;
public class FastReader {
BufferedReader ... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | ddc30d832cc3dd222019017825b9fda4 | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | import java.util.*;
public class NewClass3 {
public static boolean isPrime(int n) {
int c = 0;
for (int i = 1; i <= n; i++) {
if (n % i == 0) {
c++;
}
}
if (c == 2) {
return true;
}
else {
return f... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | 6d82d88c11db6e9d15d37c0595e8c6b9 | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class B {
static int max = 100000;
public static void main(String[] args) {
FastScanner fs = new FastScanner();
int t = fs.nextInt();
while (t-- > 0) {
int num = fs.nextInt... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | 3aa008ee78cbd9835d52297d3b16db5a | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 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() {
solve();
}
}, "1", 1 ... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | 6c318c932938f80f7e36617f05ff915b | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | import java.lang.*;
import java.util.*;
public class MyClass {
static boolean isPrime(int n)
{
// Corner cases
if (n <= 1) return false;
if (n <= 3) return true;
if (n % 2 == 0 || n % 3 == 0) return false;
for (int i = 5; i * i <= n; i = i + 6)
... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | 02246d2daabe2b34791dac82d6903f5b | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | import java.util.*;
public class MyClass {
static boolean isPrime(int n)
{
// Corner cases
if (n <= 1) return false;
if (n <= 3) return true;
if (n % 2 == 0 || n % 3 == 0) return false;
for (int i = 5; i * i <= n; i = i + 6)
if (n % ... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | 1bacf556138581a5fd58f2dd65259151 | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | import java.io.*;
import java.util.*;
public class main
{
public static void check(int n)
{
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if((i==n-1 && j==0)|| (i==n-1 && j==n-1))
{
System.out.print(1+" ");
... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | c593a0e2cbe7e4dd9db699793064bb2d | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | /******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
*****************************************************... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | d32b3f7b67bc13f06ffb71e8fa8e18ab | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | // Don't place your source in a package
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
/*
6666666666666 6666666666666
6 6
6 6
6 6
6 6 ... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | f731fcdc2d6c4c2588ec19fcd6ab3b67 | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.*;
public class A {
public static void main (String[] args) throws java.lang.Exception {
try {
FastScanner fs = new FastScanner();
int t =fs.nextInt();
... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | e815632edcbd36fe0b0428fa8b757ce9 | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | import java.util.Scanner;
public class b {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int num = sc.nextInt();
int prime =199;
int[][]a=new int[num][num];
if(num%2==0) {... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | 8acb5986acee0da9b5d834ef2f891de1 | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | import java.util.Scanner;
public class ClassB {
public static void main(String[] arges) {
Scanner in = new Scanner(System.in);
int T=in.nextInt();
int[] prime=new int[200005];
prime[1]=1;
prime[0]=0;
for(int i=2;i<=200005/2;i++) {
for(int j=i+i;j<200005;j=j+i) {
prime[j]=1;
}
}
while(T!=0) ... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | fea44a40ec5e2695ffcf86d0eecf7a0f | train_003.jsonl | 1603548300 | Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square. A square of size $$$n \times n$$$ is called ... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args) {
try{
Scanner scan = new Scanner(System.in);
int n,t,i,j,k,temp;
t = scan.nextInt();
for(i=0; i<t; i++){
n = scan.nextInt();
temp = 1;
... | Java | ["2\n4\n2"] | 1.5 seconds | ["4 6 8 1\n4 9 9 9\n4 10 10 65\n1 4 4 4\n1 1\n1 1"] | null | Java 8 | standard input | [
"constructive algorithms",
"math"
] | df6ee0d8bb25dc2040adf1f115f4a83b | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required size of a square. | 900 | For each test case print $$$n$$$ lines, each containing $$$n$$$ integers — the prime square you built. If there are multiple answers, print any. | standard output | |
PASSED | ec07a7cf5280a2167d3bb5301cd7901e | train_003.jsonl | 1362929400 | Momiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree.The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by v) and removes all the subtree ... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual sol... | Java | ["2\n1 2", "3\n1 2\n1 3"] | 1 second | ["1.50000000000000000000", "2.00000000000000000000"] | NoteIn the first sample, there are two cases. One is directly remove the root and another is remove the root after one step. Thus the expected steps are: 1 × (1 / 2) + 2 × (1 / 2) = 1.5In the second sample, things get more complex. There are two cases that reduce to the first sample, and one case cleaned at once. Thus ... | Java 7 | standard input | [
"probabilities",
"implementation",
"trees",
"math"
] | 85b78251160db9d7ca1786e90e5d6f21 | The first line contains integer n (1 ≤ n ≤ 105) — the number of nodes in the tree. The next n - 1 lines contain the tree edges. The i-th line contains integers ai, bi (1 ≤ ai, bi ≤ n; ai ≠ bi) — the numbers of the nodes that are connected by the i-th edge. It is guaranteed that the given graph is a tree. | 2,200 | Print a single real number — the expectation of the number of steps in the described game. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 8f856526fc71c238055d965749e944ba | train_003.jsonl | 1362929400 | Momiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree.The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by v) and removes all the subtree ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
public static void main(String[] args) {
new Main().run();
}
Edge[] firstEdge;
double ret;
void addEdge(int u, int v) {
firstEdge[u] = new Edge(v, firstEdge[u]);
}
void dfs(int x, int length, int father) {
ret += 1.0 / length;
... | Java | ["2\n1 2", "3\n1 2\n1 3"] | 1 second | ["1.50000000000000000000", "2.00000000000000000000"] | NoteIn the first sample, there are two cases. One is directly remove the root and another is remove the root after one step. Thus the expected steps are: 1 × (1 / 2) + 2 × (1 / 2) = 1.5In the second sample, things get more complex. There are two cases that reduce to the first sample, and one case cleaned at once. Thus ... | Java 7 | standard input | [
"probabilities",
"implementation",
"trees",
"math"
] | 85b78251160db9d7ca1786e90e5d6f21 | The first line contains integer n (1 ≤ n ≤ 105) — the number of nodes in the tree. The next n - 1 lines contain the tree edges. The i-th line contains integers ai, bi (1 ≤ ai, bi ≤ n; ai ≠ bi) — the numbers of the nodes that are connected by the i-th edge. It is guaranteed that the given graph is a tree. | 2,200 | Print a single real number — the expectation of the number of steps in the described game. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | f9abd8ead56bb05c1d60429d6d3282c3 | train_003.jsonl | 1362929400 | Momiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree.The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by v) and removes all the subtree ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces {
FastScanner in;
PrintWriter out;
double ans = 0;
int n;
double[] dp;
ArrayList<Integer>[] g;
void dfs(int v, int h, int p) {
dp[v] = 1;
for (int i = 0; i < g[v].size(); i++) {
int to = g[v].get(i);
if (to != p) {
dfs(to, h + 1, v);... | Java | ["2\n1 2", "3\n1 2\n1 3"] | 1 second | ["1.50000000000000000000", "2.00000000000000000000"] | NoteIn the first sample, there are two cases. One is directly remove the root and another is remove the root after one step. Thus the expected steps are: 1 × (1 / 2) + 2 × (1 / 2) = 1.5In the second sample, things get more complex. There are two cases that reduce to the first sample, and one case cleaned at once. Thus ... | Java 7 | standard input | [
"probabilities",
"implementation",
"trees",
"math"
] | 85b78251160db9d7ca1786e90e5d6f21 | The first line contains integer n (1 ≤ n ≤ 105) — the number of nodes in the tree. The next n - 1 lines contain the tree edges. The i-th line contains integers ai, bi (1 ≤ ai, bi ≤ n; ai ≠ bi) — the numbers of the nodes that are connected by the i-th edge. It is guaranteed that the given graph is a tree. | 2,200 | Print a single real number — the expectation of the number of steps in the described game. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 176c8014530def7e18ddb0aebc5889bf | train_003.jsonl | 1362929400 | Momiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree.The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by v) and removes all the subtree ... | 256 megabytes | import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.List;
import java.io.IOException;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.m... | Java | ["2\n1 2", "3\n1 2\n1 3"] | 1 second | ["1.50000000000000000000", "2.00000000000000000000"] | NoteIn the first sample, there are two cases. One is directly remove the root and another is remove the root after one step. Thus the expected steps are: 1 × (1 / 2) + 2 × (1 / 2) = 1.5In the second sample, things get more complex. There are two cases that reduce to the first sample, and one case cleaned at once. Thus ... | Java 7 | standard input | [
"probabilities",
"implementation",
"trees",
"math"
] | 85b78251160db9d7ca1786e90e5d6f21 | The first line contains integer n (1 ≤ n ≤ 105) — the number of nodes in the tree. The next n - 1 lines contain the tree edges. The i-th line contains integers ai, bi (1 ≤ ai, bi ≤ n; ai ≠ bi) — the numbers of the nodes that are connected by the i-th edge. It is guaranteed that the given graph is a tree. | 2,200 | Print a single real number — the expectation of the number of steps in the described game. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 9753b6693ec08fb57295e138851f0480 | train_003.jsonl | 1362929400 | Momiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree.The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by v) and removes all the subtree ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Task {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
int n = in.nextInt();
ArrayList... | Java | ["2\n1 2", "3\n1 2\n1 3"] | 1 second | ["1.50000000000000000000", "2.00000000000000000000"] | NoteIn the first sample, there are two cases. One is directly remove the root and another is remove the root after one step. Thus the expected steps are: 1 × (1 / 2) + 2 × (1 / 2) = 1.5In the second sample, things get more complex. There are two cases that reduce to the first sample, and one case cleaned at once. Thus ... | Java 7 | standard input | [
"probabilities",
"implementation",
"trees",
"math"
] | 85b78251160db9d7ca1786e90e5d6f21 | The first line contains integer n (1 ≤ n ≤ 105) — the number of nodes in the tree. The next n - 1 lines contain the tree edges. The i-th line contains integers ai, bi (1 ≤ ai, bi ≤ n; ai ≠ bi) — the numbers of the nodes that are connected by the i-th edge. It is guaranteed that the given graph is a tree. | 2,200 | Print a single real number — the expectation of the number of steps in the described game. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | accf88152db60a725ef3fa816b07d7fe | train_003.jsonl | 1362929400 | Momiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree.The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by v) and removes all the subtree ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Task {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
int n = in.nextInt();
ArrayList <... | Java | ["2\n1 2", "3\n1 2\n1 3"] | 1 second | ["1.50000000000000000000", "2.00000000000000000000"] | NoteIn the first sample, there are two cases. One is directly remove the root and another is remove the root after one step. Thus the expected steps are: 1 × (1 / 2) + 2 × (1 / 2) = 1.5In the second sample, things get more complex. There are two cases that reduce to the first sample, and one case cleaned at once. Thus ... | Java 7 | standard input | [
"probabilities",
"implementation",
"trees",
"math"
] | 85b78251160db9d7ca1786e90e5d6f21 | The first line contains integer n (1 ≤ n ≤ 105) — the number of nodes in the tree. The next n - 1 lines contain the tree edges. The i-th line contains integers ai, bi (1 ≤ ai, bi ≤ n; ai ≠ bi) — the numbers of the nodes that are connected by the i-th edge. It is guaranteed that the given graph is a tree. | 2,200 | Print a single real number — the expectation of the number of steps in the described game. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 6c6d10209f50cf5e047741794d68192b | train_003.jsonl | 1362929400 | Momiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree.The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by v) and removes all the subtree ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Task {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
int n = in.nextInt();
ArrayList... | Java | ["2\n1 2", "3\n1 2\n1 3"] | 1 second | ["1.50000000000000000000", "2.00000000000000000000"] | NoteIn the first sample, there are two cases. One is directly remove the root and another is remove the root after one step. Thus the expected steps are: 1 × (1 / 2) + 2 × (1 / 2) = 1.5In the second sample, things get more complex. There are two cases that reduce to the first sample, and one case cleaned at once. Thus ... | Java 7 | standard input | [
"probabilities",
"implementation",
"trees",
"math"
] | 85b78251160db9d7ca1786e90e5d6f21 | The first line contains integer n (1 ≤ n ≤ 105) — the number of nodes in the tree. The next n - 1 lines contain the tree edges. The i-th line contains integers ai, bi (1 ≤ ai, bi ≤ n; ai ≠ bi) — the numbers of the nodes that are connected by the i-th edge. It is guaranteed that the given graph is a tree. | 2,200 | Print a single real number — the expectation of the number of steps in the described game. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | dab408d9cc3fea4ffade5b2e2f3f000e | train_003.jsonl | 1362929400 | Momiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree.The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by v) and removes all the subtree ... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class C {
ArrayList<Integer>[] edge;
double[] d;
double res = 0;
void dfs(int v, int par, int lastd, int dst) {
if (v != 0 && edge[v].size() == 1) {
res += d[dst] - d[lastd];
return;
}
for (int i = 0; i < edge[v].size(); i+... | Java | ["2\n1 2", "3\n1 2\n1 3"] | 1 second | ["1.50000000000000000000", "2.00000000000000000000"] | NoteIn the first sample, there are two cases. One is directly remove the root and another is remove the root after one step. Thus the expected steps are: 1 × (1 / 2) + 2 × (1 / 2) = 1.5In the second sample, things get more complex. There are two cases that reduce to the first sample, and one case cleaned at once. Thus ... | Java 7 | standard input | [
"probabilities",
"implementation",
"trees",
"math"
] | 85b78251160db9d7ca1786e90e5d6f21 | The first line contains integer n (1 ≤ n ≤ 105) — the number of nodes in the tree. The next n - 1 lines contain the tree edges. The i-th line contains integers ai, bi (1 ≤ ai, bi ≤ n; ai ≠ bi) — the numbers of the nodes that are connected by the i-th edge. It is guaranteed that the given graph is a tree. | 2,200 | Print a single real number — the expectation of the number of steps in the described game. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 03b3076c017f5067f5612e8ecbe2ceb1 | train_003.jsonl | 1362929400 | Momiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree.The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by v) and removes all the subtree ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Bit... | Java | ["2\n1 2", "3\n1 2\n1 3"] | 1 second | ["1.50000000000000000000", "2.00000000000000000000"] | NoteIn the first sample, there are two cases. One is directly remove the root and another is remove the root after one step. Thus the expected steps are: 1 × (1 / 2) + 2 × (1 / 2) = 1.5In the second sample, things get more complex. There are two cases that reduce to the first sample, and one case cleaned at once. Thus ... | Java 7 | standard input | [
"probabilities",
"implementation",
"trees",
"math"
] | 85b78251160db9d7ca1786e90e5d6f21 | The first line contains integer n (1 ≤ n ≤ 105) — the number of nodes in the tree. The next n - 1 lines contain the tree edges. The i-th line contains integers ai, bi (1 ≤ ai, bi ≤ n; ai ≠ bi) — the numbers of the nodes that are connected by the i-th edge. It is guaranteed that the given graph is a tree. | 2,200 | Print a single real number — the expectation of the number of steps in the described game. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | a3c42aed2044f55281d5699988462cb9 | train_003.jsonl | 1362929400 | Momiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree.The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by v) and removes all the subtree ... | 256 megabytes | import java.io.*;
import java.util.*;
public class C {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
ArrayList<Integer>[] g;
int[] depth;
void dfs(int v, int p, int d) {
depth[v] = d;
for (int i = 0; i < g[v].size(); i++) {
int to = g[v].get(i);
if (to != p)
dfs(to, v, d... | Java | ["2\n1 2", "3\n1 2\n1 3"] | 1 second | ["1.50000000000000000000", "2.00000000000000000000"] | NoteIn the first sample, there are two cases. One is directly remove the root and another is remove the root after one step. Thus the expected steps are: 1 × (1 / 2) + 2 × (1 / 2) = 1.5In the second sample, things get more complex. There are two cases that reduce to the first sample, and one case cleaned at once. Thus ... | Java 7 | standard input | [
"probabilities",
"implementation",
"trees",
"math"
] | 85b78251160db9d7ca1786e90e5d6f21 | The first line contains integer n (1 ≤ n ≤ 105) — the number of nodes in the tree. The next n - 1 lines contain the tree edges. The i-th line contains integers ai, bi (1 ≤ ai, bi ≤ n; ai ≠ bi) — the numbers of the nodes that are connected by the i-th edge. It is guaranteed that the given graph is a tree. | 2,200 | Print a single real number — the expectation of the number of steps in the described game. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 8700f52f3b1aea172c03ba360125b273 | train_003.jsonl | 1362929400 | Momiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree.The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by v) and removes all the subtree ... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public cla... | Java | ["2\n1 2", "3\n1 2\n1 3"] | 1 second | ["1.50000000000000000000", "2.00000000000000000000"] | NoteIn the first sample, there are two cases. One is directly remove the root and another is remove the root after one step. Thus the expected steps are: 1 × (1 / 2) + 2 × (1 / 2) = 1.5In the second sample, things get more complex. There are two cases that reduce to the first sample, and one case cleaned at once. Thus ... | Java 7 | standard input | [
"probabilities",
"implementation",
"trees",
"math"
] | 85b78251160db9d7ca1786e90e5d6f21 | The first line contains integer n (1 ≤ n ≤ 105) — the number of nodes in the tree. The next n - 1 lines contain the tree edges. The i-th line contains integers ai, bi (1 ≤ ai, bi ≤ n; ai ≠ bi) — the numbers of the nodes that are connected by the i-th edge. It is guaranteed that the given graph is a tree. | 2,200 | Print a single real number — the expectation of the number of steps in the described game. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | c332415f05241b8f43a4d716139c089c | train_003.jsonl | 1355671800 | Gena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements can be represented as: a1 = p, where p is some integer; ai = ai - 1 + ( - 1)i + 1·q (i > 1), where q is some int... | 256 megabytes |
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.... | Java | ["2\n3 5", "4\n10 20 10 30"] | 1 second | ["2", "3"] | NoteIn the first test the sequence actually is the suitable subsequence. In the second test the following subsequence fits: 10, 20, 10. | Java 6 | standard input | [
"dp",
"brute force"
] | 86ded9e6336a14b43dda780ebd099b4f | The first line contains integer n (1 ≤ n ≤ 4000). The next line contains n integers b1, b2, ..., bn (1 ≤ bi ≤ 106). | 1,500 | Print a single integer — the length of the required longest subsequence. | standard output | |
PASSED | 73823c8ad193d4bb564f51835e7a144c | train_003.jsonl | 1355671800 | Gena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements can be represented as: a1 = p, where p is some integer; ai = ai - 1 + ( - 1)i + 1·q (i > 1), where q is some int... | 256 megabytes |
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.... | Java | ["2\n3 5", "4\n10 20 10 30"] | 1 second | ["2", "3"] | NoteIn the first test the sequence actually is the suitable subsequence. In the second test the following subsequence fits: 10, 20, 10. | Java 6 | standard input | [
"dp",
"brute force"
] | 86ded9e6336a14b43dda780ebd099b4f | The first line contains integer n (1 ≤ n ≤ 4000). The next line contains n integers b1, b2, ..., bn (1 ≤ bi ≤ 106). | 1,500 | Print a single integer — the length of the required longest subsequence. | standard output | |
PASSED | a4415f6fe7c4c39a3de3357542225385 | train_003.jsonl | 1355671800 | Gena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements can be represented as: a1 = p, where p is some integer; ai = ai - 1 + ( - 1)i + 1·q (i > 1), where q is some int... | 256 megabytes |
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.... | Java | ["2\n3 5", "4\n10 20 10 30"] | 1 second | ["2", "3"] | NoteIn the first test the sequence actually is the suitable subsequence. In the second test the following subsequence fits: 10, 20, 10. | Java 6 | standard input | [
"dp",
"brute force"
] | 86ded9e6336a14b43dda780ebd099b4f | The first line contains integer n (1 ≤ n ≤ 4000). The next line contains n integers b1, b2, ..., bn (1 ≤ bi ≤ 106). | 1,500 | Print a single integer — the length of the required longest subsequence. | standard output | |
PASSED | 094de201a7e062638d285519852359b2 | train_003.jsonl | 1355671800 | Gena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements can be represented as: a1 = p, where p is some integer; ai = ai - 1 + ( - 1)i + 1·q (i > 1), where q is some int... | 256 megabytes | import java.io.*;
import java.util.*;
public class R165_D2_C {
static int[] inp;
static int[][] dp;
static int[] next;
public static int call(int i, int j) {
if (i == -1)
return 0;
if (j == -1)
return 1;
if (dp[i][j] != -1)
return dp[i][j];
... | Java | ["2\n3 5", "4\n10 20 10 30"] | 1 second | ["2", "3"] | NoteIn the first test the sequence actually is the suitable subsequence. In the second test the following subsequence fits: 10, 20, 10. | Java 6 | standard input | [
"dp",
"brute force"
] | 86ded9e6336a14b43dda780ebd099b4f | The first line contains integer n (1 ≤ n ≤ 4000). The next line contains n integers b1, b2, ..., bn (1 ≤ bi ≤ 106). | 1,500 | Print a single integer — the length of the required longest subsequence. | standard output | |
PASSED | c690d241297408c14bd292abcbc3c91d | train_003.jsonl | 1355671800 | Gena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements can be represented as: a1 = p, where p is some integer; ai = ai - 1 + ( - 1)i + 1·q (i > 1), where q is some int... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class C {
static int n;
static int[] nums;
static int[][] dp;
static int[] next;
public static void main(String[] args) throws IOException ... | Java | ["2\n3 5", "4\n10 20 10 30"] | 1 second | ["2", "3"] | NoteIn the first test the sequence actually is the suitable subsequence. In the second test the following subsequence fits: 10, 20, 10. | Java 6 | standard input | [
"dp",
"brute force"
] | 86ded9e6336a14b43dda780ebd099b4f | The first line contains integer n (1 ≤ n ≤ 4000). The next line contains n integers b1, b2, ..., bn (1 ≤ bi ≤ 106). | 1,500 | Print a single integer — the length of the required longest subsequence. | standard output | |
PASSED | adbcd579d464ba606b2349d6d10960f5 | train_003.jsonl | 1355671800 | Gena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements can be represented as: a1 = p, where p is some integer; ai = ai - 1 + ( - 1)i + 1·q (i > 1), where q is some int... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.HashSet;
public class C {
static int n;
static int[] nums;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedRea... | Java | ["2\n3 5", "4\n10 20 10 30"] | 1 second | ["2", "3"] | NoteIn the first test the sequence actually is the suitable subsequence. In the second test the following subsequence fits: 10, 20, 10. | Java 6 | standard input | [
"dp",
"brute force"
] | 86ded9e6336a14b43dda780ebd099b4f | The first line contains integer n (1 ≤ n ≤ 4000). The next line contains n integers b1, b2, ..., bn (1 ≤ bi ≤ 106). | 1,500 | Print a single integer — the length of the required longest subsequence. | standard output | |
PASSED | fc2ffe8f27f63f1694539e3d25d40d50 | train_003.jsonl | 1355671800 | Gena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements can be represented as: a1 = p, where p is some integer; ai = ai - 1 + ( - 1)i + 1·q (i > 1), where q is some int... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;
public class C {
static BufferedReader stdin = new BufferedReader(new
InputStreamReader(System.in));
static St... | Java | ["2\n3 5", "4\n10 20 10 30"] | 1 second | ["2", "3"] | NoteIn the first test the sequence actually is the suitable subsequence. In the second test the following subsequence fits: 10, 20, 10. | Java 6 | standard input | [
"dp",
"brute force"
] | 86ded9e6336a14b43dda780ebd099b4f | The first line contains integer n (1 ≤ n ≤ 4000). The next line contains n integers b1, b2, ..., bn (1 ≤ bi ≤ 106). | 1,500 | Print a single integer — the length of the required longest subsequence. | standard output | |
PASSED | 180284b73ea8127422ddd2a5eab70695 | train_003.jsonl | 1355671800 | Gena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements can be represented as: a1 = p, where p is some integer; ai = ai - 1 + ( - 1)i + 1·q (i > 1), where q is some int... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.StringTokenizer;
import static java.lang.Math.*;
@SuppressWarnings("unused")
public class round156C {
static BufferedReader br =... | Java | ["2\n3 5", "4\n10 20 10 30"] | 1 second | ["2", "3"] | NoteIn the first test the sequence actually is the suitable subsequence. In the second test the following subsequence fits: 10, 20, 10. | Java 6 | standard input | [
"dp",
"brute force"
] | 86ded9e6336a14b43dda780ebd099b4f | The first line contains integer n (1 ≤ n ≤ 4000). The next line contains n integers b1, b2, ..., bn (1 ≤ bi ≤ 106). | 1,500 | Print a single integer — the length of the required longest subsequence. | standard output | |
PASSED | 094aba5d156d50d35ae0ca447b8b68b4 | train_003.jsonl | 1355671800 | Gena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements can be represented as: a1 = p, where p is some integer; ai = ai - 1 + ( - 1)i + 1·q (i > 1), where q is some int... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.StringTokenizer;
import static java.lang.Math.*;
@SuppressWarnings("unused")
public class round156C {
static BufferedReader br =... | Java | ["2\n3 5", "4\n10 20 10 30"] | 1 second | ["2", "3"] | NoteIn the first test the sequence actually is the suitable subsequence. In the second test the following subsequence fits: 10, 20, 10. | Java 6 | standard input | [
"dp",
"brute force"
] | 86ded9e6336a14b43dda780ebd099b4f | The first line contains integer n (1 ≤ n ≤ 4000). The next line contains n integers b1, b2, ..., bn (1 ≤ bi ≤ 106). | 1,500 | Print a single integer — the length of the required longest subsequence. | standard output | |
PASSED | 5eb97d3263537f4f68c428252743e8f7 | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class VasyaWrestling2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long sum1 = 0;
long sum2 = 0;
// false means first player
boolean flag = false;
... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | 1adabb56bf22bf53930aeb3cf8f54020 | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Scan sc = new Scan();
int n = sc.scanInt();
Sol sol = new Sol(n);
while(n-- > 0){
int val = sc.scanInt();
if(val > 0)
sol.put... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | d7e27c035a558bb916237b02f0d8a28a | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes | /* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc=new Sc... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | 308b665302ccbe33be58a6aeafd707d9 | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class VasyaAndWrestling {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n=in.nextInt();
long x=0;
long y=0;
ArrayList<Integer> lx= new ArrayL... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | eeecd27b4730673ed0e1406a891813b1 | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | 7b999bdee035a8ba0e08f8fa2519e519 | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes |
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
/**
* Created by Петруча on 12.11.2014.
*/
public class Main {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int n=s.nextInt();
ArrayList<Integer> first=new Array... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | e9ef4f4d3dc9bda2c3db96755fcb811a | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class VasyaAndWrestling {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(bf... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | c05af59962f50cbcffcf1cf4a8a2d14b | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Objects;
import java.util.StringTokenizer;
import java.util.function... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | 94d9f68e0f183429276ec00f4ded5e03 | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
long sum = 0;
int last = 0;
List<Integer> first = new ArrayList<Integer>();
... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | 13783094c61892a452c950fd74b2651d | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int sza = 0, szb = 0;
int[] a = new int[n];
int[] b = new ... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | 69b908c72aca36e662ca15281ca2e452 | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s = new Scanner(System.in);
int t = s.nextInt();
ArrayList<Integer> first = new ArrayList<>();
ArrayList<Integer> second = new ArrayList<>();
boole... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | 4ddd1fcaa975bc16acaa0dba9f623bc5 | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes | import java.util.Scanner;
public class paintingPebbles {
static int update[] = new int[1001];
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n =sc.nextInt();
long c1=0;
long c2=0;
int t=0 , t1=0 ,t2=0 ,k1=0;
long p[]=new long[... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | 96b189664ae11aebbe58d09afeb0d9e7 | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
FastScanner in;
PrintWriter out;
static class FastScanner {
BufferedReader br;
StringTokenizer st;
FastScanner(InputStream in) {
br = new BufferedReader(new InputStreamReader(in));
... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | 7b4780a1cc6839d71b0a8aa0ff1ce9a4 | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes | import java.util.*;
import java.lang.*;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
ArrayList<Integer> list1 = new ArrayList<>();
ArrayList<Integer> list2 = new ArrayList<>();
int flag = 0; // if flag is zero then last techniqu... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | 1d64fdf1324106f886d744d0b551082a | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes | import java.util.*;
public class B {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int n=sc.nextInt(),last=0;long dif=0;
ArrayList<Integer> a1 = new ArrayList<Integer>();
ArrayList<Integer> b1 = new ArrayList<Integer>();
for(int i=0;i<n;i++)
... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | 6a84bc527dd92aa2e55933da917c9bef | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes | import java.io.PrintWriter;
import java.util.Deque;
import java.util.LinkedList;
import java.util.Scanner;
public final class B {
private static final Scanner in = new Scanner(System.in);
private static final PrintWriter out = new PrintWriter(System.out);
public static final String FIRST = "first";
p... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | f7aa2a3ee23ba9e60b838a02c7bc7892 | train_003.jsonl | 1417618800 | Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the... | 256 megabytes | import java.io.PrintWriter;
import java.util.Deque;
import java.util.LinkedList;
import java.util.Scanner;
public final class B {
private static final Scanner in = new Scanner(System.in);
private static final PrintWriter out = new PrintWriter(System.out);
public static final String FIRST = "first";
p... | Java | ["5\n1\n2\n-3\n-4\n3", "3\n-1\n-2\n3", "2\n4\n-4"] | 2 seconds | ["second", "first", "second"] | NoteSequence x = x1x2... x|x| is lexicographically larger than sequence y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or there is such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1.We use notation |a| t... | Java 8 | standard input | [
"implementation"
] | d3684227d1f12cf36dc302e1ffee8370 | The first line contains number n — the number of techniques that the wrestlers have used (1 ≤ n ≤ 2·105). The following n lines contain integer numbers ai (|ai| ≤ 109, ai ≠ 0). If ai is positive, that means that the first wrestler performed the technique that was awarded with ai points. And if ai is negative, that mea... | 1,400 | If the first wrestler wins, print string "first", otherwise print "second" | standard output | |
PASSED | 3d7bdf261424b732ffd03bf19b1efdb0 | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;
/**
* Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools
*/
public class Main {
... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 5f7e68678af7977967745956e73fc396 | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
public class B {
static Scanner sc = new Scanner(System.in);
static InputStreamReader stream = new InputStreamRead... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 59788cda3783e9ca42768630b678422f | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
import java.awt.Point;
// SHIVAM GUPTA :
//NSIT
//decoder_1671
// STOP NOT TILL IT IS DONE OR U DIE .
// U KNOW THAT IF THIS DAY WILL BE URS THEN NO ONE CAN DEFEAT U HERE................
// ASCII = 48 + i ;// 2^28 = 268,435,456 > 2* 10^8 // log 10 base 2 = ... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 5f1b980aa595d120cf0f5943ebe440be | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
import java.awt.Point;
// SHIVAM GUPTA :
//NSIT
//decoder_1671
// STOP NOT TILL IT IS DONE OR U DIE .
// U KNOW THAT IF THIS DAY WILL BE URS THEN NO ONE CAN DEFEAT U HERE................
// ASCII = 48 + i ;// 2^28 = 268,435,456 > 2* 10^8 // log 10 base 2 = ... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 8cf12f2a0c0f1519a5a4e9d76b40c238 | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 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];
private int curChar;
... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 413ebfa2a85564e6a6f4058988332ec6 | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.util.*;
import java.io.*;
public class MyClass {
static PrintWriter w;
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
w=new PrintWriter(System.out);
int test=Integer.parseInt(sc.nextLine());
A: while(test-->0){
... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | bb8153d0fcad2372cec9ef3145ef3697 | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class CF1417B {
public static void main(String[] args) throws IOException {
int t = ri();
while(t --> 0) {
int n = rni(), T = ni(), a[] = ria(n), ind = 0;
for(int ... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 20d724e7a11daa54aa8c11f5af844341 | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int q=0;q<t;q++)
... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 9a153658ac15fece315841d4b62422dd | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.util.*;
public class codenation {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int t=s.nextInt();
for(int tt=0;tt<t;tt++) {
int n=s.nextInt();
int T=s.nextInt();
int a[]=new int[n];
int ans[]=new int[n];
boolean c=true;
for(int i=0;i<n;i++) {
a[i]=... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | e324d94f22b8adc7a790a5882e6d7085 | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes |
import java.util.*;
public class B{
public static void main(String[] args) {
// TODO Auto-generated method stub
@SuppressWarnings("resource")
Scanner sc=new Scanner(System.in);
int t=0;
t=sc.nextInt();
while(t>0) {
t--;
int n=sc.nextInt();
int T=sc.nextInt();
int arr[]=new int[n];
int ans... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | b5455a05bd89fed0de9e2ae8b468625b | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import com.sun.source.tree.Tree;
import java.math.BigInteger;
import java.sql.Array;
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Solution {
static long MOD=1000000007;
// Complete the maximumSum function below.
... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 32495a36354dd9c7fd568880025f7e0e | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.util.*;
import java.io.*;
public class MyClass {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next(... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | f8470b6b60be1a96b0345e562cf07cbe | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Sample {
static int arr[];
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
//Scanner input = new Scanner(System.in);
//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Scanner i... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 2ab9839074531096f3dcfc6d55f8e8f3 | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
public class Main
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
while (sc.hasNext())
{
int ok = sc.nextInt();
while (ok-- > 0)
{
int a=sc.nextInt(),b=sc.nextInt();
int x=0;
int d... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | aefaaa73e4349db4ad12a34de1b43928 | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.util.Scanner;
public class T2 {
public static void main (String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int n=sc.nextInt();
long T=sc.nextLong();
int a1;
int a2=1;
for(in... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 3724445831e0b29135005c4f60be1577 | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.util.*;
public class ECR96 {
private static Scanner scan;
public static void main(String args[]) {
scan = new Scanner(System.in);
int t = scan.nextInt();
while(t-->0) {
int n = scan.nextInt();
int T = scan.nextInt();
int c = 0;
int ans[] = new int[n];
int a[] = new int[n];
fo... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 7024deea55db0559ab5fd1fe9d439712 | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.util.*;
import javax.lang.model.util.ElementScanner6;
import java.io.*;
public class B{
static class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
private SpaceCharFilter filter;
publ... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | cb876aa15ec50ab5f14acbb5ef68285a | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.io.*;
import java.util.*;
public class B {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int yo = sc.nextInt();
while(yo-->0) {
int n = sc.nextInt();
int x = sc.nextInt();
int[] a = sc.readArray(n);
Map<Integer,Integer> map1 = new HashMap<>();
Map<... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 8323ab01254f90cbefc245b719ac9aef | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int t = input.nextInt();
for(int i = 0; i < t; i++) {
int n = input.nextInt();
int ... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 13996384226a214812b438ee0414b9ca | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.util.Scanner;
public class Main {
private final static Scanner scanner = new Scanner(System.in);
static void solve(int[][]arr, int T) {
StringBuilder output = new StringBuilder("");
double half = (double)T/2;
int halfColor = 0;
for(int i=0; i<arr.length; i++) {
... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | aeb26eaf634d4b58d4b7d4113798f53f | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes |
/*
AUTH -> krishna-3249
DATE -> 9/27/20
TIME -> 8:54 PM
*/
/*
Simple can be harder than complex.
Body, mind and spirit.
Strive for progress, not perfection.
*/
import java.lang.*;
import java.io.*;
import java.util.*;
public class B {
private static final long MOD = 1_000_000_000 + 7;
... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | ada464d04b675289abd9ed53c36c358f | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class CFB {
public static void solve(Scanner sc, int caseNum) {
int n = sc.nextInt();
int t = sc.nextInt();
boolean flag = false;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) {
int a = sc.nextInt();
if ... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | c0dbd944514eead097b706c658faa38f | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.StringTokenizer;
public class Main {
private static void solve(InputReader sc, PrintWriter out) throws Exception {
int test = sc.nextInt();
for (int ii = 0; ii < test; ii++) {
i... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 149f12d9d03e18c597f1ae1e64c29f45 | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.util.*;
import java.io.*;
public class Problem {
static int memo[][];
static int b, n, x, y, k, t, tt;
static long ans1, ans2;
static ArrayList<Integer> c, d;
static int[][] matrix;
static int[] a;
final static int Infinity = Integer.MAX_VALUE;
static int findPivot(int l, int r) {
if (a[l] >= t ... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 8b2167e90385845256031ac46db0e185 | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.io.*;
import java.util.*;
public class Pb{
public static void main(String[] args) throws IOException{
FastReader sc = new FastReader();
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out),"ASCII"),512);
int t = sc.nextInt();
while(t-- > 0)... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | b575e6ead8595c6a947240d0bf8b984c | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | /*
Modassir_Ali
algo.java
*/
import java.util.*;
import java.io.*;
import java.util.Stack ;
import java.util.HashSet;
import java.util.HashMap;
public class B_CF673D2
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 0a1c0b16d482708837ec8439fe29badf | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes |
import java.util.*;
public class B{
public static void main(String[] args) {
// TODO Auto-generated method stub
@SuppressWarnings("resource")
Scanner sc=new Scanner(System.in);
int t=0;
t=sc.nextInt();
while(t>0) {
t--;
int n=sc.nextInt();
int T=sc.nextInt();
int arr[]=new int[n];
int ans... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 3122878628e0776074c3f1274c4d8bad | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
public class sol
{
public static void main (String[] args)throws IOException{
//code
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine().trim());
while(t-->0)
{
String[] val = br... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 6f937c93bf620cb65a116be119d0ed12 | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
public class sol
{
public static void main (String[] args)throws IOException{
//code
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine().trim());
while(t-->0)
{
String[] val = br... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 2b85ec3159c338164e79cf1b9d81f1c9 | train_003.jsonl | 1601219100 | RedDreamer has an array $$$a$$$ consisting of $$$n$$$ non-negative integers, and an unlucky integer $$$T$$$.Let's denote the misfortune of array $$$b$$$ having length $$$m$$$ as $$$f(b)$$$ — the number of pairs of integers $$$(i, j)$$$ such that $$$1 \le i < j \le m$$$ and $$$b_i + b_j = T$$$. RedDreamer has to pain... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.StringTokenizer;
import java.util.*;
public class B {
public static void main(String[]args) {
FastReader fs=new FastReader();
int t=fs.nextInt();
for(int tt=0;tt<t;tt++) {
... | Java | ["2\n6 7\n1 2 3 4 5 6\n3 6\n3 3 3"] | 1 second | ["1 0 0 1 1 0 \n1 0 0"] | null | Java 11 | standard input | [
"sortings",
"greedy",
"math"
] | 6458ad752e019ffb87573c8bfb712c18 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 10^5$$$, $$$0 \le T \le 10^9$$$) — the number of elements in the array and the unlucky integer, resp... | 1,100 | For each test case print $$$n$$$ integers: $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (each $$$p_i$$$ is either $$$0$$$ or $$$1$$$) denoting the colors. If $$$p_i$$$ is $$$0$$$, then $$$a_i$$$ is white and belongs to the array $$$c$$$, otherwise it is black and belongs to the array $$$d$$$. If there are multiple answers that... | standard output | |
PASSED | 3dfff6df53b4b050f15240e108da87bd | train_003.jsonl | 1267117200 | The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla... | 64 megabytes | import java.util.Scanner;
import java.util.HashMap;
import java.util.HashSet;
public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
HashMap<String , Integer> plays = new HashMap<String, Integer>();
int n = sc.nextInt();
String[] names = new String[n];
int[] sco... | Java | ["3\nmike 3\nandrew 5\nmike 2", "3\nandrew 3\nandrew 2\nmike 5"] | 1 second | ["andrew", "andrew"] | null | Java 6 | standard input | [
"implementation",
"hashing"
] | c9e9b82185481951911db3af72fd04e7 | The first line contains an integer number n (1 ≤ n ≤ 1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer numbe... | 1,500 | Print the name of the winner. | standard output | |
PASSED | 46c735b1cbc762c9b67e6a20e217b3e5 | train_003.jsonl | 1267117200 | The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla... | 64 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class P2A {
public PrintWriter run() {
int n = sc.nextInt();
String [] name = new String [n];
int [] score = new int [n];
for (int i = 0; i < n; i++) {
name[i] = sc.next();
score[i] = sc.nextInt();
}
TreeMap<Strin... | Java | ["3\nmike 3\nandrew 5\nmike 2", "3\nandrew 3\nandrew 2\nmike 5"] | 1 second | ["andrew", "andrew"] | null | Java 6 | standard input | [
"implementation",
"hashing"
] | c9e9b82185481951911db3af72fd04e7 | The first line contains an integer number n (1 ≤ n ≤ 1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer numbe... | 1,500 | Print the name of the winner. | standard output | |
PASSED | 8ee68571b6107d8d53ecf2cb79b41fe4 | train_003.jsonl | 1267117200 | The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla... | 64 megabytes | import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Scanner;
/**
* @author Farook
*/
public class Main {
private static String priv, temp;
private static Map<String, Integer> p, p1;
private static int lines, highest, index, goldenNumber;
private static Scann... | Java | ["3\nmike 3\nandrew 5\nmike 2", "3\nandrew 3\nandrew 2\nmike 5"] | 1 second | ["andrew", "andrew"] | null | Java 6 | standard input | [
"implementation",
"hashing"
] | c9e9b82185481951911db3af72fd04e7 | The first line contains an integer number n (1 ≤ n ≤ 1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer numbe... | 1,500 | Print the name of the winner. | standard output | |
PASSED | 60db8d2299592a2e22085e690b51a86e | train_003.jsonl | 1267117200 | The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla... | 64 megabytes | import java.io.*;
import java.util.*;
public class A
{
PrintWriter out;
BufferedReader in;
StringTokenizer ss;
static void dbg(String s){System.out.println(s);};
static void deb(long x){System.out.println(x);};
String next_token() throws IOException
{while (!ss.hasMoreTokens())ss=new StringTokenizer(in.re... | Java | ["3\nmike 3\nandrew 5\nmike 2", "3\nandrew 3\nandrew 2\nmike 5"] | 1 second | ["andrew", "andrew"] | null | Java 6 | standard input | [
"implementation",
"hashing"
] | c9e9b82185481951911db3af72fd04e7 | The first line contains an integer number n (1 ≤ n ≤ 1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer numbe... | 1,500 | Print the name of the winner. | standard output | |
PASSED | 424cddabde9b0f14b502d1f2e4b9b2db | train_003.jsonl | 1267117200 | The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla... | 64 megabytes | import java.util.ArrayList;
import java.util.Collection;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Scanner;
public class _2A {
public static void main(String[] args) {
class Item {
public Item(String name, long score) {
this.name = name;
... | Java | ["3\nmike 3\nandrew 5\nmike 2", "3\nandrew 3\nandrew 2\nmike 5"] | 1 second | ["andrew", "andrew"] | null | Java 6 | standard input | [
"implementation",
"hashing"
] | c9e9b82185481951911db3af72fd04e7 | The first line contains an integer number n (1 ≤ n ≤ 1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer numbe... | 1,500 | Print the name of the winner. | standard output | |
PASSED | 4fdfe8e23d8854f5cc7ee389cfb402d6 | train_003.jsonl | 1402241400 | Valera loves his garden, where n fruit trees grow.This year he will enjoy a great harvest! On the i-th tree bi fruit grow, they will ripen on a day number ai. Unfortunately, the fruit on the tree get withered, so they can only be collected on day ai and day ai + 1 (all fruits that are not collected in these two days, b... | 256 megabytes | import java.io.*;
import java.util.*;
public class cf_r252_B {
MyScanner in;
PrintWriter out;
public void solve() {
int n = in.nextInt();
int v = in.nextInt();
int[] a = new int[3001];
for (int i=0;i<n; i++) {
a[in.nextInt()-1] += in.nextInt();
}
int sum... | Java | ["2 3\n1 5\n2 3", "5 10\n3 20\n2 20\n1 20\n4 20\n5 20"] | 1 second | ["8", "60"] | NoteIn the first sample, in order to obtain the optimal answer, you should act as follows. On the first day collect 3 fruits from the 1-st tree. On the second day collect 1 fruit from the 2-nd tree and 2 fruits from the 1-st tree. On the third day collect the remaining fruits from the 2-nd tree. In the second samp... | Java 7 | standard input | [
"implementation",
"greedy"
] | 848ead2b878f9fd8547e1d442e2f85ff | The first line contains two space-separated integers n and v (1 ≤ n, v ≤ 3000) — the number of fruit trees in the garden and the number of fruits that Valera can collect in a day. Next n lines contain the description of trees in the garden. The i-th line contains two space-separated integers ai and bi (1 ≤ ai, bi ≤ 30... | 1,400 | Print a single integer — the maximum number of fruit that Valera can collect. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.