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 | 877c438e9c51e66a330e3a8813e9e80f | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.util.*;
public class Main {
public static void main(String[] arg) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] array = new int[n];
for(int i = 0; i < n; i++) array[i] = scan.nextInt();
boolean[] taken = new boolean[300005];
int ... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X β coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1ββ€βnββ€β300β000)Β β number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1,βp2,β...,βpn (1ββ€βpiββ€βn)Β β positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print nβ+β1 numbers a0,βa1,β...,βan, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 819b5c1a4b99a7feee3fcc50a7709dd8 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.util.*;
import java.io.*;
public class Solution {
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reader()
{
din = new Da... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X β coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1ββ€βnββ€β300β000)Β β number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1,βp2,β...,βpn (1ββ€βpiββ€βn)Β β positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print nβ+β1 numbers a0,βa1,β...,βan, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 063e82de7c9cfb9b7e63d7d3900b2994 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.*;
public class sortingcoings implements Runnable{
public static void main(String[] args) {
new Thread(null, new sortingcoin... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X β coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1ββ€βnββ€β300β000)Β β number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1,βp2,β...,βpn (1ββ€βpiββ€βn)Β β positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print nβ+β1 numbers a0,βa1,β...,βan, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | ca84d9d250029834c34001ab4cbb184d | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.InputMismatchException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 561c6c8b113f790b90f35cab7e26e4d5 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public class Solution {
public void solve() throws IOException {
int n = in.nextInt();
int[] a = in.nextInt... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | f01b78bdf9c40649b4df7ae121994472 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.*;
public class A {
public static void main(String [] args){
Scanner s = new Scanner(System.in);
final int n = s.nextInt();
final Queue<Integer> pos = new LinkedList<Integer>();
final Queue<Integer> neg = new LinkedList<Integer>();
final Queue<Integer> zero = new LinkedList<Integer>()... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 7763f2f2a8aaabe69bd7b0837bb04245 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.List;
import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author peneksglazami
*/
pub... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 18c71be95f54644d98b230cc813f9322 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.*;
public class A {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int[] arr = new int[n];
for(int i=0; i<n; i++) {
arr[i] = s.nextInt();
}
Arrays.sort(arr);
Vector<Integer> first = new Vector<Integer>();
... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 30dc7d4ea6812d7e2104ee18681d7af3 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.io.*;
import java.util.*;
public class solution
{
public static void main(String[] args) throws IOException
{
try
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int zero_cnt = 0;
int neg_cnt = 0;
int pos_cnt = 0;
int positive[] = new int[105];
int negative[] = new i... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 0cdd4d585c0fe1b507302b3ac6d1a704 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int f[] = new int [1000];
int s[] = new int [1000];
int t[] = new int [1000];
int l[] = new int [1000];
for (in... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 918d7a7fb5aaf1ef861e8024e4a85e37 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main{
public static void main(String[] args)throws Exception{
Scanner s = new Scanner(System.in);
int n = s.nextInt();
Vector<String> set = new Vector<String>();
for(int i=0;i<n;i++){
String num = s.nextInt()+""... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | ee2d65a3d42f1c5c0c4f236af960abcc | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int[] arr = new int[n];
for (int i = 0; i < arr.length; i++) {
arr[i] = s.... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 9bb61ba04df56b490f296cbbcc52a050 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.*;
public class cf300a {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
ArrayList<Integer> pos = new ArrayList<Integer>();
ArrayList<Integer> neg = new ArrayList<Integer>();
ArrayList<Integer> zero = new ArrayList<Integer>();
ArrayList<Integer> a = n... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 801b68b000cc8a3b4d245a34295ca193 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String args[]) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = t_int(br);
int[] a = t_int_a(br, n);
Arrays.sort(a);
List<Integer> neg = ... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 9f0c1b0f01f0da4be6a8055f49140e37 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class A {
/**
* @param args
*/
public static void main(String[] args) {
Parser p = new Parser(System.in);
PrintWriter... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 376223d71b0ecfc75a7ca1fb0879d156 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.*;
import java.io.*;
/**
*
* @author iweerarathna
*/
public class CF18101 {
public static void main(String[] args) throws Exception {
Scanner scan = new Scanner(System.in);
PrintWriter writer = new PrintWriter(System.out);
ArrayList<Integer> fc = new Ar... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 4210ca2752b89bb995d10fbe9c3ece2f | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
/*
br = new BufferedReader(new FileReader("input.txt"));
pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
br = new BufferedReader(new InputStreamReade... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | c22810f4b2477c6ba536546a7c20ce60 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class CFA {
private void work() throws IOException {
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(
System.in)));
while (sc.hasNextInt()) {
int n = sc.nextInt()... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 5635cfc041467597afd964c7940f48b7 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int a[]=new int [n];
int neg=0;
for(int i=0;i<n;i++){
a[i]=sc.nextInt();
if(a[i]<0)
neg++;
}
Arrays... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | e7a517f658c19fcaf193c6d9e65835d0 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class Main{
/**
* @param args
*/
public static void main(String[] args)throws Exception {
BufferedReader in = new BufferedReader (new InputStreamReader (Sys... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 1e581f595b5154fa77857bec8c50f1dc | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.*;
import java.io.*;
public class TaskA {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
//Scanner scanner = new Scanner(new File("D:\\develop\\1.txt"));
int n = scanner.nextInt();
ArrayList<Int... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | a565c362211b75e660b66da7e6f21847 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes |
import java.util.Arrays;
import java.util.Scanner;
import java.util.Vector;
public class Main{
public static void main(String[] args) {
int n;
Scanner in = new Scanner(System.in);
n = in.nextInt();
int []a = new int[n];
Vector<Integer> v = new Vector<Integer>();
... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | d1a74c3b6debef1ea8e1a6b6a39d3ca9 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.*;
import java.io.*;
public class Array
{
public static void main(String[]args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
int m = Integer.parseInt(br.readLine());
... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 6c67bbea94254aac73d91e8542290548 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | /* Codeforces Round #181 (Div. 2)
* Date: 25th April 2013
* Author - Arpit Gaur */
//package CodeForces;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Array {
public static void main(String[] args) throws Exception {
... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 71080c7b87bb061a2432953a464fae09 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
Arrays.sort(a);
int i1 = 0;
int i2 = 0;
int i3 ... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 0ee10d41ff447974fd9e82a67dbbd0c9 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
public class Main {
static int ans = 0;
static int inf = 100100100;
public static void main(String[] args){
Scanner in = new Scanner(new BufferedInputStream(System.in));
int n = in.nextInt();
int a[] = new int[n], b[] = new in... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 534465bfa2de4191cedcca7b384616e3 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class A {
BufferedReader reader;
StringTokenizer tokenizer;
PrintWriter out;
public void solve() throws IOException {
int N = nextInt(... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 68ab64e4a8a58b60b03b542c82c9e24f | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.io.*;
import java.util.*;
public class A2 {
void solve() throws IOException {
in("__std"); out("__std");
int n = readInt();
List<Integer> pos = new ArrayList<Integer>();
List<Integer> neg = new ArrayList<Integer>();
List<Integer> zer = new ArrayList<Integer>();... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 39b44bd2b6ec2f65480ee7c1333a253a | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes |
import java.io.BufferedInputStream;
import java.util.*;
import static java.lang.Math.*;
public class C300A {
boolean allowedDebug = true;
public void solve() throws Exception {
int n = ni();
Queue<Integer>[] set = new LinkedList[3];
for (int i = 0; i < set.length; i++) {
set[i] = new LinkedList<Intege... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | b83d0d9acac6277c5e4f59c1f146018f | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
/*
http://codeforces.com/problemset/problem/300/A
Sample test(s)
input
3
-1 2 0
output
1 -1
1 2
1 0
input
4
-1 -2 -3 0
output
1 -1
2 -3 -2
1 0
*/
public class Array {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 5cd93b083b14a6c8d848df661ea11b21 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | /**
* Created with IntelliJ IDEA.
* User: yuantian
* Date: 4/25/13
* Time: 10:31 AM
* Copyright (c) 2013 All Right Reserved, http://github.com/tyuan73
*/
import java.util.*;
public class Array181Div2 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 606a8f2541f95750f7e14462352a577d | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes |
//package massa181;
import java.util.Arrays;
import java.util.Scanner;
import java.io.*;
import java.util.*;
public class MassA181 {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
ArrayList<Integer> amin = new ArrayList<... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 033b5cac8f981c3b1d16ac1d50bac57b | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.awt.datatransfer.StringSelection;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.TreeSet;
public class A {
static Scanner in; static int next() throws Exception {return in.nextInt();};
// static StreamTokenizer in; static ... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | b2bf924ba15b0c3dbdd071af7d231e10 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
int k,x=0,y=0,z=0;
int n=scan.nextInt();
int[][] a = new int[3][n];
for(int i=0;i<n;i++){
k=scan.nextInt();
if(k==0) x++;
... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 8fadd7781acc43cfeb1770d142275007 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
*
* @author anton
*/
public class Mass {
public static void main(String[] args) throws IOException {
new Mass().start();
}
BufferedReader i... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 38555a526543a01d1c50337fe039580b | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main{
public static void main(String[]args) throws NumberFormatException, IOException {
BufferedReader x=new BufferedReader(new InputStreamReader(System.in));
String s=x.readLine();
String w=x.readL... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 691647dc1494aaec1fd93c70432f789a | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.*;
public class P300A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
ArrayList<Integer> positive = new ArrayList<Integer>();
ArrayList<Integer> negative = new ArrayList<Integer>();
int zero = 0;
f... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | c75bc622f599ee3992b5f069e53d1917 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
ArrayList<Integer> pos = new ArrayList<Integer>();
ArrayList<Integer> neg = new ArrayList<Integer>();
ArrayList<Integer> zero = new Arr... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 85c0879b03b04cfca871f45403e7a730 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class Array {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
Arra... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 21897643fdfca35f81f08894e18efcf6 | train_003.jsonl | 1366903800 | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (β<β0). The product of all numbers in the second set is greater than zero (β>β0). The product of all number... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int arr [] = new int[n];
for(int i = 0; i<n; i++) arr[i] = ... | Java | ["3\n-1 2 0", "4\n-1 -2 -3 0"] | 2 seconds | ["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"] | null | Java 6 | standard input | [
"constructive algorithms",
"implementation",
"brute force"
] | 03cf2cc26c84aab685ee78a1d6318b30 | The first line of the input contains integer n (3ββ€βnββ€β100). The second line contains n space-separated distinct integers a1,βa2,β...,βan (|ai|ββ€β103) β the array elements. | 1,100 | In the first line print integer n1 (n1β>β0) β the number of elements in the first set. Then print n1 numbers β the elements that got to the first set. In the next line print integer n2 (n2β>β0) β the number of elements in the second set. Then print n2 numbers β the elements that got to the second set. In the next... | standard output | |
PASSED | 8ffa50e13916814e4398ca1ecd12867a | train_003.jsonl | 1568554500 | Alan decided to get in shape for the summer, so he created a precise workout plan to follow. His plan is to go to a different gym every day during the next N days and lift $$$X[i]$$$ grams on day $$$i$$$. In order to improve his workout performance at the gym, he can buy exactly one pre-workout drink at the gym he is c... | 256 megabytes | // practice with kaiboy
import java.io.*;
import java.util.*;
public class CF1219D extends PrintWriter {
CF1219D() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1219D o = new CF1219D(); o.main(); o.flush();
}
int[] cc, iq;
int[] pq; int cnt;
boolean... | Java | ["5 10000\n10000 30000 30000 40000 20000\n20000\n5 2 8 3 6", "5 10000\n10000 40000 30000 30000 20000\n10000\n5 2 8 3 6"] | 1 second | ["5", "-1"] | NoteFirst example: After buying drinks on days 2 and 4 Alan can finish his workout plan. Second example: Alan cannot lift 40000 grams on day 2. | Java 11 | standard input | [
"data structures",
"greedy"
] | 71c2be7a502917395ad83b375b3ddad6 | The first one contains two integer numbers, integers $$$N$$$ $$$(1 \leq N \leq 10^5)$$$ and $$$K$$$ $$$(1 \leq K \leq 10^5)$$$ β representing number of days in the workout plan and how many grams he can lift before starting his workout plan respectively. The second line contains $$$N$$$ integer numbers $$$X[i]$$$ $$$(1... | 1,500 | One integer number representing minimal money spent to finish his workout plan. If he cannot finish his workout plan, output -1. | standard output | |
PASSED | 4fd095746b9b92bf149845a4baf82f85 | train_003.jsonl | 1538931900 | You are given $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$. Each of $$$a_i$$$ has between $$$3$$$ and $$$5$$$ divisors. Consider $$$a = \prod a_i$$$Β β the product of all input integers. Find the number of divisors of $$$a$$$. As this number may be very large, print it modulo prime number $$$998244353$$$. | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static class Scan {
private byte[] buf=new byte[1024];
private int index;
private InputStream in;
private int total;
public Scan()
{
in=System.in;
}
public int scan()throws IOExcepti... | Java | ["3\n9\n15\n143", "1\n7400840699802997", "8 \n4606061759128693\n4606066102679989\n4606069767552943\n4606063116488033\n4606063930903637\n4606064745319241\n4606063930904021\n4606065559735517", "3\n4\n8\n16"] | 1 second | ["32", "4", "1920", "10"] | NoteIn the first case, $$$a = 19305$$$. Its divisors are $$$1, 3, 5, 9, 11, 13, 15, 27, 33, 39, 45, 55, 65, 99, 117, 135, 143, 165, 195, 297, 351, 429, 495, 585, 715, 1287, 1485, 1755, 2145, 3861, 6435, 19305$$$Β β a total of $$$32$$$.In the second case, $$$a$$$ has four divisors: $$$1$$$, $$$86028121$$$, $$$86028157$$$... | Java 11 | standard input | [
"interactive",
"number theory",
"math"
] | 4ca7837d1ddf80f0bde4aac2fb37d60b | The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 500$$$)Β β the number of numbers. Each of the next $$$n$$$ lines contains an integer $$$a_i$$$ ($$$1 \leq a_i \leq 2\cdot 10^{18}$$$). It is guaranteed that the number of divisors of each $$$a_i$$$ is between $$$3$$$ and $$$5$$$. | 2,000 | Print a single integer $$$d$$$Β β the number of divisors of the product $$$a_1 \cdot a_2 \cdot \dots \cdot a_n$$$ modulo $$$998244353$$$. Hacks input For hacks, the input needs to be provided in a special format. The first line contains an integer $$$n$$$Β ($$$1 \leq n \leq 500$$$)Β β the number of numbers. Each of the ne... | standard output | |
PASSED | 68a17e2817433de6a798549e074dc0d3 | train_003.jsonl | 1538931900 | You are given $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$. Each of $$$a_i$$$ has between $$$3$$$ and $$$5$$$ divisors. Consider $$$a = \prod a_i$$$Β β the product of all input integers. Find the number of divisors of $$$a$$$. As this number may be very large, print it modulo prime number $$$998244353$$$. | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
i... | Java | ["3\n9\n15\n143", "1\n7400840699802997", "8 \n4606061759128693\n4606066102679989\n4606069767552943\n4606063116488033\n4606063930903637\n4606064745319241\n4606063930904021\n4606065559735517", "3\n4\n8\n16"] | 1 second | ["32", "4", "1920", "10"] | NoteIn the first case, $$$a = 19305$$$. Its divisors are $$$1, 3, 5, 9, 11, 13, 15, 27, 33, 39, 45, 55, 65, 99, 117, 135, 143, 165, 195, 297, 351, 429, 495, 585, 715, 1287, 1485, 1755, 2145, 3861, 6435, 19305$$$Β β a total of $$$32$$$.In the second case, $$$a$$$ has four divisors: $$$1$$$, $$$86028121$$$, $$$86028157$$$... | Java 11 | standard input | [
"interactive",
"number theory",
"math"
] | 4ca7837d1ddf80f0bde4aac2fb37d60b | The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 500$$$)Β β the number of numbers. Each of the next $$$n$$$ lines contains an integer $$$a_i$$$ ($$$1 \leq a_i \leq 2\cdot 10^{18}$$$). It is guaranteed that the number of divisors of each $$$a_i$$$ is between $$$3$$$ and $$$5$$$. | 2,000 | Print a single integer $$$d$$$Β β the number of divisors of the product $$$a_1 \cdot a_2 \cdot \dots \cdot a_n$$$ modulo $$$998244353$$$. Hacks input For hacks, the input needs to be provided in a special format. The first line contains an integer $$$n$$$Β ($$$1 \leq n \leq 500$$$)Β β the number of numbers. Each of the ne... | standard output | |
PASSED | 2cc7e163873d794b5fa0379256342bcc | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Main
{
static long mod=((long)1e9)+7;//toString
public static int gcd(int a,int b){if(b==0)return a;else return gcd(b,a%b);}
public static long pow_mod(long x,long y){long res=1;x=x%mod;while(y > 0){if((y & 1)==1)res=(res * x)%mod;y=y>>1... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 8 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | 81682d60b2c7014bb1d5c0c36b6ce3af | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.io.*;
import java.util.*;
public class utkarsh {
BufferedReader br;
PrintWriter out;
int spf[], z = (int)(1e7 + 123);
int[] play(int[] a, int n) {
int d[] = new int[z];
for(int x : a) {
while(spf[x] > 1) {
d[spf[x]]++;
x /= spf... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 8 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | 0a67211e76965f62838e0573e096e6f2 | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.BitSet;
import java.io.InputStream;
/**
* Built using CHelper... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 8 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | 43e6a65b816d1b4d29f6a5bd69250092 | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class ReducingFractions
{
public static void main(String[] args)
{ //Use Exhaustion
boolean debug = false;
FastReader sc = new FastReader();
int... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 8 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | a1bc107fc65e77f938c918ef0f11f465 | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.util.*;
import java.lang.*;
public class Solution {
public static void main (String args[]) throws Exception {
Scanner cin = new Scanner(System.in);
PrintWriter cout = new PrintWriter(System.out);
int numerator[] = new int... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 6 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | c888421ee4b1cff456f6abb674f957ca | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public cla... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 6 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | eb77001f21e75e107a5b3db19aa2cd67 | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.io.*;
import java.lang.Math;
import java.util.*;
public class Main
{
public BufferedReader in;
public PrintStream out;
public boolean log_enabled = true;
static int[] primes;
static int p_count;
public static void get_primes(int n)
{
primes = new int[1000000];
boolean[] v = new boolean[... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 6 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | 57a9d5e08243799455756cf5a42dd687 | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.max;
import static... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 6 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | 078d5802d43893b6576e901c8d5ae98e | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main{
BufferedReader in;
StringTokenizer str = null;
private String next() throws Exception{
if(str == null || !str.hasMoreElements())
str = new StringTokenizer(in.readLine());
return str.nextToken();
}
private int nextInt() throws Exception... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 6 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | f68e34cdd4b5d2bc155d98eb34b23143 | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.awt.Point;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.ArrayList;
import java.util.Arrays;
public class C {
st... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 6 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | dfa157845058a8e584d023c423c04809 | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class C137 {
BufferedReader reader;
StringTokenizer tokenizer;
PrintWriter out;
public static int[] generateLeastFactor(int num) {
... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 6 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | 380c86bdf5de8f153af069f6e0e83ac3 | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes |
import javax.jws.Oneway;
import java.io.*;
import java.math.BigInteger;
import static java.math.BigInteger.*;
import java.security.PublicKey;
import java.util.*;
public class Solution{
class C
{
int n;
int[]nums;
int[]pows;
int[][]r;
int[][]p;
public C(int n)... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 6 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | 9d672f02e5cdf4c1430122b989ff0644 | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in); // ΡΠΎΠ·Π΄Π°ΡΠΌ ΠΎΠ±ΡΠ΅ΠΊΡ ΠΊΠ»Π°ΡΡΠ° Scanner
int n = sc.nextInt();
int m = sc.nextInt();
int [] a = new int[n];
for(int i... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 6 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | 7332d9c62afd03ab928b5ab69fb921be | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution ... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 6 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | bfaf9d97f0529156373a58260440d25a | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class C {
final int SIZE = 10001000;
//final int SIZE = 10000;
int[] factor = new int [SIZE+1]; // οΏ½οΏ½οΏ½OοΏ½ΜfοΏ½οΏ½οΏ½οΏ½
int[] cntbo = new int [SIZE+1]; // οΏ½οΏ½οΏ½οΏ½ΜfοΏ½οΏ½οΏ½ΜpοΏ½x
int[] cntshi = new int [SIZE+1]; // οΏ½οΏ½οΏ½qοΏ½Μf... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 6 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | 9e3ace5ffa7b224c93e56ca6ab626a51 | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class C {
final int SIZE = 10001000;
//final int SIZE = 10000;
int[] factor = new int [SIZE+1]; // οΏ½οΏ½οΏ½OοΏ½ΜfοΏ½οΏ½οΏ½οΏ½
int[] cntbo = new int [SIZE+1]; // οΏ½οΏ½οΏ½οΏ½ΜfοΏ½οΏ½οΏ½ΜpοΏ½x
int[] cntshi = new int [SIZE+1]; // οΏ½οΏ½οΏ½qοΏ½Μf... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 6 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | 1b5660803e7e3cd95c666ee508b43dd1 | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;
public class C
{
static class Scanner
{
BufferedReader br;
StringTokenizer st;
... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 6 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | 76e0a510957c9aba50f2d496fb2542a4 | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.LinkedList;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;
public class C
{
static class Scanner
{
BufferedReader br;
StringTokenizer st;... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 6 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | 9c643335736a7d4ccc63dd80e1083c1d | train_003.jsonl | 1347291900 | To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned out that t... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Arrays;
public class C222 {
static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
static PrintWriter out = new PrintWri... | Java | ["3 2\n100 5 2\n50 10", "4 3\n2 5 10 20\n100 1 3"] | 2 seconds | ["2 3\n2 1\n1 1 1", "1 1\n20\n3"] | NoteIn the first test sample the numerator equals 1000, the denominator equals 500. If we reduce fraction 1000/500 by the greatest common divisor of the numerator and the denominator (by 500), we obtain fraction 2/1.In the second test sample the numerator equals 2000, the denominator equals 300. If we reduce fraction 2... | Java 6 | standard input | [
"implementation",
"number theory",
"sortings",
"math"
] | 01ac609133428a0074e8506786096e02 | The first input line contains two space-separated integers n, m (1ββ€βn,βmββ€β105) that show how many numbers the first set (the numerator) and the second set (the denominator) contain, correspondingly. The second line contains n space-separated integers: a1,βa2,β...,βan (1ββ€βaiββ€β107) β the numbers that are multiplied t... | 1,800 | Print the answer to the problem in the form, similar to the form of the input data. The number of values in the sets you print nout,βmout must satisfy the inequality 1ββ€βnout,βmoutββ€β105, and the actual values in the sets aout,βi and bout,βi must satisfy the inequality 1ββ€βaout,βi,βbout,βiββ€β107. Separate the values i... | standard output | |
PASSED | 26d57524927fd58ce2ca6adf14b1cad3 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;
public class l052 {
public static void main(String[] args) throws Exception {
// StringTokenizer stok = new StringT... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 1239fb0c8a0f796e6502c82950eaf1f8 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.PrintWriter;
import java.util.ArrayList;
public class B247
{
static class Scanner
{
BufferedReader br;
StringTokenizer tk=ne... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 98c7c64cbf89f96ee13143abdb819ff9 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 9ea18848b08dc1bd3a5de643a4d5c849 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.*;
import java.util.*;
/*
* Heart beats fast
* Colors and promises
* How to be brave
* How can I love when I am afraid to fall...
*/
//read the question correctly (is y a vowel? what are the exact constraints?)
//look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
public class Main... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 0833651d8b8a6f84ba7c596118e6de1d | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static int n;
static long dec[], inc[], cur[], ans = 0;
static ArrayList<Integer>[] graph;
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
n = sc.nextInt(... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 20a1d42399ff1194df9e8aa0363af0d5 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static int N;
public static long[] value, countP, countN;
public static ArrayList<ArrayList<Integer>> edges = new ArrayList<ArrayList<Integer>>();
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
N = s... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 6620246ee00c39b6c25230326c3514b6 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.util.ListIterator;
import java.util.LinkedList;
import java.io.DataInputStream;
import java.io.PrintWriter;
import java.io.FileInputStream;
import java.io.IOException;
public class Zerotreeeay
{
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | c2d2ffccdd57269c4741c0ab549770c7 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.util.PriorityQueue;
import java.util.Comparator;
import java.util.ListIterator;
import java.util.LinkedList;
import java.io.DataInputStream;
import java.io.PrintWriter;
import java.io.FileInputStream;
import java.io.IOException;
public class Zerotree
{
static class Reader
{
final private int BUFFER_SIZE... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 9528c95ec91ce3fd3e61810d04510c97 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
public final class ZeroTree {
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPo... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 561ed9bf8e71d21492df16d53a1568b1 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;
public class Main {
static List<Integer> [] g;
stat... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | b20681b3a03f9cd7f1ee88634592e7c9 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main
{
static ArrayList<ArrayList<Integer>> g =new ArrayList<>() ;
static long dp[][] =new long[(int)1e5][2] ,v[] =new long[(int)1e5] ;
public static void main(S... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 09b1d00df2f67f500f6a5c4caecaee00 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | //package com.a2onlinejudge.ladder.groupcontests.dec28_2016;
import java.io.*;
import java.util.*;
import java.util.List;
public final class ZeroTree
{
public static void main(String[] args)
{
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
Solver ... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | f5b8dea367542fae6f67b70eb6b0daeb | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | //package com.a2onlinejudge.ladder.groupcontests.dec28_2016;
import java.io.*;
import java.util.*;
import java.util.List;
public final class ZeroTree
{
public static void main(String[] args)
{
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
Solver ... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 4724e2ae762cf14d96e79f863edad41b | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
public static void main(String args[])throws Exception {
new A().f();
}
void f()throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
Linked... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 9802e4de4ede3bea7e6d37d8d1888675 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | // practice with rainboy
import java.io.*;
import java.util.*;
public class CF274B extends PrintWriter {
CF274B() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF274B o = new CF274B(); o.main(); o.flush();
}
int[] next, jj;
int l_ = 1;
int link(int l,... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 6cb36bf98b4222a368f83531b0579315 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.awt.Point;
public class Main {
static int mod=(int)1e9+7;
static int[] v;
static long[] min;
static long[] plus;
static LinkedList<Integer>[] ll;
public static void main(String[] args) throws Exception {
F... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | ef5570abcfc16a6f7cfbc27a53036c68 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.awt.Point;
public class Main {
static int mod=(int)1e9+7;
static int[] v;
static long[] min;
static long[] plus;
static LinkedList<Integer>[] ll;
public static void main(String[] args) throws Exception {
F... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | e1b80ae3db32a980ed453b68a523a15f | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHel... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 8e114db25c6619de882ab228900fb01f | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHel... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 2df1950e3befa1194dbb313585e2f7a6 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.IOException;
import java.io.OutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
public class Main{
static class BufferOutput {
private DataOutputStream dout;
final private int BUFFER_SIZE = 1 << 16;
private byte[] buffer;
private int pointer = 0;
pu... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | e22072ced6e8ea8e89e55a26fbc6cc8f | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
InputReader scn;
PrintWriter out;
String INPUT = "";
long ans = 0;
class node {
long p = 0, n = 0;
}
void solve() {
int n = scn.nextInt();
int[] from = new int[n - 1], to = new int[n - 1];
for (int i = 0; i < n - 1; i++) {
from[i] = scn.ne... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 91c2092a81931270e3d5ce4c40cae880 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.util.*;
public class ZeroTree {
private static HashMap<Integer, HashSet<Integer>>tree = new HashMap<Integer, HashSet<Integer>>();
private static long[] plus;
private static long[] minus;
private static long[] v;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = ... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 10683b34c77ee6e80383136cb3bfbbb9 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes |
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Stack;
public class ROUGH{
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 1b8f3b3176fef931f5f1c772e0fb2177 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.Map.Entry;
import java.lang.Math;
import java.math.BigInteger;
public class Problem {
long INF = Long.MAX_VALUE / 3;
int MODULO = 1000 * 1000 * 1000 + 2346;
List<Integer>[] graph;
boolean[] used;
int[] val;
void solve() throws IOException {
int n = rI();
... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 6ad04d214044775ee7eced203059f6d0 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
long MOD = 1000000007L;
int INF = 1000000001;
public class Obj implements Comparable<Obj>{
pu... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 8db66690483d54df915ff3c0eb408d76 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.util.*;
public class Solve{
public static Scanner sc=new Scanner(System.in);
public static void main(String args[]){
int n=sc.nextInt();
graph g=new graph();
for(int i=0;i<n-1;i++){
int a=sc.nextInt(),b=sc.nextInt();
g.addEdge(a, b);
}
for(int i=0;i<n;i++)
g.value.set(i+1, sc.nextLong()... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 8999637b6b8874482a9ce57253ad85bc | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class D {
static int N;
static ArrayList<Integer> Tree[];
static long[]... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 0e559e1c68daf7e3bcd5a2da257cf961 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Solution{
public static int n;
public static LinkedList<Integer>[] al;
public static long[] v;
public static long[] dfs(int no,int p){
long[] a = new long[2];
for(int x:al[no]){
if(x==p) continue;
... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | f05aa9a70dc97e46af647cb0534b6a4a | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class P274B
{
static ArrayList<Integer>[] graph;
static int[] parent, value;
public static void main(String[] args)
{
FastScanner scan = new FastScanner();
int n = scan.nextInt(... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | f9c323bbe0d346a9d0a07b34401fbf08 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class P274B
{
static ArrayList<Integer>[] graph;
static int[] parent, value;
public static void main(String[] args)
{
new Thread(null, new Runnable() {
public void run() {
... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 16e802083e5e2598c09ed752df846c66 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.StringTokeni... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | a637efb9c2e362d965338394e781c237 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
int n;
HashMap<Integer, List<Integer>> map = new HashMap<>();
long[] val;
int[] visited;
public void solve() throws IOException{
n = in.nextInt();
visited = new int[n + 1];
for(int i = 1; ... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | ac177b59849a63b02b92f894e8cd96bf | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public c... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 1cd7c3f88e4ecb563b349faa7ffb5405 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes |
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
public class B274 {
static int nodes ;
static List<Integer>[] graph;
static long[] values,pos,neg;
public static void main(String args[]) throws Exception {
Reader re... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | fb4928363232786d9655e9ccc042b2c7 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 3eab220435d8a8e74a49d45f5aea0371 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
public class Main
{
static long[] A;
static long[] inc;
static long[] dec;
public static void main(String[] args)throws IOException
{
Reader in = new Reader();
int n = in.nextInt(); A = new long[n]; inc = new long[n]; dec = new lon... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 9835d15a5a2fdc15cf52f70fabeaff75 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.util.*;
import java.io.*;
public class ZeroTree {
/************************ SOLUTION STARTS HERE ************************/
static ArrayList<Integer>[] adj;
static long v[];
static long delta[][]; // 0 - to increment, 1 - to decrement
// delta represents how many times does the c... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 4940ab42c531b9359de8f9498ef80329 | train_003.jsonl | 1361374200 | A tree is a graph with n vertices and exactly nβ-β1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T.You're given a tree w... | 256 megabytes | import java.awt.*;
import java.io.*;
import java.util.*;
public class Abc {
static ArrayList<Integer> adj[];
static long v[];
static long min[];
static long plus[];
public static void main(String[] args) {
FastReader sc = new FastReader();
int n=sc.nextInt();
adj=new ArrayLi... | Java | ["3\n1 2\n1 3\n1 -1 1"] | 2 seconds | ["3"] | null | Java 8 | standard input | [
"dp",
"dfs and similar",
"greedy",
"trees"
] | f3c26aa520f6bfa6b181ec40bde7ee1b | The first line of the input contains n (1ββ€βnββ€β105). Each of the next nβ-β1 lines contains two integers ai and bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) indicating there's an edge between vertices ai and bi. It's guaranteed that the input graph is a tree. The last line of the input contains a list of n space-separated integers v1... | 1,800 | Print the minimum number of operations needed to solve the task. Please, do not write the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.