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 | f4287f4b1445d66a00aabbc6b7e7d74a | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.BigInteger;
/**
__ __
( _) ( _)
/ / \\ / /\_\_
/ / \\ / / | \ \
/ / \\ / / |\ \ \
/ / , \ , / / /| \ \
/ / |\_ /| / / / \ \_\
/ / |\/ _ '_| \ ... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 11 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | fd7a7bc2b396708f21d97ea645f9d956 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.io.*;
import java.util.*;
import java.text.DecimalFormat;
import java.math.*;
public class Main {
static int mod = 1000000007;
/***********... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 11 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | adb26a26c6fab9a64074ba2fc390aa95 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;
public class A {
static int mod = 1000000007;
public static void main(String[] args) {
FastScanner sc = ... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 11 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 04bf5b44af3f1fb0b6784512433fff8a | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
public class tank {
static final FastScanner fs = new FastScanner();
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) {
int t = fs.nextInt();
while(t-- > 0) {
run_case();
}
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 11 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | ee1d7d794e423d945294dc54ae031d2d | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.*;
import java.io.*;
public class _1541_C {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
int t = Integer.parseInt(in.readLine());
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 11 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 3f628d1d8a3c5b69897fb989597902da | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | //package greatgraphs;
import java.util.*;
import java.io.*;
public class greatgraphs {
public static void main(String[] args) throws IOException {
BufferedReader fin = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(fin.readLine());
StringBuilder fout = new StringBuilde... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 11 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 542def1fb2c9bc6e456a3bb856c69cda | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import static java.util.Arrays.*;
import java.util.*;
public class C {
public Object solve () {
int N = sc.nextInt();
long [] A = sc.nextLongs();
sort(A);
long res = 0, S = 0;
for (int i : rep(1, N)) {
res += A[i] - A[i-1];
res -= i * A[i] - S;
S += A[i];
}
return res;
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 11 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | be50de19965f163c9665a11eb9be9139 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.Math;
public class Solution {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t>0){
int n = sc.nextInt();
// n = n-1;
Integer[] d = new Integer[n];
int i;
// sc.nex... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | ab0b4dcdb5698011f06a8152ae9006e6 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.Math;
public class Solution {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t>0){
int n = sc.nextInt();
// n = n-1;
Integer[] d = new Integer[n];
int i;
// sc.nex... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | a53b0f231972e2a3aa3b6b33ef2ac4de | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes |
import java.util.*;
public class DSA {
public static void main(String[]args) {
Scanner sc = new Scanner (System.in);
int t = sc.nextInt();
for(int p= 0;p<t;p++) {
long size= sc.nextInt();
long inp[] = new long[(int) size];
for(int i=0;i<size;i++) {
inp[i]=sc.nextIn... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | a211c7fcfd87621c3c547bce6b2770bd | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
public class C {
static class InputReader {
/**
* The default size of the InputReader's buffer is 2^16 -> 65,536 characters
*/
private sta... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | ae1a106cebea4ec0e55a200a4f81eaaa | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.*;
import java.io.*;
public class tr0 {
static PrintWriter out;
static StringBuilder sb;
static long mod = 998244353;
static long inf = (long) 1e16;
static int n, m, k;
static ArrayList<Integer>[] ad;
static int[][] remove, add;
static long[][] memo;
static boolean vis[];
static... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 64d655e19c812a05e016c996bb1b2a8d | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | /*
stream Butter!
eggyHide eggyVengeance
I need U
xiao rerun when
*/
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;
public class PurpleCrayonC
{
pub... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 9c43134394b0d6eef971b2e9753229f4 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | /*
stream Butter!
eggyHide eggyVengeance
I need U
xiao rerun when
*/
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;
public class PurpleCrayonC
{
pub... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 0dbf5b53be5ddcc5a538308111ca9f18 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | /*
stream Butter!
eggyHide eggyVengeance
I need U
xiao rerun when
*/
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;
public class PurpleCrayonC
{
pub... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 77c055c3164244d10816c81c34b83f9b | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.*;
import java.io.*;
public class C_Great_Graphs{
public static void main(String[] args) {
FastScanner s= new FastScanner();
StringBuilder res = new StringBuilder();
int t=s.nextInt();
int p=0;
while(p<t){
int n=s.nextInt();
long a... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | b5a443480bb8c2e71c1a103f321a10e4 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | //package com.cf.div2.c728;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class C {
static PrintWriter out = new PrintWriter(System.out);
static class FastScanner {
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | bb2ad54d2b97b6233a4a989dfef967c7 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | //package com.cf.div2.c728;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class C {
static PrintWriter out = new PrintWriter(System.out);
static class FastScanner {
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | d77fe9be7fe346be96537ed87eec575b | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
public class C {
public static void main(String[] args) throws IOException, FileNotFoundException {
// Scanner in = new Scanner(new File("test.in"));
Scanner in = new Scanner(System.in);
int T = in.nextInt();
for(int t = 0; t < T; t++){
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 4bd9f113545e8ece948674f61a5942e8 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
inputAndSettingData();
}
static long solve(long[] arr, int N) {
long ans = 0;
long sum = 0;
Arrays.sort(arr);
for (int i = 1; i < N; i... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 6169f7f0fe595b4b30f392a8ebc7a7f1 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
inputAndSettingData();
}
static long solve(long[] arr, int N) {
long ans = 0;
Arrays.sort(arr);
long sum = 0;
for (int i = 1; i < N; i... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | faec5158ad78902d298c7518466dfbd3 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
public class CFMain3 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
List<int[]> arrays = new ArrayList<>();
for (int i = 0; i < t; i++) {
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | b93019c5951e4220df8d235a9ee24bf3 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class C {
private static void solve(FastScanner sc){
int n = sc.nextInt();
long[]arr = new long[n];
for(int i = 0;i < n;i++)
arr[i] = sc.nextLong()... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | bcdeed86819b525d68f220718ecd72a2 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes |
import java.util.*;
import java.io.*;
import java .lang.*;
public class test {
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(br.readLine());
while(t-->0)
{
long n=Long.parseL... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 93f4176dd5d936ad7f7589ccf2bf052b | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes |
import java.util.Scanner;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
public class cfContest1541 {
public static void main(String args[]) throws IOException {
Reader scan = new Reader();
int t = scan.nextInt();
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 5d2db92fe8cc4bb4b738f388726a43af | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef {
public static void main(String[] args) throws java.lang.Exception {
FastReader in = new FastReader(Sy... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 00ba90d4905f2b1b1c7ac26df104e49c | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef {
public static void main(String[] args) throws java.lang.Exception {
FastReader in = new FastReader(Sy... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | b4c9062208849f7d24b4a6c9eff1be66 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.BigInteger;
public class Main{
static InputReader sc;
static PrintWriter pw;
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
sc = new Input... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 4496cdd610f2a9288eb89bd3692250ba | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.*;
public class Solution{
public static void main(String[] am){
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while(t-->0){
int n = in.nextInt();
long ans =0;
long arr[] = new long[n];
for(... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 78965d5346598c4013a123b1e6fdc1c1 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | /*==========================================================================
* AUTHOR: RonWonWon
* CREATED: 27.06.2021 22:50:11
/*==========================================================================*/
import java.io.*;
import java.util.*;
public class C {
public static void main(St... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 49437e885f0fd1df56b154570a116ee4 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import javax.swing.*;
import java.io.*;
import java.util.*;
public class Main {
/*
Note: /usercode/Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
*/
public class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode() {}
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 4c6728e00d606d107973d8763670705e | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int t = sc.nextInt();
while (t-->=1){
int n=sc.nextInt();
long a[]=sc.readArrayLong(n);
Arrays.sort(a);
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 591c723999e91d32889a4d0b5d13dd24 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class _practise {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new InputStreamReader(System.in));
}
String next()
{
while ... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 3337063aa0bd623e58aa7b0c76a00089 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class _practise {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new InputStreamReader(System.in));
}
String next()
{
while ... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 175117bf4baf0d0e93d6eb8123d201dd | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | //package cp;
import java.util.*;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.Math.max;
import java.io.*;
public class EdE {
static long[] mods = {1000000007, 998244353, 1000000009};
static long mod = mods[0];
public static MyScanner in;
public static... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 7e15291a0fbbbe4f371ed0039798475d | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException
{
FastScanner f = new FastScanner();
int ttt=1;
ttt=f.nextInt();
PrintWriter out=new PrintWriter(System.out);
outer:for(int tt=0;tt<ttt;tt++) {
int n=f.nextInt();
int[] l=f... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 1aabbf3123a16e168b293023e4d9e977 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
int[] d=new int[n];
for(int i=0;i<n;i++)
d[i]=sc.nextInt();
Arrays.sort(d);
long cost=0;
long[] pre=new l... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 14bf88c7c0721e707b73984d20eccbb9 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | //package pack;
import java.io.*;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.io.*;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.*;
import java.io.FileInputStre... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 00f17674dc88865cfbe6786ee1c3202d | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.lang.reflect.Array;
import java.util.*;
import java.io.*;
import java.math.*;
public class Main implements Runnable {
final static int mod = 1000000007;
static FastReader sc;
static PrintWriter out;
static boolean test_case_input = true;
static final int MAX = 1000000001;
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 64d1284f2b40801221cd70bc87ba7930 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | //package com.company;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new
InputStreamRead... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 6a34b8bd8e802af527d1b59681cacaf1 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.awt.dnd.DragSource;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.uti... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 1dba41b6cfc351553c9865359b632204 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.awt.dnd.DragSource;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.uti... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 90186b6808ef7bed253024ae73d7bffa | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class C_Great_Graphs {
static Scanner in=new Scanner();
static PrintWriter out=new PrintWriter( System.out );
static in... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 05f3fcfec08936cde1355562dcbde8a1 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class C_Great_Graphs {
static Scanner in=new Scanner();
static PrintWriter out=new PrintWriter( System.out );
static in... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | ac2c978e946fbf6c0cfe7f2584ea2921 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class GreatGraphs {
public static void solution() {
//TODO
}
public static void main(String[] args) throws Exception {
BufferedReader reade... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | fdd3f136b0d705d37661d262105aa637 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.lang.*;
import java.math.BigInteger;
import java.util.Scanner;
import java.io.*;
import java.util.*;
import javafx.util.Pair;
import java.math.*;
import java.awt.Point;
public class Main {
static FastScanner sc = new FastScanner();
static void sort(long[] a) {
ArrayList<Long... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 2e2884ef8a9031632b9964c8f0812d22 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer st;
static String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return s... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 9c16dc890be6395ce06dbfdd600f8e8e | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer st;
static String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return s... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 0574a4f90fd8c106747b29d3bb8f60ae | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.*;
//https://codeforces.com/contest/1541/problem/C
public class GreatGraph {
public static void main(String [] args) {
Scanner myObj = new Scanner(System.in); // Create a Scanner object
int t = myObj.nextInt();
while(t!=0) {
int n = myObj.nextInt();
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | c0c0668d9e19ec09757295e0eac141b2 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Main {
/************************ SOLUTION STARTS HERE ************************/
public static boolean IsPowerOfTwo(int x)
{
return (x & (x - 1)) == 0;
}
// function to check if
// point collinear or not
static boole... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 7cc272e69563aefd08b55bdbed5714f4 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class First {
public static void main(String[] args) {
InputStream inputStream = System.in... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | f6d1349f0ee985aa171f86c3d01f3b3e | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes |
import java.io.*;
import java.util.*;
public class codeforces
{
static int M = 1_000_000_007;
static int INF = 2_000_000_000;
static final FastScanner fs = new FastScanner();
//variable
public static void main(String[] args) throws IOException {
int T = fs.nextInt();
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 3a922c4bda21f3c5a84c23bf2ca1b5f5 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 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=input.nextInt();
while(T-->0)
{
int n=input.nextInt();
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 8dd0b4a2cecf7b12b53c17f4fd250c2d | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes |
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.*;
public class R775_C{
public static FastScanner sc;
public static PrintWriter pw;
public static StringBuilder sb;
public static int MOD= 1000000007;
public static class FastScanner {
BufferedReade... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 479bba97ba28604d7af407274007ccce | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes |
import java.util.*;
import java.io.*;
// for codechef and atcoder and spoj
public class Main {
BufferedReader br;
StringTokenizer st;
public Main() { // constructor
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | ed368cf033cf7ca1917e04ab721eb2bf | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.*;
import java.io.*;
// cd C:\Users\Lenovo\Desktop\New
//ArrayList<Integer> a=new ArrayList<>();
//List<Integer> lis=new ArrayList<>();
//StringBuilder ans = new StringBuilder();
//HashMap<Integer,Integer> map=new HashMap<>();
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 044984cc31c7532086ce49e498e8ab60 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
public class C {
public static void main(String[] args) {
FastReader f = new FastReader();
StringBuffer sb=new StringBuffer();
int test=f.nextInt();
out:
while(test-->0)
{
int n=f.nextInt();
int d[]=new int[n];
for(int i=0;i<n;i++)
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 6706b6c3b4ca7f33274a0d24808a8393 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import javafx.scene.layout.Priority;
import sun.reflect.generics.tree.Tree;
import java.awt.*;
import java.sql.Array;
import java.util.*;
import java.io.*;
import java.util.stream.Stream;
import static java.lang.Math.*;
public class C
{
static InputReader in=new InputReader(System.in);
static Out... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | a37c387feb768583190007e1af0a4e4e | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes |
import java.io.IOException;
import java.io.OutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class cf1541 {
public static void main(String[] args) {
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 38deb4784484b285434741421312b118 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class GreatGraphs {
static int mod = 1000000007;
public static void main(String[] args) throws IOException {
FastReader reader = new FastReader();
FastWriter writer = new FastWriter();
int numTests = reader.readS... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 6102d93b7d04f38c8cc150f5c2450d32 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | /*==========================================================================
* AUTHOR: RonWonWon
* CREATED: 27.06.2021 22:50:11
/*==========================================================================*/
import java.io.*;
import java.util.*;
public class C {
public static void main(St... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 3fa34291ed831443df6d39c92b68cee7 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | //package Codeforces;
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
public class Solution {
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private ... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 1d260941cb7f52ed2b3f60554a87c6e3 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
public class GFG {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStre... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 0b7b85a506700838ac56f0651cff36d3 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.math.BigInteger;
import java.util.*;
import java.util.stream.Collectors;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int T = in.nextInt();
while(T>0) {
int N = in.nextInt();
List<BigInteger> mylist = new Arr... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 9cc9ba73582bf3f8009f3d71c1b01011 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Solution {
static final int MOD = (int)1e9+7;
public static void main(String[] args)throws Exception {
int T = nextInt();
// int T = 1;
while(T-- > 0) {
int n = nextInt();
// int n = 5;
long[] a = new long[n];
for (int i=0;i<n;i+... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 9a595dc253ef75018cdf690d3a6d22c8 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
int n = sc.nextInt();
long[] a = new long[n];
for(int i=0;i<n;i++)
a[i] = sc.ne... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 1c08a833b5d509a2ed88c6e26c376bb6 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.Collections;
import java.io.*;
import java.util.*;
public class Main {
static FastReader reader = new FastReader();
static OutputWriter out = new OutputWriter(System.out);
public static void main(String[] args) {
int tests = reader.nextInt();
for(int test... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 17866646a5e5756c9296b76ef9d740b1 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
public class c727a
{
//By shwetank_verma
static class Point implements Comparable<Point>
{
int x, y;
Po... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 2bdd6dcfaa4fcfbc98b8129c8f351890 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int TT = sc.nextInt();
while (TT-- > 0) {
int n = sc.nextInt();
int d[... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 7380797823b9fcfb86c39ca31d4dc368 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int TT = sc.nextInt();
while (TT-- > 0) {
int n = sc.nextInt();
int d[... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 9316966bbc2c0f9b8a73ba695bc70b39 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes |
/*
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶
¶¶¶¶¶¶ ¶¶¶¶¶¶¶
¶¶¶¶ ¶¶¶¶
¶¶¶ ¶¶
¶¶ ¶¶
¶¶ ¶¶
¶¶ ... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | efcf930058d4f4e6680c8a2ccff00a44 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.Math.*;
import static java.lang.System.out;
import java.util.*;
import java.io.File;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.math.BigInteger;
public class Main {
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 50bdb5a96c0363c773389b04da0b6b05 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.Math.*;
import static java.lang.System.out;
import java.util.*;
import java.io.File;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.math.BigInteger;
public class Main {
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 127cf1622a37fbcd175c7dcab7567921 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main{
public static void main(String []args)throws Exception{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));
int T=Integer.parseInt(br.r... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 865dc8fa28231c998f68e64806036c9a | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Sweetgraphs {
public static void main(String[] args) {
// TODO Auto-generated method stub
fastReader sc = new fastReader();
int t = sc.nextInt();
int i;
for(i=0; i<t; i++)... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | ac6d80b2c4bf10cf5d86633ffb4808d9 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main{
static class FastScanner {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new String... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 18d4d1e92cd55d4b188e4976d2e01d57 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | // package com.company;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class P3 {
public static void main(String[] args) {
// BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Scanner scan = new Scanner(System.in);
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 58b728660327011434bb985d8973aae5 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.*;
import java.io.*;
public class CodeforcesRound728 {
static FastReader sc = new FastReader();
public static void main(String[] args) throws IOException {
try {
int t = sc.nextInt();
while (t-- > 0) {
B();
}
} catch (Exception e) {
return;
}
}
static void ... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 012ca3fdb5d387e95c405cb9786733df | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.math.BigInteger;
public final class A
{
static PrintWriter out = new PrintWriter(System.out);
static StringBuilder ans=new StringBuilder();
static FastReader in=new FastReader();
static ArrayList<ArrayList<Integer>> g;
static ... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 2bc3074ca09ec7b21c062b69e3ebc10a | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static int i, j, k, n, m, t, y, x, sum = 0;
static long mod = 1000000007;
static FastScanner fs = new FastScanner();
static PrintW... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 5d838f6713cc8de83c2b8d0129c32768 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 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.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;
public class C {
public static void main(String[] args) {
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 5e70ea4e50645d8bfc1b6eb313ebbc30 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.lang.*;
import java.util.*;
import java.io.*;
public class Main {
static void deal(int n,int[] arr) {
if(n<=2) {
out.println(0);
return;
}
ArrayList<Integer> list = new ArrayList<>(n);
for(int i=0;i<n;i++) list.add(arr[i]);
Col... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 25ebf2f6b20e257331e56b2095309628 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public class contest728 {
public static void main(String[] args) {
FastScanner fs = new FastScanner();
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 650f27eae65cf8b8af80d5502975048a | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public class Main {
private static int inputN;
private static ArrayList<Long> weights = new ArrayList<>();
private st... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 679b11de4a9c20b51c01936108493401 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
public final class Solution {
static PrintWriter out = new PrintWriter(System.out);
static FastReader in = new FastReader();
static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(1, 0), new Pair(0, -1), new Pair(0, 1)};
public static void main(Strin... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | d2798f110707127f418e02fef36e3c54 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 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.BufferedReader;
import java.io.InputStreamReader;
import java.util.TreeSet;
import java.io.InputStream;
/**
* Built using CHelper p... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 0b360a0d5cfb1f60b9f33f5063cf8489 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
//Scanner f = new Scanner(new File("uva.in"));
//Scanner f = new Scanner(System.in);
//BufferedReader f = new BufferedReader(new FileReader("uva.in"));
Buffe... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 8af67e525066693b191f74c63934f642 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 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.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import java.util.Stack;
import java.util.StringTokenizer;
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 1b1484b58688d3668a3ac9c5fe599c56 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
import static java.lang.System.out;
public class Round728Div2C
{
public static void main(String[] args) throws Exception
{
BufferedReader infile = new BufferedRead... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 866302655a621f2fdaee906cde8d57c7 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
static AReader scan = new AReader();
static Scanner scan2 = new Scanner(System.in);
static int N = 100010;... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 89c50d996fd346b6ad0e44de0ac76128 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 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.util.Random;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 817158c24580ba00ce4fec3ca7653ee1 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | // "static void main" must be defined in a public class.
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
long[]arr=new long[n];
... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | aad86e9298f59724a7d4b7fac3133930 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Oliver_And_The_Game {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
whil... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | b91976ff44e2ceddd3b0c1462a970694 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | //package codeforces.round728div2;
import java.io.*;
import java.util.*;
//Think through the entire logic before jump into coding!
//Be aware of integer overflow!
public class C
{
static InputReader in;
static PrintWriter out;
public static void main(String[] args)
{
//initReaderPrinter(true... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 32c9d404bb9517216298dcb4327e31ff | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 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 Pranay2516
*... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 454920b33a152aff5813a06d9d01093f | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
import javafx.util.Pair;
public class Main
{
static void sort(long a[])
{
Random ran = new Random();
for (int i = 0; i < a.length; i++) ... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 39356438b47b5580498eca59bbf6d1fe | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.util.*;
import java.math.*;
public class GreatGraphs
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int runs = sc.nextInt();
while(runs-->0)
{
int size = sc.nextInt();
long[] arr = new long[size];
for(int i = 0;i<size;i++)
arr[i] = sc.nextLong();
if(... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | afcebc399f9cc7d0877d3e8556234205 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | //package com.cf.div2.c728;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class C {
static PrintWriter out = new PrintWriter(System.out);
static class Fas... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | 0bf8b04f3846e7bd2292fb571eaaa7a8 | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class GreatGraphs {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Inte... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output | |
PASSED | fb5b910c3e84da45818d27009428563f | train_107.jsonl | 1624635300 | Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer st;
static String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return s... | Java | ["3\n3\n0 2 3\n2\n0 1000000000\n1\n0"] | 2 seconds | ["-3\n0\n0"] | NoteIn the first test case, you can add roads from pasture $$$1$$$ to pasture $$$2$$$ with a time of $$$2$$$, from pasture $$$2$$$ to pasture $$$3$$$ with a time of $$$1$$$, from pasture $$$3$$$ to pasture $$$1$$$ with a time of $$$-3$$$, from pasture $$$3$$$ to pasture $$$2$$$ with a time of $$$-1$$$, from pastu... | Java 8 | standard input | [
"constructive algorithms",
"graphs",
"greedy",
"shortest paths",
"sortings"
] | 7dfe0db5a99e6e4d71eb012fab07685b | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of pastures. The second line of each test case contains $$$n$$$ space separated integer... | 1,400 | For each test case, output the minimum possible cost of a farm that is consistent with Farmer John's memory. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.