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 | 982da79722691a0314ce7cce6d7a3f32 | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.io.Writer;
import java.io.InputStream;... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | b81b0566c99f72527184a8bd82b954c6 | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.io.Writer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* A... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | 3e2d72c45184d8834e0a74a4135d7120 | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.math.BigDecimal;
import java.io.BufferedWriter;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Rando... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | c756b2109c4977c3b80a68b7e3e6a552 | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.DataInputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.io.Wri... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | 3288f965096b8af9e13aa5202d697b30 | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.io.Writer;
import java.util.AbstractCollection;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Ar... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | 410744c6e6fcc570d84ee60adc99bd76 | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.io.Writer;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.TreeMap;
impor... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | b067ae9367917fdc447133197af041e8 | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.io.Writer;
import java.io.InputStream;... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | 8d4581895dc6a9f24608eaeba13220bd | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.io.Writer;
import java.io.InputStream;... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | 0cc6b6190ef8ac52b40db77b40f31a53 | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.DataInputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.io.Wri... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | 39586a18a34f77e8f15e6f0e886588f8 | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.io.Writer;
imp... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | 5d62e9d79eb09a880ff280cfabe7babb | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.TreeMap;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.util.TreeSet... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | 09cd6ce5afb3c0c4a445ff94eb21dd55 | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | //package manthan;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
public class D {
IntReader in;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni();
int[] a = new int[n];
int[] b = new int[n];... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | 7186a45beae86e04319385fbc6efa264 | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | import java.util.Arrays;
import java.util.HashMap;
import java.io.*;
public class D {
static class Parser {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Parser(InputStream in) {
... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | cf295249b3eaaa92740ce3b2f6da5f90 | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | import java.io.*;
import java.util.*;
public class Opticheskiieksperiment {
static BufferedReader br = new BufferedReader(new InputStreamReader(
System.in));
static StringTokenizer in;
static PrintWriter out = new PrintWriter(System.out);
public static String nextToken() throws IOException {
while (in == n... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | 8694aa997fe97886631dd9144e3aa2af | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | //package manthan;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class D {
static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
static StringToken... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | 84fe18716cf084ee0e8291ec7a4d88d1 | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
/**
* Created by IntelliJ IDEA.
* User: piyushd
* Date: 3/13/11
* Time: 9:43 PM
* To change this template use File | Settings | File Templates.
*/
public class Task4 {
@SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"})
private fina... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | a0fb60c7dbd66cbe3649d5aba9a9b56c | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | /**
* Created by IntelliJ IDEA.
* User: piyushd
* Date: 3/13/11
* Time: 9:43 PM
* To change this template use File | Settings | File Templates.
*/
public class Task4 {
void run(){
int n = nextInt();
int[] x = new int[n];
int[] y = new int[n];
int[] M = new int[n + 1];
for(int i = 0; i < n; i++){
... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | 1837c1d43c6774ef761be26fe11e97fe | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/**
* Author -
* User: kansal
* Date: 3/15/11
* Time: 9:02 PM
* Contest: Manthan
*/
public class OpticalExperiment {
public static void main(String[] args... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | b84751c1b2d4e130dd42d056a04b5bcc | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;
public class Main {
public static void main(String[] args) throws IOException {
new Thread(null, new Runnable() {
public voi... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | 12e17e3dc8587b10f8529336090e08b6 | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes |
import java.awt.Point;
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Manthan2011_D implements Runnable {
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | 628aa89133d23f13502bc06099ec04ff | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes |
import java.awt.Point;
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Manthan2011_D implements Runnable {
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
void init() t... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | c6e20c50e2ca3b1f6d0b769f2c9084b7 | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
//package d_dinprog;
/**
*
* @author Катерина
*/
//package d;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String args[]) throws IOException {
boolean online = System.g... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | 4ec7177d68c93c3d44a5c9a659f9d9c3 | train_002.jsonl | 1300033800 | Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each h... | 256 megabytes | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
//package d_dinprog;
/**
*
* @author Катерина
*/
//package d;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String args[]) throws IOException {
boolean online = System.g... | Java | ["5\n1 4 5 2 3\n3 4 2 1 5", "3\n3 1 2\n2 3 1"] | 5 seconds | ["3", "2"] | NoteFor the first test case, the figure is shown above. The output of the first test case is 3, since the rays number 1, 4 and 3 are the ones which are intersected by each other one i.e. 1 is intersected by 4 and 3, 3 is intersected by 4 and 1, and 4 is intersected by 1 and 3. Hence every ray in this group is intersect... | Java 6 | standard input | [
"dp",
"binary search",
"data structures"
] | b0ef9cda01a01cad22e7f4c49e74e85c | The first line contains n (1 ≤ n ≤ 106), the number of rays. The second line contains n distinct integers. The i-th integer xi (1 ≤ xi ≤ n) shows that the xi-th ray enters from the i-th hole. Similarly, third line contains n distinct integers. The i-th integer yi (1 ≤ yi ≤ n) shows that the yi-th ray exits from the i-t... | 1,900 | Output contains the only integer which is the number of rays in the largest group of rays all of which intersect each other. | standard output | |
PASSED | 509efb9dc939b15c46cec8020a682dfc | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes | // Working program with FastReader
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.LinkedList;
import java.util.StringTokenizer;
public class Main
{
static int root(int i,int arr[]){
while(arr[i]... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | bb6f25bc700eaddb6021b1bdcd6d9c01 | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class CF1167C {
public static void main(String[] args) {
int n = fs.nextInt();
int m = fs.nextInt();
ArrayList<Integer> [] persons = new ArrayList[n];
while (m-... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | 5ed52945d3fd8668168aaa7e6164b6cd | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
public class C1167{
static class Reader
{
final private int B... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | e38c0f25504d4eca9637124725dd0b14 | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
public class C {
static fs eggo = new fs();
static int[] set;
static class fs{
BufferedReader br;
StringTokenizer st;
public fs(){
br = new Buffere... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | 60cb5df348f340aa4539fe921ff16cd4 | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class C {
void solve() throws IOException {
int n = nextInt();
DisjointSet ds = new DisjointSet(n);
int m = nextInt();
for (int i = 0;... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | d338d33172cf2f42cd79d07111abcf34 | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes | import java.io.*;
import java.util.*;
public class tr1 {
static PrintWriter out;
static StringBuilder sb;
static int inf = (int) 1e9;
static long mod = 998244353;
static int[]ans;
static HashSet<Integer>[]ad;
static boolean []vis;
public static void main(String[] args) throws IOException {
Scanner sc = new S... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | f8f1dffe44e74b4832293f9b9fd53943 | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
final static long MOD = 998244353;
static int[] size;
static int[] parent;
public static void main(String[] args) {
Reader in = new Reader();
int n = in.nextInt();
i... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | 44655bddd2df746e2f3965f009a70315 | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
public class Main
{
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bu... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | 7474e6fcb6b0cb208045027f4f13a041 | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes |
/*
* Remember a 6.0 student can know more than a 10.0 student.
* Grades don't determine intelligence, they test obedience.
* I Never Give Up.
* I will become Candidate Master.
* I will defeat Saurabh Anand.
* Skills are Cheap,Passion is Priceless.
*/
import java.util.*;
import java.util.Map.Entry;
import java.... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | e60850dc0a16786f0e98530d230c67c0 | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes |
import java.io.*;
import java.math.*;
import java.util.*;
public class Level {
public static DS.Scanner in = new DS.Scanner();
public static void main(String[] args) throws IOException {
int n = in.nextInt();
int m = in.nextInt();
DS.Graph graph = new DS.Graph(n);
DS.Print o... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | 17c495cd52c0ae1b22f4d58a71fb2bea | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main{
static int[] visited;
static int count = 0;
public static void dfs(TreeSet<Integer>[] graph,int u,int k){
visited[u] = k;
count++;
for (Integer i : graph[u]){
if (visited[i]==0){
dfs(graph, i,k);
... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | a773c06fc7d582c04cd607d501f99dd3 | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
public class abc {
static int[] parent;
static long[] rank;
static long[] size;
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader ... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | eab599851c29158208bc7c0a4e6ab394 | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class TaskF{
static ArrayList<Integer>g[];
static int comp[];
static int cComp = -1;
void dfs(int v){
comp[v] = cComp;
for (int i = 0; i < ... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | 8616888186f0dca5285acc5c10221eed | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes | //Author: Patel Rag
//Java version "1.8.0_211"
import java.util.*;
import java.io.*;
public class Main
{
static Vector<Integer> grp[] = new Vector[1000043];
static Vector<Integer> color = new Vector<>(1000043);
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader(){ b... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | f1e41f77b955af90d55f20c384c2faf1 | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes | //Author: Patel Rag
//Java version "1.8.0_211"
import java.util.*;
import java.io.*;
public class Main
{
static Vector<Integer> grp[] = new Vector[1000043];
static Vector<Integer> color = new Vector<>(1000043);
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream d... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | 0a7d42d13966e341506c4ae9bb769e5b | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 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;
import java.util.StringTokenizer;
public class CF1167CNewsDistribution {
static HashSet<Integer> done = new HashSet<>()... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | 141529328ed8b9a46b7c3de5b943e977 | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.StringTokenizer;
public class B {
static class Reader {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | 50385039e954751b1a465f3f09b8ecf7 | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.util.Scanner;
public class B {
public static class UnionFind {
private int[] keys;
private int[] size;
public UnionFind(int n) {
keys = new int[n];
size = new int[... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | eab2a01c04b2726f3de12bdbe2abf8e4 | train_002.jsonl | 1557930900 | In some social network, there are $$$n$$$ users communicating with each other in $$$m$$$ groups of friends. Let's analyze the process of distributing some news between users.Initially, some user $$$x$$$ receives the news from some source. Then he or she sends the news to his or her friends (two users are friends if the... | 256 megabytes |
import java.io.*;
import java.util.*;
//import javafx.util.*;
import java.math.*;
//import java.lang.*;
public class untitled
{
static class Pair{
int x;int y;
Pair(int x,int y){
this.x=x;
this.y=y;
}
}
static class sorting implements Comparator<Pair>{
... | Java | ["7 5\n3 2 5 4\n0\n2 1 2\n1 1\n2 6 7"] | 2 seconds | ["4 4 1 4 4 2 2"] | null | Java 8 | standard input | [
"dsu",
"dfs and similar",
"graphs"
] | a7e75ff150d300b2a8494dca076a3075 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 5 \cdot 10^5$$$) — the number of users and the number of groups of friends, respectively. Then $$$m$$$ lines follow, each describing a group of friends. The $$$i$$$-th line begins with integer $$$k_i$$$ ($$$0 \le k_i \le n$$$) — the number of u... | 1,400 | Print $$$n$$$ integers. The $$$i$$$-th integer should be equal to the number of users that will know the news if user $$$i$$$ starts distributing it. | standard output | |
PASSED | e2c65d94aff687a931d8e2ad090c805d | train_002.jsonl | 1545143700 | You are given a forest — an undirected graph with $$$n$$$ vertices such that each its connected component is a tree.The diameter (aka "longest shortest path") of a connected undirected graph is the maximum number of edges in the shortest path between any pair of its vertices.You task is to add some edges (possibly zero... | 256 megabytes | import java.util.*;
import java.io.*;
public class E527 {
static ArrayList<Integer> [] adj;
static int [] depth;
static int deepest, bestDepth;
static boolean [] vis;
static int [] parent;
public static void main(String[] args) {
MyScanner sc = new MyScanner();
PrintWriter out =... | Java | ["4 2\n1 2\n2 3", "2 0", "3 2\n1 3\n2 3"] | 2 seconds | ["2\n4 2", "1\n1 2", "2"] | NoteIn the first example adding edges (1, 4) or (3, 4) will lead to a total diameter of 3. Adding edge (2, 4), however, will make it 2.Edge (1, 2) is the only option you have for the second example. The diameter is 1.You can't add any edges in the third example. The diameter is already 2. | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"dfs and similar",
"trees"
] | 90cf88fde1c23b6f3a85ee75d3a6a3ec | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 1000$$$, $$$0 \le m \le n - 1$$$) — the number of vertices of the graph and the number of edges, respectively. Each of the next $$$m$$$ lines contains two integers $$$v$$$ and $$$u$$$ ($$$1 \le v, u \le n$$$, $$$v \ne u$$$) — the descriptions of t... | 2,000 | In the first line print the diameter of the resulting tree. Each of the next $$$(n - 1) - m$$$ lines should contain two integers $$$v$$$ and $$$u$$$ ($$$1 \le v, u \le n$$$, $$$v \ne u$$$) — the descriptions of the added edges. The resulting graph should be a tree and its diameter should be minimal possible. For $$$m =... | standard output | |
PASSED | 4cfbc114ca9d5a11d3093aa24473446c | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes | import java.util.*;
public class Main{
public static void main(String[]args){
Scanner input = new Scanner(System.in);
char[][] a = new char[input.nextInt()][input.nextInt()];
for(int i = 0; i < a.length; i++){
String s = input.next();
for(int j = 0; j < a[i].length; j... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | 68bb83bee232f35b05f8fc8f2f6cfdb4 | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes |
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class ProblemA_14 {
final boolean ONLINE_JUDGE=System.getProperty("ONLINE_JUDGE")!=null;
BufferedReader in;
PrintWriter out;
StringTokenizer tok=new StringTokenizer("");
void init() throws FileNotFoundException... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | d2f6f1f89170853c15e42f626e2babaa | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes | import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
public class Solution14A {
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE")!=null;
BufferedReader in;
PrintWriter out;
StringTokenizer tok =... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | c3126a1488b50c6a0a2840cfa33c3cd5 | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes |
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
char[][]a = new char [n][m];
for (int i = 0; i < n; i++) {
a[i] = sc.next().toCharArray();
... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | 37ab4b1e19165ed04a2bb125a38d3a73 | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes | import java.awt.Point;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
i... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | 6d89d38ccc9af7966ef279c4e11079c3 | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes | import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Main4 {
static class Main {
public Scanner sc;
public void run() {
int n = sc.nextInt(), m = sc.nextInt();
char[][] field = new char[n][];
... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | df1c5670559f9f50c5f5c2e702c6d0f5 | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes | import java.util.Scanner;
public class Letter {
public static void main(String[]args){
Scanner reader=new Scanner(System.in);
int n,m;
n=reader.nextInt();
m=reader.nextInt();
reader.nextLine();
int minCol = m, minRow = n, maxCol = 0, maxRow = 0;
String[]str=new String[n];
for(int i=0;i<n;i++){
str... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | 0c25fe87206a51fdc2567da55b66f73a | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes | import java.io.PrintWriter;
import java.util.Scanner;
public class Letter {
public static final int MX = 100;
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
PrintWriter output = new PrintWriter(System.out);
int n, m, mxl = MX, mxr = -1, mxu = M... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | da2f7ba6bcff416629e26751b116788d | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes | import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
int I=s.nextInt();
int J=s.nextInt();
char p[][]=new char[I][J];
int uMinI=I;
int uMinJ=J;
int uMaxI=0;
int uMaxJ=0;... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | fcb8ce82120749ea7f5c873479e01c44 | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes | import java.util.Scanner;
public class p14a {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
char[][] grid = new char[n][m];
for (int i = 0; i < grid.length; i++) {
String te = in.next();... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | e069cf26d04923e431a00aa421090fca | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes | import java.util.*;
public class Letter14A
{
public static void main(String[] args)
{
// Set up scanner
Scanner sc = new Scanner(System.in);
// System.out.println("Enter n");
int n = sc.nextInt();
// System.out.println("Enter m");
int m = sc.nextInt();
... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | 7d0f6d1ace7a179a5fe38dcd82f97319 | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes | import java.io.PrintWriter;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int m = in.nextInt();
in.nextLine();
cha... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | eb27d84bcf9c6683b168734998a1dd13 | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.StreamTokenizer;
import java.util.LinkedList;
public class Main {
/**
* @param args
... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | ad28c975d2f9265d1a83a29de1e5df51 | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int n, m;
n = cin.nextInt();
m = cin.nextInt();
cin.nextLine();
int x1 = 51, x2 = -1, y1 = 51, y2 = -1;
String[] s = new String[n];
... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | 294c1ababe7c23d531216f771e79ee78 | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes | import java.io.BufferedReader;
import static java.lang.Math.*;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.math.RoundingMode;
... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | 3033365488405a8b790a9a87f0a53ed5 | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes | import java.io.*;
import java.util.InputMismatchException;
import java.util.Scanner;
/**
* Created with IntelliJ IDEA.
* User: DOAN Minh Quy
* Date: 7/25/13
* Time: 12:45 PM
*/
public class Task14A {
public static void main(String[] args) {
new Task14A().run();
}
void run() {
Scanner ... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | ba9faaac63b7da21720027b0fc0fd6db | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes | //~ 20:38:19
import java.util.*;
import java.io.*;
public class Main{
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int[] p = toIntArray(br.readLine... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | 830aafc61b8d6ebd4679307900216a90 | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes | import java.util.*;
public class CBR14A {
static boolean testh(int i, String[] a) {
for (int j = 0; j <= a[i].length()-1; j++)
if (a[i].charAt(j) == "*".toCharArray()[0])
return false;
return true;
}
static boolean testv(int i, String[] a) {
for (int j = 0... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | 0f2c7e383176d42a3a855f07da785641 | train_002.jsonl | 1274283000 | A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world... | 64 megabytes |
import static java.lang.Math.*;
import java.util.Scanner;
@SuppressWarnings("unused")
public class round14A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
char [][] x = new char [n][m];
for(int i ... | Java | ["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..", "3 3\n***\n*.*\n***"] | 1 second | ["***\n*..\n***\n*..\n***", "***\n*.*\n***"] | null | Java 6 | standard input | [
"implementation"
] | d715095ff068f4d081b58fbfe103a02c | The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at lea... | 800 | Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better. | standard output | |
PASSED | 35473d2813063c7bd7dfb9b285701cac | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Soly
{
static final int INF = Integer.MAX_VALUE;
static int mergeSort(int[] a,int [] c, int begin, int end)
{
int ... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 43ad04bdcb057e5fd2bd4d269d495959 | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes |
import java.util.Scanner;
public class WaterBuyingTwo
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int q;
q=Integer.parseInt(in.nextLine().trim());
for(int i=0 ; i<q ; i++)
{
String[] temp = in.nextLine().split(" ");
costing(Lo... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 8597843e2833644076edcefc95d8aa9a | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
import java.awt.geom.*;
public class WaterBuy {
public static void main(String[] args) throws Exception {
MyScanner sc = new MyScanner();
int q=sc.ni();
while(q-->0){
long n = sc.nl();
long a = sc.nl();
... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 8555fa3d6e5489357c96851e8bee42e0 | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.util.*;
//Mann Shah [ DAIICT ].
public class Main {
public static void main(String[] Args) {
Scanner in = new Scanner(System.in);
int mod = 1000000007;
int q = in.nextInt();
while(q-->0) {
long n = in.nextLong();
int a = in.nextInt();
int b = in.nextInt();
long ans= n*a;
... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 37b1499db2064b4655af533aa6e21096 | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | //package CodeForces;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class waterBuying {
public static void main(String []args) throws Exception{
BufferedReader br=new BufferedReader(new InputStreamReader (System.in));
int q=Integer.parseInt(br.readLine());
while(q-->0) {
String[] s... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 6821d24d649360f90b8a0261acc591b9 | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.util.Scanner;
public class water {
static Scanner s= new Scanner (System.in);
public static void main(String [] args) {
int n=s.nextInt();
long i,liters,price1,price2,compare1=0,compare2=0;
for(i=0;i<n;i++) {
liters=s.nextLong();
price1=s.nextLong();
price2=s.nextLong();
if(liters==1)
System.ou... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | c6647daf900bc5018d89f7494e53331b | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | //package yahia;
import java.util.*;
public class Main {
public static void main (String []args) {
Scanner sc =new Scanner (System.in);
int n=sc.nextInt();
for (;n>0;--n) {
long q=sc.nextLong();int a=sc.nextInt();int b=sc.nextInt();
if (q%2==0) {
if (b>2*a) {
long w =a*q;
System.out.println(w);
}el... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 7385dfef4d66b92bcda6921f3d62fa0a | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | // package PCS;
import java.math.BigInteger;
import java.util.Scanner;
public class BuyWater {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
int queries = reader.nextInt();
for (int i=0;i<queries;i++) {
BigInteger water = new BigInteger(reade... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 5f3e804996fe054e5e84cb90d0247999 | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class A {
public static void main(String[] args) throws Exception {
//BufferedReader bufferedReader = new BufferedReader(new FileReader("input.txt"));
//Scanner scanner = new Scanner(bufferedReader);
//Scanner sc... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | b460b35ce22bee048db4a76102bccff0 | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.util.Scanner;
public class ProblemA {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int q = in.nextInt();
long n, a, b, result;
for (int i=0; i < q; i++) {
n = in.nextLong();
a = in.nextLong();
b = in.nextLong();
if (a <=... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 647ab8cf06f7a7fc1cc18b4b9bff4c2b | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.util.Scanner;
public class WaterBuy{
public static void main(String arg[]){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
long a[]=new long[n];
long t=0;
for(int i=0;i<n;i++){
long l=sc.nextLong();
long m=sc.nextLong();
long p=sc.nextInt();
if(m<=p/2||l<2){
//System.out.pr... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 398ee3ef8faa5dc55cdd45d1b67f6926 | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.lang.*;
import java.util.*;
public class water_buying{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int q=sc.nextInt();
for(int i=0;i<q;i++){
long n=sc.nextLong();
long a=sc.nextLong();
long b=sc.nextLong();
if((2*a)<b){
System.out.println(n*... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 61fef36cb946004efdc1ddd3bd8d4078 | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.util.*;
public class geek {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t=s.nextInt();
while(t-->0) {
long n = s.nextLong();
long a=s.nextLong();
long b=s.nextLong();
long min=Math.min(a,b);
... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 3ca0e56e2dd00fb4cf294fd1c5e43058 | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.util.*;
public class Waterbuying {
public long findMinCost(long n, int a, int b) {
if (b >= 2*a) {
return (long)a*n;
}
else {
return a*n + n/2*(b-2*a);
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Waterbuying w = new Waterbuyi... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | c7b683f932ee902c61915424d016cba4 | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.util.*;
public class Waterbuying {
public long findMinCost(long n, int a, int b) {
if (b >= 2*a) {
return (long)a*n;
}
else {
return a*n + n/2*(b-2*a);
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Waterbuying w = new Waterbuyi... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 315f6fcf1ae7e1f783905db721b26e3a | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int q = scan.nextInt();
for (int z = 0; z < q; z++) {
long n = scan.nextLong();
int a = scan.nextInt();
int b = scan.nextInt();
... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | d4acc1e1fc8bea2d3da39fba7fcd8529 | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.text.DecimalFormat;
import java.util.Scanner;
/**
* Title:CF540_Div3_WaterBuying Description:
*
* @author Susan Cappuccino
* @date 2019年2月20日下午7:01:45
* @version 1.0
*/
public class CF540_Div3_WaterBuying {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double nu... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | ec580c5c216625915eba819ac559fb35 | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int q = sc.nextInt();
double n, a, b, d;
for (int i = 0; i < q; i++) {
n = sc.nextDouble();
a = sc.nextDouble();
b = sc.nextDo... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 1335d91b6ad6edb35fc48437085e66ad | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.util.*;
import java.lang.*;
public class solution
{
public static void main(String[] args)
{
Scanner s= new Scanner(System.in);
int q=s.nextInt();
long n;
long a,b;
for(int i=0;i<q;i++)
{
n=s.nextLong();
a=s.nextLong();
... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | d22621988e57dce654dab5ba84f87f06 | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner s = new Scanner(System.in);
int z = s.nextInt();
for(int i = 0;i<z;i++){
long n = s.nextLong();long a = s.nextLong();long b = s.nextLong();
long minimum = 0;
if(b<2*a){
minimum =(n... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 88ae6d2c7de6015573d8efe9d14da33b | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
for(int i = in.nextInt();i > 0; i--){
long n = in.nextLong();
long a = in.nextLong();
long b = in.nextLong();
long ans = 0;
... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | a91a675c86291a13335afdf951ac54b8 | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.util.*;
public class Div2 {
public static void main(String args[]) {
Scanner in=new Scanner(System.in);
long q[]=new long[in.nextShort()], a,b;
long n,ax,bx;
for(short i=0;i<q.length;i++){
n=in.nextLong(); a=in.nextShort(); b=in.nextShort();
if(n==... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 19ebb8ae46c4232ae8efa1f39a4ba962 | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | import java.util.Scanner;
import java.lang.Math;
public class WaterBuyEdit {
private static long minCost (long n, long a, long b) {
return (n/2)*Math.min(2*a, b) + (n % 2) * a;
}
public static void main (String[] args) {
try (Scanner sc = new Scanner(System.in)) {
i... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 204d76240dbc2cd9cf2f8d0516928710 | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes | /* _____ ___
/\ /\ | | | | /\ /\ /\ /\ /\ /\ | \ محمد أبوحسن*
/ \ / \ | | |___| /__\ / \ / \ / \ / \ /__\ | \
/ \ / \ | | | | ... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 652e8b934269f1a56afd76c417d1a65c | train_002.jsonl | 1550586900 | Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ... | 256 megabytes |
/* _____ ___
/\ /\ | | | | /\ /\ /\ /\ /\ /\ | \ محمد أبوحسن*
/ \ / \ | | |___| /__\ / \ / \ / \ / \ /__\ | \
/ \ / \ | | | | ... | Java | ["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88"] | 1 second | ["10\n9\n1000\n42000000000000"] | null | Java 8 | standard input | [
"math"
] | beab56c5f7d2996d447320a62b0963c2 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. The next $$$q$$$ lines contain queries. The $$$i$$$-th query is given as three space-separated integers $$$n_i$$$, $$$a_i$$$ and $$$b_i$$$ ($$$1 \le n_i \le 10^{12}, 1 \le a_i, b_i \le 1000$$$) — how many liters Po... | 800 | Print $$$q$$$ integers. The $$$i$$$-th integer should be equal to the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n_i$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a_i$$$ burles and the bottle of the second type costs $$$b_i$$$ burles. | standard output | |
PASSED | 6cb20bdfaf032ad66b4eee89d4ffcbbb | train_002.jsonl | 1460729700 | You are given an undirected graph that consists of n vertices and m edges. Initially, each edge is colored either red or blue. Each turn a player picks a single vertex and switches the color of all edges incident to it. That is, all red edges with an endpoint in this vertex change the color to blue, while all blue edge... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
impo... | Java | ["3 3\n1 2 B\n3 1 R\n3 2 B", "6 5\n1 3 R\n2 3 R\n3 4 B\n4 5 R\n4 6 R", "4 5\n1 2 R\n1 3 R\n2 3 B\n3 4 B\n1 4 B"] | 1 second | ["1\n2", "2\n3 4", "-1"] | null | Java 8 | standard input | [
"dfs and similar",
"graphs"
] | 5bb8347fd91f00245c3acb4a5eeaf17f | The first line of the input contains two integers n and m (1 ≤ n, m ≤ 100 000) — the number of vertices and edges, respectively. The following m lines provide the description of the edges, as the i-th of them contains two integers ui and vi (1 ≤ ui, vi ≤ n, ui ≠ vi) — the indices of the vertices connected by the i-th e... | 2,200 | If there is no way to make the colors of all edges equal output - 1 in the only line of the output. Otherwise first output k — the minimum number of moves required to achieve the goal, then output k integers a1, a2, ..., ak, where ai is equal to the index of the vertex that should be used at the i-th move. If there ar... | standard output | |
PASSED | c96f9954d6f69a8c2a5eeb8935897683 | train_002.jsonl | 1460729700 | You are given an undirected graph that consists of n vertices and m edges. Initially, each edge is colored either red or blue. Each turn a player picks a single vertex and switches the color of all edges incident to it. That is, all red edges with an endpoint in this vertex change the color to blue, while all blue edge... | 256 megabytes | import java.io.*;
import java.util.*;
public class B {
FastScanner in;
PrintWriter out;
class Edge {
int to;
int color;
public Edge(int to, int color) {
super();
this.to = to;
this.color = color;
}
@Override
public String toString() {
return "Edge [to=" + to + ", color=" + color + "]";
... | Java | ["3 3\n1 2 B\n3 1 R\n3 2 B", "6 5\n1 3 R\n2 3 R\n3 4 B\n4 5 R\n4 6 R", "4 5\n1 2 R\n1 3 R\n2 3 B\n3 4 B\n1 4 B"] | 1 second | ["1\n2", "2\n3 4", "-1"] | null | Java 8 | standard input | [
"dfs and similar",
"graphs"
] | 5bb8347fd91f00245c3acb4a5eeaf17f | The first line of the input contains two integers n and m (1 ≤ n, m ≤ 100 000) — the number of vertices and edges, respectively. The following m lines provide the description of the edges, as the i-th of them contains two integers ui and vi (1 ≤ ui, vi ≤ n, ui ≠ vi) — the indices of the vertices connected by the i-th e... | 2,200 | If there is no way to make the colors of all edges equal output - 1 in the only line of the output. Otherwise first output k — the minimum number of moves required to achieve the goal, then output k integers a1, a2, ..., ak, where ai is equal to the index of the vertex that should be used at the i-th move. If there ar... | standard output | |
PASSED | 416ffc7804a7ec51d01fa63f005afae4 | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(in.readLine());
for (int counter = 1; counter <= t; counter++) {
... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | dc9cc9bc1de6e4674d6d2d17032c71aa | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.util.*;
public class asd
{
public static void main(String ars[])
{ ArrayList<String> Input = new ArrayList<String>();
Scanner s=new Scanner(System.in);
int t=s.nextInt();
while(t-->0)
{
... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | bec3abde5f10760876233a0e5e2e130d | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | //package cp;
import java.io.*;
import java.util.*;
public class CF {
static FastReader sc = new FastReader();
public static void main(String[] args) {
int t = sc.nextInt();
while (t-- > 0) {
solve();
}
//solve();
}
static void solve() {
int x0 = sc... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | 2f8e0bf8e82cae2c015d30fd44dab156 | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.util.*;
import java.io.*;
//***************** Agar firdaus bar roo-e zameen ast,Hameen ast-o hameen ast-o hameen ast. *****************\\
public class Main{
public static void main(String[] args)throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | ea8f25f91dfd4c271e7d906f5db8c7aa | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.lang.*;
public class MAin{
static int mod = 1000000007;
static InputReader in = new InputReader(System.in);
static PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args) ... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | 4fd930be2ec2b23e7297c888df62c56e | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
public class experiments
{
public static void main(String args[]) throws IOException
{
FastScanner fs = new FastScanner();
int T ... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | cb8cd8c1dc3759402d5b9f4c9ae6eea8 | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Contest665_B {
final static int MOD = (int) 1e9 + 7;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0){
long x1 = sc.nextLong(), y1 = sc.nextLong(), z1 = sc.... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | df8f24adbe3655e485c9aa3372927b7a | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Q1 {
private void solve(Scan scan, Print print) throws Exception {
int T = scan.nextInt();
while (T-- > 0) {
final int N=3;
int one[]=new int[N];
scan.next(one);
int two[]=new int[N];
scan.next(two);
long ans=0l;
if(one[0]>=two[2])
{
o... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | f85800a8eafed3af91a031190c79ba43 | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Q1 {
private void solve(Scan scan, Print print) throws Exception {
int T = scan.nextInt();
while (T-- > 0) {
final int N=3;
int a[]=new int[N];
scan.next(a);
int b[]=new int[N];
scan.next(b);
long ans=0l;
if(a[0]>=b[2])
{
a[0]-=b[2];
... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | d01658c92fe073a2f99e0fa3468a217d | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Q1 {
private void solve(Scan scan, Print print) throws Exception {
int T = scan.nextInt();
while (T-- > 0) {
final int N=3;
int a[]=new int[N];
scan.next(a);
int b[]=new int[N];
scan.next(b);
long ans=0l;
int m=Math.min(b[2], a[0]);
b[2]-=... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | 4c12d36d794ef5dc06faf0a97e9c428f | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.util.Scanner;
public class Scratch {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t =scanner.nextInt();
for (int i = 0; i <t ; i++) {
int x1=scanner.nextInt();
int y1=scanner.nextInt();
int z1=scanner.... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.