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 | 030831fcbcf4345eb18a9bb2dc535e95 | train_002.jsonl | 1326899100 | A country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by these roads. According to some Super Duper Documents, Berland is protected by the Super Duper Missile... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;
public class Main {
public static void main(String[] args) throws IOException {
new Thread(null, new Runnable() {
public vo... | Java | ["4 6 1\n1 2 1\n1 3 3\n2 3 1\n2 4 1\n3 4 1\n1 4 2\n2", "5 6 3\n3 1 1\n3 2 1\n3 4 1\n3 5 1\n1 2 6\n4 5 8\n4"] | 2 seconds | ["3", "3"] | NoteIn the first sample the silos are located in cities 3 and 4 and on road (1, 3) at a distance 2 from city 1 (correspondingly, at a distance 1 from city 3).In the second sample one missile silo is located right in the middle of the road (1, 2). Two more silos are on the road (4, 5) at a distance 3 from city 4 in the ... | Java 6 | standard input | [
"data structures",
"graphs",
"dfs and similar",
"shortest paths"
] | c3c3ac7a8c9d2ce142e223309ab005e6 | The first line contains three integers n, m and s (2 ≤ n ≤ 105, , 1 ≤ s ≤ n) — the number of cities, the number of roads in the country and the number of the capital, correspondingly. Capital is the city no. s. Then m lines contain the descriptions of roads. Each of them is described by three integers vi, ui, wi (1 ≤ ... | 1,900 | Print the single number — the number of Super Duper Secret Missile Silos that are located in Berland. | standard output | |
PASSED | a63de93a4311b35e840c6ba003ce7d86 | train_002.jsonl | 1326899100 | A country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by these roads. According to some Super Duper Documents, Berland is protected by the Super Duper Missile... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
public class D... | Java | ["4 6 1\n1 2 1\n1 3 3\n2 3 1\n2 4 1\n3 4 1\n1 4 2\n2", "5 6 3\n3 1 1\n3 2 1\n3 4 1\n3 5 1\n1 2 6\n4 5 8\n4"] | 2 seconds | ["3", "3"] | NoteIn the first sample the silos are located in cities 3 and 4 and on road (1, 3) at a distance 2 from city 1 (correspondingly, at a distance 1 from city 3).In the second sample one missile silo is located right in the middle of the road (1, 2). Two more silos are on the road (4, 5) at a distance 3 from city 4 in the ... | Java 6 | standard input | [
"data structures",
"graphs",
"dfs and similar",
"shortest paths"
] | c3c3ac7a8c9d2ce142e223309ab005e6 | The first line contains three integers n, m and s (2 ≤ n ≤ 105, , 1 ≤ s ≤ n) — the number of cities, the number of roads in the country and the number of the capital, correspondingly. Capital is the city no. s. Then m lines contain the descriptions of roads. Each of them is described by three integers vi, ui, wi (1 ≤ ... | 1,900 | Print the single number — the number of Super Duper Secret Missile Silos that are located in Berland. | standard output | |
PASSED | c965b348dece06d5cade3bdbe303804c | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | import java.io.*;
//import java.util.*;
public class PC_499 {
public static void main(String[] args) throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(in.readLine());
int m=Integer.parseInt(in.readLine());
int[] a=new... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 11 | standard input | [
"binary search",
"greedy",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | b24c1a2db47ee499f4d7eb3484d67fd6 | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes |
import java.util.*;import java.io.*;import java.math.*;
public class Main
{
public static void process()throws IOException
{
int n=ni();
double wt=nd(),a[]=new double[n],b[]=new double[n],k=1.0d;
for(int i=0;i<n;i++) a[i]=nd();
for(int i=0;i<n;i++) b[i]=nd... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 11 | standard input | [
"binary search",
"greedy",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | 16d007184746408c8b5c1ae3e59be2ba | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | import java.util.*;
import java.io.*;
public class Q2
{
static Print print;
public static void main(String args[]) throws Exception
{
Scan scan = new Scan();
print = new Print();
int N=scan.scanInt();
double M=scan.scanDouble();
double temp=M;
double arr[][]=new double[N][2];
for(int i=0;i<N;i++)
{... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 11 | standard input | [
"binary search",
"greedy",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | 4f661b01b1ff695b717dcf515ff3dd4e | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | import java.util.*;
public class ewmath3attackofthebinarysearch {
public static void main(String[] args) {
Scanner msc = new Scanner(System.in);
int planets = msc.nextInt();
int cargo = msc.nextInt();
int[] takeOff = new int[planets];
int[] landing = new int[planets];
for(int i = 0 ; i < planets ; i++){... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 11 | standard input | [
"binary search",
"greedy",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | 3d72a4d9eb04cac2998aaa648c895ada | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | // package cp;
import java.io.*;
import java.util.*;
public class Cf_three {
public static void main(String[] args) throws IOException {
PrintWriter out = new PrintWriter(System.out);
Readers.init(System.in);
int n=Readers.nextInt();
int m=Readers.nextInt();
long[] a=new long[n];
long[] b=new long[n];
f... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 11 | standard input | [
"binary search",
"greedy",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | b4fe01ed172ee3229c3dff2a8de9d742 | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | import java.util.*;
public class fly{
static int numPlanet;
static int weight;
static int [] arrTakeoff;
static int [] arrLanding;
public static void main (String args []){
Scanner sc = new Scanner(System.in);
numPlanet = sc.nextInt();
weight = sc.nextInt();
... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 11 | standard input | [
"binary search",
"greedy",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | 3c34e96c4e6b3774b66589f7a7954afa | train_002.jsonl | 1557844500 | You are given two arrays $$$a$$$ and $$$b$$$, both of length $$$n$$$.Let's define a function $$$f(l, r) = \sum\limits_{l \le i \le r} a_i \cdot b_i$$$.Your task is to reorder the elements (choose an arbitrary order of elements) of the array $$$b$$$ to minimize the value of $$$\sum\limits_{1 \le l \le r \le n} f(l, r)$$... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Random;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main
{
static final long MOD=99824... | Java | ["5\n1 8 7 2 4\n9 7 2 9 3", "1\n1000000\n1000000", "2\n1 3\n4 2"] | 2 seconds | ["646", "757402647", "20"] | null | Java 8 | standard input | [
"sortings",
"greedy",
"math"
] | 93431bdae447bb96a2f0f5fa0c6e11e0 | The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$ and $$$b$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$. The third line of... | 1,600 | Print one integer — the minimum possible value of $$$\sum\limits_{1 \le l \le r \le n} f(l, r)$$$ after rearranging elements of $$$b$$$, taken modulo $$$998244353$$$. Note that you should minimize the answer but not its remainder. | standard output | |
PASSED | 8c84fb68c9f5f17cbbed5f231761fc28 | train_002.jsonl | 1557844500 | You are given two arrays $$$a$$$ and $$$b$$$, both of length $$$n$$$.Let's define a function $$$f(l, r) = \sum\limits_{l \le i \le r} a_i \cdot b_i$$$.Your task is to reorder the elements (choose an arbitrary order of elements) of the array $$$b$$$ to minimize the value of $$$\sum\limits_{1 \le l \le r \le n} f(l, r)$$... | 256 megabytes | import java.awt.image.AreaAveragingScaleFilter;
import java.io.*;
import java.math.BigInteger;
import java.sql.Array;
import java.util.*;
import java.util.StringTokenizer;
public class l{
static class pair implements Comparable<pair>{
int v,idx;
static int n;
pair(int a ,int b,int n){
... | Java | ["5\n1 8 7 2 4\n9 7 2 9 3", "1\n1000000\n1000000", "2\n1 3\n4 2"] | 2 seconds | ["646", "757402647", "20"] | null | Java 8 | standard input | [
"sortings",
"greedy",
"math"
] | 93431bdae447bb96a2f0f5fa0c6e11e0 | The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$ and $$$b$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$. The third line of... | 1,600 | Print one integer — the minimum possible value of $$$\sum\limits_{1 \le l \le r \le n} f(l, r)$$$ after rearranging elements of $$$b$$$, taken modulo $$$998244353$$$. Note that you should minimize the answer but not its remainder. | standard output | |
PASSED | cafd5574e78b3fc472f1469f9dd9face | train_002.jsonl | 1557844500 | You are given two arrays $$$a$$$ and $$$b$$$, both of length $$$n$$$.Let's define a function $$$f(l, r) = \sum\limits_{l \le i \le r} a_i \cdot b_i$$$.Your task is to reorder the elements (choose an arbitrary order of elements) of the array $$$b$$$ to minimize the value of $$$\sum\limits_{1 \le l \le r \le n} f(l, r)$$... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
FastReader input=new FastReader();
PrintWriter out=new PrintWriter(System.out);
int T=1;
while(T-->0)
{
int n=input.nextInt();
long a[]=new long[n];
... | Java | ["5\n1 8 7 2 4\n9 7 2 9 3", "1\n1000000\n1000000", "2\n1 3\n4 2"] | 2 seconds | ["646", "757402647", "20"] | null | Java 8 | standard input | [
"sortings",
"greedy",
"math"
] | 93431bdae447bb96a2f0f5fa0c6e11e0 | The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$ and $$$b$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$. The third line of... | 1,600 | Print one integer — the minimum possible value of $$$\sum\limits_{1 \le l \le r \le n} f(l, r)$$$ after rearranging elements of $$$b$$$, taken modulo $$$998244353$$$. Note that you should minimize the answer but not its remainder. | standard output | |
PASSED | 95c4ca8236f0a8dd4f96cf0b5bc093bd | train_002.jsonl | 1557844500 | You are given two arrays $$$a$$$ and $$$b$$$, both of length $$$n$$$.Let's define a function $$$f(l, r) = \sum\limits_{l \le i \le r} a_i \cdot b_i$$$.Your task is to reorder the elements (choose an arbitrary order of elements) of the array $$$b$$$ to minimize the value of $$$\sum\limits_{1 \le l \le r \le n} f(l, r)$$... | 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.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper... | Java | ["5\n1 8 7 2 4\n9 7 2 9 3", "1\n1000000\n1000000", "2\n1 3\n4 2"] | 2 seconds | ["646", "757402647", "20"] | null | Java 8 | standard input | [
"sortings",
"greedy",
"math"
] | 93431bdae447bb96a2f0f5fa0c6e11e0 | The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$ and $$$b$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$. The third line of... | 1,600 | Print one integer — the minimum possible value of $$$\sum\limits_{1 \le l \le r \le n} f(l, r)$$$ after rearranging elements of $$$b$$$, taken modulo $$$998244353$$$. Note that you should minimize the answer but not its remainder. | standard output | |
PASSED | a7c610c99cf84a73143d525d30d2b7bc | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.AbstractCollection;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.uti... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | bf5098882c437fac3cfc46a3f99e91a9 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.AbstractCollection;
import java.util.StringTokenizer;
import java.io.Buffer... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | c9d002729d9981b6ff4de6e570ea2666 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static Scanner sc = new Scanner(System.in);
static PrintWriter out = new PrintWriter(System.out);
static final int INF = (int) 1e9 + 10;
static ArrayList<Integer> adj[];
static int[] bfs(int n, int s) {
Queue<Integer> q = new LinkedList<>();
int[] dis... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | d922455b3f7dcf4de7d7a4bb24dd8407 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.*;
import java.util.*;
@SuppressWarnings("unchecked")
public class Problem_E {
static final long INF = Long.MAX_VALUE / 2;
static int N, M, A, B, C;
static List<Integer>[] G;
public static int[] bfs(int S) {
int[] d = new int[N + 1];
Arrays.fill(d, -1);
Queue<Integer> q = new LinkedList<>();
... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | e913d86f0ec6c8de074572dc228f2a32 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.StringTokenizer;
public class Round636E {
public static Linked... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | ecd51e220667320d3bb55eb09c383875 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.util.*;
import java.io.*;
public class E {
static class Reader {
BufferedReader br;
StringTokenizer st;
public Reader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreEleme... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | 358dd2f6497c5bc540e3428eb1e2d073 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.awt.Point;
public class Main {
//static final long MOD = 998244353L;
//static final long INF = 1000000000000000007L;
static final long MOD = 1000000007L;
static final int INF = 1000000007;
public static void main(String[] args) {
FastScann... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | c88493158820ea5627cf24cf50fb8a59 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | // Utilities
import java.io.*;
import java.util.*;
public class Main {
static int T, N, M, a, b, c;
static ArrayList<Integer>[] adj;
static int[] da, db, dc;
static long[] p, s;
static long min;
public static void main(String[] args) throws IOException {
T = in.iscan();
for (int t = 0; t < T; t++) {
N = ... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | 4b47dcf75d1911cb56f821fb3a6f0794 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 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.InputMismatchException;
import java.io.IOException;
import java.util.Random;
import java.io.InputStream;
/**
* Built using CHelper plug-in Actual solution is at th... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | f5da049c91ce6704b5e5677689e344a3 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | /*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
impor... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | 361f22d8725636bcb40b7aa1d9702e5a | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | /*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
impor... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | 10de94a045ae243145f2dff1329aa9d6 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class E636{
public static void bfs(ArrayList<Integer> adj[],int src,int dist[],int n){
boolean vis[]=new boolean[n+1];
Queue<Integer> q=new LinkedList<Integer>();
vis[src]=true;
q.add(src);
dist[src]=0;
while(!q.isEmpty()){
int v=q.poll();... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | e0bb0d73fc8f92c98e8568420370b168 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
static int MOD = 1000000007;
public static void main(String[] args) throws IOException {
... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | 4535ad5bcb899837385c4be4255edacd | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
//Solution by Sathvik Kuthuru
public static void main(String[] args) {
FastReader scan = new FastReader();
PrintWriter out = new PrintWriter(System.out);
Task solver = new Task();
int t = scan.nextInt();
for(int tt =... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | bd183b936fc87964635661ed131b5bc9 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | // Working program with FastReader
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Problem5
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = ne... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | ed173fcc22d0d4079b5d97b3296c4ee4 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
static class Pair implements Comparable<Pair>{
int a;
int b;
public Pair(int x,int y){a=Math.min(x, y);b=Math.max(x, y);}
public Pair(){}
public int compareTo(Pair p){
return p.a - a;
}
@Override
public int hashCode... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | 4124f5f637a2ce6269e8041c440f2774 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static PrintWriter out = new PrintWriter(System.out);
static Scanner sc = new Scanner(System.in);
static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
long mod = 998244353;
long inv2 =1;
int step = 1;
... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | 450e3c658ca5dc47ac6c219989b7af3f | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 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.Collection;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | 55b23dc75ef0ead20dd65b5b28f005fb | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.*;
public class Main {
InputStream is;
PrintWriter out;
String INPUT = "";
//class Declaration
static class pair implements Comparable<pair>{
int x;
int y;
... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | 2158cfdeb12174f644f10d48045d8a4a | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class A {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | 1db60fa4ab7cd81d37b512484ad73977 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.List;
public class Main {
InputStream is;
PrintWriter o... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | e67e6e5c1b02560ff6847a0ab3ff53a4 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {new Main().run();}
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(System.out);
void run(){
for(int q=ni();q>0;q--) {
work();
}
out.flush();
}
long mod=998244353L;
long inf=Long.MAX_VA... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | d3c84d72b9c689ac2b06a683f8252525 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.net.Inet4Address;
import java.util.*;
import java.lang.*;
import java.util.HashMap;
import java.util.PriorityQueue;
public class Solution implements Runnable
{
static class pair implements Comparable
{
int f;
... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | a690edb379eeae199041724de4d8ed15 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.*;
import java.text.*;
import java.util.*;
import java.math.*;
public class template {
public static void main(String[] args) throws Exception {
new template().run();
}
public void run() throws Exception {
FastScanner f = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int as... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | c50dda727c18661ebe079589e409b0cc | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.*;
import java.nio.CharBuffer;
import java.util.*;
public class P1343E {
public static void main(String[] args) {
SimpleScanner scanner = new SimpleScanner(System.in);
PrintWriter writer = new PrintWriter(System.out);
int caseNum = scanner.nextInt();
while (caseNum-... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | d3bea457ebba46fac876b102cc913ab3 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | 507d084edd4821c8086dc87ac4e7447d | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.*;
import java.nio.charset.Charset;
import java.util.*;
public class run {
public static void main(String args[]) throws IOException {
InputReader in = new InputReader(System.in);
PrintWriter pw = new PrintWriter(System.out);
int tc = in.nextInt();
while ((tc--) > 0... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | eaf95bf0d509f0e1219589f55b3284a3 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
public class Solution {
public static void main(String[] args) throws IOException {
BufferedR... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | d59f6929d1cc0d10394cb8f1ec35260a | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.util.*;
import java.io.*;
public class E {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(in.readLine());
for (int i = 0; i < t; i++) {
StringTokenizer token = new StringTokenizer(in.re... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | d7203483e4f7659e362f90269ad836b2 | train_002.jsonl | 1587479700 | You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts).Mike has planned a trip from the vertex (district) $$$a$$... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Main implements Runnable
{
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
... | Java | ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7"] | 2 seconds | ["7\n12"] | NoteOne of the possible solution to the first test case of the example:One of the possible solution to the second test case of the example: | Java 8 | standard input | [
"greedy",
"graphs",
"shortest paths",
"sortings",
"brute force"
] | 89be93cb82d9686ff099d156c309c146 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains five integers $$$n, m, a, b$$$ and $$$c$$$ ($$$2 \le n \le 2 \cdot 10^5$$$, $$$n-1 \le m \le min(\frac{n(n-1)}{2}, 2 \cdot 10^5)$$$, $$$1... | 2,100 | For each test case, print the answer — the minimum possible price of Mike's trip if you distribute prices between edges optimally. | standard output | |
PASSED | bb5651f23bc6a27ef724544d17299037 | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Problem_850B {
static InputReader in = new InputReader(System.in);
static PrintWriter out = new PrintWriter(System.out);
static int M = 2000000 + 10;
static int[] cnt = new int[M];
static long[] sum = new long[M];
public sta... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | 337b15448dc5afe5db2e0e28e3eaa986 | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.io.*;
import java.util.*;
public class B850 {
public static void main(String[] args) throws IOException {
IO io = new IO(System.in);
int max_a = 1000005;
ArrayList<Integer> primes = sieve(max_a);
int n = io.nextInt();
int x = io.nextInt(); // delete
int y = io.nextInt(); // increment
... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | 09d40b4fc626ded080795d2ada113b51 | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
static InputReader in = new InputReader(System.in);
static PrintWriter out = new PrintWriter(System.out);
static int M = 2000000 + 10;
static int[] cnt = new int[M];
static long[] sum = new long[M];
public static void... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | 6b73e9a25ff6021c282c28b5e95a2dce | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;
/**
* Built using CHelper p... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | dd02a9303360b0f31e2aaca246c306ad | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Main{
public static long getSum(int from, int to, long[] pref){
if(from <=0){
return pref[to];
} else {
return pref[to]-pref[from-1];
}
}
public static long count(long p, long[] pref, long[] sums, long x, long y){
... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | 7724eb747bf9b62e0c51e3691c146c6d | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution {
static MyScanner sc;
private static PrintWriter out;
public static void main(String[] s) throws Exception {
sc = new MyScanner(System.in);
// sc = new MyScanner(new BufferedReader(new StringReader("4 20 10 1 2 3 4")));
// ... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | ce9b816a2c6f4a860b39fb2e43b138de | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces850B {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
StringTokenizer st = new StringTokenizer(br.readLine());
int n... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | d535c3a802ac385d7a09189f4f8ac8df | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
/**
* Created by fly on 9/4/17.
*/
public class Main {
public static int mod = 1_000_000_007;
public static int size = 2_000_000;
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter out = ne... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | 3c65d4de2c8e23c5c74be68a58917a85 | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class Main {
static BufferedReader reader;
static StringTokenizer tokenizer;
static PrintWriter writer;
static String nextTo... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | 9c4fcb5b0e3c3005c38b223900088ae8 | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.io.*;
import java.util.*;
public class Template implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
void init() throws FileNotFoundException {
try {
in = new BufferedReader(new FileReader("input.txt"));
o... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | 0cdf208ba281e6ac7f881e888046679c | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class b implements Runnable {
PrintWriter out;
int M, n;
int[] arr;
long x, y, counts[], sums[];
public void main() throws Throwable {
FastScanner in = new FastScanner(System.in);
out = new PrintWriter(System.... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | 6855803a69b4c5d64c5af20cf2f962a4 | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 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.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | 82f09a939bc84644c6dc5416b6ace5d5 | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Bit... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | 409bb990d75b0d3e9fd5ee19a0e5c87b | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Bit... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | 45afe57ffddd0a3298cb075b87b4fd12 | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 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.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | 9ab5dee9110c971f283d8987f6763993 | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Main implements Runnable
{
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFi... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | b4c88917782dc3c4164b8bdda75f9a85 | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
publi... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | 8feda624cc4d890b6829eb6544b1b6e6 | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.io.*;
import java.util.*;
public class B {
static final int N = 1_000_010;
void submit() {
int n = nextInt();
int del = nextInt();
int inc = nextInt();
int len = del / inc;
int[] cnt = new int[N];
for (int i = 0; i < n; i++) {
int x = nextInt();
cnt[x]++;
}
int... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | a5618ca709f2f852e5fd9089c16de8a9 | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.Buff... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | 987a16e4cad2b3f1c83f325e7215e929 | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.Buff... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | 5220b47babd677e726ccca627ec6db04 | train_002.jsonl | 1504535700 | Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can perform two types of operations: Choose a number and delete it with cost x. Choose a number and increase it by 1 with cost y. Arpa can ap... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {new Main().run();}
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(System.out);
void run(){
work();
out.flush();
}
long mod=1000000007;
void work() {
int n=in.nextInt();
long x=in.nextL... | Java | ["4 23 17\n1 17 17 16", "10 6 2\n100 49 71 73 66 96 8 60 41 63"] | 2 seconds | ["40", "10"] | NoteIn example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd here. | Java 8 | standard input | [
"implementation",
"number theory"
] | 41a1b33baa83aea57423b160247adcb6 | First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y. Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list. | 2,100 | Print a single integer: the minimum possible cost to make the list good. | standard output | |
PASSED | e52bb80ddd730e8c6a6ef5eb7ab05f1d | train_002.jsonl | 1304485200 | Polycarp loves not only to take pictures, but also to show his photos to friends. On his personal website he has recently installed a widget that can display n photos with the scroll option. At each moment of time the widget displays exactly one photograph with the option showing the previous/next one. From the first p... | 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 java.util.regex.*;
/*
br = new BufferedReader(new FileReader("input.txt"));
pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
br = new ... | Java | ["4 3\n1 3 5", "10 2\n5 5", "10 3\n1 10 3"] | 2 seconds | ["3 1 3 2", "2 1 2 1 2 1 2 1 2 1", "-1"] | null | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 2e99f0b671c80da1e768fa9bc7796481 | The first line contains two integers n and m (3 ≤ n ≤ 1000, 1 ≤ m ≤ 40), where n is the number of photos on the widget, and m is the number of albums. The second line contains m integers a1, a2, ..., am (1 ≤ ai ≤ 1000), where ai is the number of photos in the i-th album. | 2,100 | Print the single number -1 if there is no solution. Otherwise, print n numbers t1, t2, ..., tn, where ti represents the number of the album of the i-th picture in the widget. The albums are numbered from 1 in the order of their appearance in the input. If there are several solutions, print any of them. | standard output | |
PASSED | 5063ebf211446ca5307f57dd19eefcd4 | train_002.jsonl | 1304485200 | Polycarp loves not only to take pictures, but also to show his photos to friends. On his personal website he has recently installed a widget that can display n photos with the scroll option. At each moment of time the widget displays exactly one photograph with the option showing the previous/next one. From the first p... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class CodeF
{
static class Scanner
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer("");
public String next... | Java | ["4 3\n1 3 5", "10 2\n5 5", "10 3\n1 10 3"] | 2 seconds | ["3 1 3 2", "2 1 2 1 2 1 2 1 2 1", "-1"] | null | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 2e99f0b671c80da1e768fa9bc7796481 | The first line contains two integers n and m (3 ≤ n ≤ 1000, 1 ≤ m ≤ 40), where n is the number of photos on the widget, and m is the number of albums. The second line contains m integers a1, a2, ..., am (1 ≤ ai ≤ 1000), where ai is the number of photos in the i-th album. | 2,100 | Print the single number -1 if there is no solution. Otherwise, print n numbers t1, t2, ..., tn, where ti represents the number of the album of the i-th picture in the widget. The albums are numbered from 1 in the order of their appearance in the input. If there are several solutions, print any of them. | standard output | |
PASSED | af2228418f64f3c3a3f3bbad34abaf33 | train_002.jsonl | 1304485200 | Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he rushes to correct it. For example, number sequence written like "1,2 ,3,..., 10" will be corrected ... | 256 megabytes | // practice with kaiboy
import java.io.*;
import java.util.*;
public class CF81B extends PrintWriter {
CF81B() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF81B o = new CF81B(); o.main(); o.flush();
}
void main() {
byte[] aa = sc.nextLine().getBytes... | Java | ["1,2 ,3,..., 10", "1,,,4...5......6", "...,1,2,3,..."] | 2 seconds | ["1, 2, 3, ..., 10", "1, , , 4 ...5 ... ...6", "..., 1, 2, 3, ..."] | null | Java 11 | standard input | [
"implementation",
"strings"
] | c7d8c71a1f7e6c7364cce5bddd488a2f | The input data contains a single string s. Its length is from 1 to 255 characters. The string s does not begin and end with a space. Its content matches the description given above. | 1,700 | Print the string s after it is processed. Your program's output should be exactly the same as the expected answer. It is permissible to end output line with a line-break character, and without it. | standard output | |
PASSED | 1635588b42b471890068c8107aae661c | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 5dc0ffc7640ae7594f995077372eb823 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | /**
* DA-IICT
* Author : PARTH PATEL
*/
import java.io.*;
import java.math.*;
import java.util.*;
import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;
public class D358
{
public static int mod = 1000000007;
static F... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 302c89717f3366e65bdc9d80b68a618e | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.stream.Stream;
public class Main implements Runnable {
static final int MOD = (int) 1e9 + 7;
static final int MI = (int) 1e9;
static final long ML = (long) 1e18;
static final Reader in = new Reader();
static final PrintWriter out = new PrintWri... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 649a1b2d99d5c8c0781ab93b5bf487d6 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.*;
import java.util.*;
public class D {
static StringBuilder st = new StringBuilder();
static int [] a ;
static int [] b ;
static int [] c;
static long memo [][] ;
static int n ;
static long dp(int idx , int lst)
{
if(idx == n)
return 0 ;
if(memo[lst][idx] != -1)return m... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 3ef1a42b76725ad5fae553c020a6f760 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.util.StringTokenizer;
public class l057 {
public static void main(String[] args) throws Exception {
// StringTokenizer stok = new StringTokenizer(new Scanner(new File("F:/books/input.txt")).useDelimiter("\\A").next());
... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 0991a62a7ee37dd4043c54caf164d3b8 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class DimaAndHares
{
static int[][] dp;
static int[] a,b,c;
static int n;
public static void main(String[] args) throws IOExcept... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 8708030816be42ead4c4196a45587b23 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class D358{
void solve()
{
int n = ni();
int[][] v = new int[3][];
for(int i=0;i<3;i++)
v[i] = ia(n);
long[][] dp = new long[2][n];
Arrays.fill(dp... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 4638fbec164f263ec9914b7e36f88daa | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static int N;
public static int[] a, b, c;
public static int[][] dp;
public static void main(String[] args) throws IOException {
BufferedReader f = new Buffer... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | befec15799307b67d1562aafbdbf30a6 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;
public class MaxFlow {
static int[] hungry = new int[3001];
static int[] one = new int[ 3001];
static int[] full = new int[3001];
static int[][] dp = new i... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 5589ae7c40adc89c2958974ebe9746b7 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | //package CF;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class A {
static int[] a, b, c, memo[];
static int dp(int idx, int last){
if(idx == a... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 5c597d585823ef4068408386ba3e76ef | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 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.HashSet;
import java.util.InputMismatchException;
import java.util.LinkedList;
public class Solution123 implements Run... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 85909e9aa4f6b42ac24099c7b15e6b52 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
import java.util.List;
public class Main {
static int mod = (int) 1e9 + 7;
static int[] a,b,c;
static int[][] dp;
... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | c42dbf78b27c77812bc6f899cc9312f3 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.*;
import java.util.*;
public class AA {
public static void main(String[] args)throws Throwable {
MyScanner sc=new MyScanner();
PrintWriter pw=new PrintWriter(System.out);
n=sc.nextInt();
a=new int [n];
b=new int [n];
c=new int [n];
for(int i=0;i<n;i++)
a[i]=sc.nextInt();
for(int i... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | d7e6e8949cae070d9adc2a22b69cf3e6 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new PrintStream(System.out));
int n=Integer.parseInt(f.readLine());... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | fdd94a418c3460ce2d2a67bc03e1b1db | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
InputStream is;
static PrintWriter out;
String INPUT = "";
static long mod = (long)1e9+7L;
int n;
int[] a, b, c, dp1, dp2;
public void solve(){
n = ni(); a = na(n); b = na(n); c = na(n); dp1 = new int[n]; dp2 = new int[n];
Arrays.fill(dp1, -1); Arra... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 7d3b8b7e065e1d596e0cec351c50c6df | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 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.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 1e7c9d5ff3f182e2b40632c71b81a687 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Abhas Jain
*/
public class... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 3ff76ad0f616affb45b77e18eb7448fd | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class CF358D {
static int[] not, half, full;... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 87b954f7108f107effded5dab0b188b8 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 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.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 943ff2053828a07605df8eb50321453d | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | //package a2oj;
import java.util.*;
public class DimaAndHares {
static int n;
static int[][] a;
static int[][] dp;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
a = new int[n][3];
dp = new int[n][2];
for(int j = 0; j < 3; j++)
for(int i = 0; i < n; i++... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 2d43b7ae22e1f4f1e50939efec287b96 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes |
import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner();
PrintWriter out = new PrintWriter(System.out);
int n=sc.nextInt();
int [][]a=new int [n][3];
for(int j=0;j<3;j++)
for(int i=0;i<n;i++)
a[i][j]=sc.nextInt... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 218ea7c238d6a4edceda813578ac1eaa | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | 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;
public class Obj implements Comparable<Obj>{
public int t;
public int h;
public Obj(int t_, int h_){
... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 3fd8095b9d9048b5f3a05ba29f57c3de | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author caoash
*/
public class Mai... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 4de5f1e2e6cbd67205efaafd6add2b52 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author ankur
*/
public class Main... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 292537f8979b2b1f55cdc2b3c0138d9e | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static Scanner in = new Scanner(System.in);
static void swap(int []a,int i,int j) {
int t = a[i];
a[i]=a[j];
a[j]=t;
}
static void select(int []a,int k) {
int x = a[0];
for(int i=1;i<a.length;i++) {
if(a[i]<=x) {
swap(a,i,x);
x=i;... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 917ef7d1c89ad0497787923fa629f705 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class D358 {
static int[][] mem;
static int[] none, half, full;
public static void main(String[] args) throws IOException {
Sca... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | e6ca027f3c18fcb225024995a56ed26e | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class DimaAndHares {
//a both neighbours are hungry
//b exactly one is full
//c both neighbours are full
static int n , a[] , b[... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | ba786ee0e31b734bea4d4439d8a44864 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 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.Arrays;
import java.util.StringTokenizer;
public class D {
static int N;
static int[] a, b, c;
static int[][] memo;
public static void main(Strin... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | dea6daa625431fc03c6ae8599554a878 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.List;
import java.util.Random;
import java.util.StringTokenizer;
public class Main implements Runnable {
int sz[];
int id[];
List<Integer> edges[];
long tree[];
private void ... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 889600f721f65fd01fedfba6dc285b50 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | //package codeforce;
import java.io.*;
import java.util.*;
public class dimaandhares {
static int[] a,b,c;
static int[][] dp;
static int n;
public static void main(String[] args) throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw=new PrintWrite... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 4aa6250e9b4776f91a45944a1d6cad0c | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class P358D
{
static int[] a, b, c;
static int[][] dp;
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
a = new int[n];
for (int i = 0; i < n; i++)
a[i] = scan.nextInt();
b = new int[n];
... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | eab1783cb0d0686d915130d6dece2552 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
int n;
long[][] dp = new long[3002][3];
int[][] val = new int[3002][3];
public void solve() throws IOException{
n = in.nextInt();
for(int i = 0; i < n; i++){
val[i][0] = in.nextInt();
... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 051eb62ff2c226ce0afb9235fff08ac2 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.Comparator;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.IOException;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import jav... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 48e406c1f11728edabac7cec147d7c8e | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedLi... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.