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
78109ca4523912c692bb0676e83fe354
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.*; import java.util.*; public class CF703E { static final int N = (int)(2e5 + 11), INF = (int)(1e9 + 11); static int n, m, v, u, w; static ArrayList< int[] > g[] = new ArrayList[N]; static int[][] d; static PriorityQueue<Node> pq; public static void main (String[] args) throws IOExce...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 11
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
1c757c8938c07973d351c374dcfde071
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.*; import java.util.*; public class CF703E { static final int N = (int)(2e5 + 11), INF = (int)(1e9 + 11); static int n, m, v, u, w; static ArrayList< int[] > g[] = new ArrayList[N]; static int[][] d; static PriorityQueue<Node> pq; public static void main (String[] args) throws IOExce...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 11
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
e72a9215c56667a4c15855b299f365f8
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class problemE { static class Solution { Node[] nodes; void solve() { int n = fs.nextInt(), m = fs.nextInt(); nodes = new Node...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 11
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
07744b018585c9f3429d217801539386
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Codechef { static class Pair { Integer v; int w; Pair(Integer v, Integer w) { this.v = v; this.w = w; } } static class Group { Integer distance; Pair...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 11
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
5dc52f0434ef749c2d7262ff15a717ac
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.PriorityQueue; import java.util.Random; import java.util.StringTokenizer; public final clas...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 11
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
52aa06a5855487dc57d3c00fcc772b16
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.util.*; public class pairedPaymentCF { public static void main (String[]args) { Scanner scan = new Scanner (System.in); int nodeNumber = scan.nextInt(); int edgeNumber = scan.nextInt(); Hashtable <Integer, ArrayList<edge>> weightedGraph = new Hashtable <Integer, ArrayL...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 11
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
4faec1b2cf8209a05573113abb324209
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.io.*; import java.util.*; public class A { static int n, m; static int[] arr; static char[] s; static List<int[]>[] adj; public static void main(String[] args) throws IOExce...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 11
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
6565506ffd13d61b557d556fb4b2c419
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.*; import java.util.*; public class CF1486E extends PrintWriter { CF1486E() { super(System.out, true); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1486E o = new CF1486E(); o.main(); o.flush(); } static final int W = 51, INF = 0x3f3f3f3f; int[] eo; int[][] ej; ...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 11
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
65ffe17c8db041cf40ca517d92853b31
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.*; import java.text.CollationElementIterator; import java.util.*; public class Main { static final long INF = (long) 1e18; static ArrayList<Edge> adjList[]; static int n; public static void main(String[] args) throws IOException { Scanner sc = new Scanner(); ...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 11
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
819b59784e2ee73d1dc61c8523512284
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
//package round703; import java.io.*; import java.util.ArrayDeque; import java.util.Arrays; import java.util.InputMismatchException; import java.util.Queue; public class E { InputStream is; FastWriter out; String INPUT = ""; void solve() { int n = ni(), m = ni(); int[] from = new int[m]; i...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 11
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
f8259770784fd3f0c3900d7d2f7aec42
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class C { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { ...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 11
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
c1536ab63dbb6dab93a804e8a12075ad
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) {new Main().run();} FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run() { work(); out.flush(); } long mod=1000000007; long g...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
a1b471273b6f74ec548908da6721de2f
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
// Don't place your source in a package import java.lang.reflect.Array; import java.text.DecimalFormat; import java.util.*; import java.lang.*; import java.io.*; import java.math.*; import java.util.stream.Stream; // Please name your class Main public class Main { static FastScanner fs=new FastScanner...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
2a32d3e07bc3d97f674d9379a16c16f9
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = System.out; PrintWriter out = new PrintWriter(outputStream); InputReader in = new Input...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
4ef4f7a309cc7008a59d1d5abb6c3982
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.util.*; import java.io.*; public class A{ public static void main(String [] args)throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); FastReader sc=new FastReader(); PrintWriter pw=new PrintWriter(System.out); int test=1...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
82d3b17f44c70c036086865f3854c10a
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.util.*; import java.io.*; public class A{ public static void main(String [] args)throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); FastReader sc=new FastReader(); PrintWriter pw=new PrintWriter(System.out); int test=1; ...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
985dd4e360bdfd1458244e5769622c60
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.*; import java.util.*; public class E { static class node implements Comparable<node> { int node, p; Cost cost; node(int u, int par, Cost c) { node = u; p = par; cost = c; } @Override public int compareTo(node o) { // TODO Auto-generated method stub r...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
e95764f259adba36cb57164c10a10dd8
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.util.*; import java.io.*; public class E1486 { static ArrayList<int[]>[] adjList; public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(); int m = sc.nextInt(); adjList =...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
374cbfcd344f81c2f029f861c4c4292e
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.util.*; import java.io.*; public class Div708 { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
a21691ca9a82c0945fb44e8bdea712cc
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.PriorityQueue; import java.util.AbstractQueue; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.AbstractCol...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
0cd3d20d3406d78bf100443445d45d2e
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.PriorityQueue; import java.util.AbstractQueue; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.AbstractCol...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
1ac780ff2ad16a78728180eb8f26827e
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.PriorityQueue; import java.util.AbstractQueue; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.AbstractCol...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
f62f047cdd2e949c6233fcb949fdc423
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.util.*; import java.io.*; public class E { public static void main(String[] args) { FastScanner sc = new FastScanner(); int n = sc.nextInt(); int m = sc.nextInt(); ArrayList<Edge>[] g = new ArrayList[n]; for(int i = 0; i < n; i++){ g[i] = new ArrayList<>(); } for(int i = 0; i ...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
33f6b1167f4f4c52820b2f7c982ae9ac
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.util.*; import java.io.*; public class E { public static void main(String[] args) { FastScanner sc = new FastScanner(); int n = sc.nextInt(); int m = sc.nextInt(); ArrayList<Edge>[] g = new ArrayList[n]; for(int i = 0; i < n; i++){ g[i] = new ArrayList<>(); } for(int i = 0; i ...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
392c18941517e1d256ceb462bdffe2c3
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.*; import java.util.*; public class tr1 { static PrintWriter out; static StringBuilder sb; static long mod = (long) 1e9 + 7; static int[] memo; static int[][][] memo1; static int n, m; static ArrayList<long[]>[] ad; static HashMap<Integer, Integer>[] going; static long inf = Long.MA...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
ae5bb8965b681ad1e48cd5c428f84ffb
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.util.*; import java.awt.geom.AffineTransform; import java.io.*; public class Main { public static void main(String[] args) throws Exception { int n=sc.nextInt(); int m=sc.nextInt(); ArrayList<pair>[]gr=new ArrayList[n]; for(int i=0;i<n;i++)gr[i]=new ArrayList<pair>(); for(int i=0;i<m...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
624b5739a05382c5b6b9df71b621c4e7
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.util.*; import java.awt.geom.AffineTransform; import java.io.*; public class Main { public static void main(String[] args) throws Exception { int n=sc.nextInt(); int m=sc.nextInt(); ArrayList<pair>[]gr=new ArrayList[n]; for(int i=0;i<n;i++)gr[i]=new ArrayList<pair>(); for(int i=0;i<m...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
eb22a195fb72b3a6bbb03c35a9c0d0c9
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.*; import java.util.*; public class CF703E { static final int N = (int)(2e5 + 11), INF = (int)(1e9 + 11); static int n, m, v, u, w; static ArrayList< int[] > g[] = new ArrayList[N]; static int[][] d; static PriorityQueue<Node> pq; public static void main (String[] args) throws IOExce...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
25056bbdbfe6421d0a8ecb34d186fad3
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.*; import java.util.*; public class CF703E { static final int N = (int)(2e5 + 11), INF = (int)(1e9 + 11); static int n, m, v, u, w; static ArrayList< int[] > g[] = new ArrayList[N]; static int[][] d; static PriorityQueue<Node> pq; public static void main (String[] args) throws IOExce...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
7b7bc7b3e1b1fb07eb04602e5e151ca8
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
//package round703; import java.io.*; import java.util.ArrayDeque; import java.util.Arrays; import java.util.InputMismatchException; import java.util.Queue; public class E { InputStream is; FastWriter out; String INPUT = ""; void solve() { int n = ni(), m = ni(); int[] from = new int[m]; i...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
f31603ed5f2ac47cfdc570bb5f8fb248
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; import java.util.List; import java.util.*; public class realfast implements Runnable { private static final int INF = (int) 1e9; long in= 1000000007; long fac[]= new long[1000001]; lo...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
2b32d6a59b01975f510dfd1550a3344b
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.*; import java.util.*; public class E { static class node implements Comparable<node> { int node, p; Cost cost; node(int u, int par, Cost c) { node = u; p = par; cost = c; } @Override public int compareTo(node o) { // TODO Auto-generated method stub retur...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
c994e7dca75506883fe8e2ab8f1901c6
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.*; import java.util.*; public class Main2{ static int INF=(int)2e9; static ArrayList<int[]>[] adjListW; static int n; static int[] dijkstra(int S) //O(E log E) { int[][][] dist = new int[2][51][n]; for(int i=0;i<2;i++) { for(int j=0;j<=50;j++) { for(int o=0;o<n;o++)dist[i][j]...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
1c79e71906596be9ddd89d837c611562
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.math.BigInteger; import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Ar...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
7d9e454d762d48fa9377a491af29b03a
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
/** * BaZ :D */ import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { static MyScanner scan; static PrintWriter pw; static long MOD = 1_000_000_007; static long INF = 2_000_000_000_000_000_000L; static long inf = 2_000_000_000; public stat...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
db23a38f9396f27f20395fb838068ccb
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.*; import java.util.*; /* polyakoff */ public class Main { static FastReader in; static PrintWriter out; static Random rand = new Random(); static final int oo = (int) 1e9 + 10; static final long OO = (long) 2e18 + 10; static final int MOD = (int) 1e9 + 7; ...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
1c3c35dbacbcf095f3628baab2ab8a31
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.util.*; import java.io.*; import java.math.*; /** * * @Har_Har_Mahadev */ public class E { private static long INF = 2000000000000000000L, M = 1000000007, MM = 998244353; private static int N = 0; static ArrayList<Edge>[] edges; public static void process() throws IOException { ...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
848dde397f313fca9dc88a09e5237e34
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.PriorityQueue; import java.util.Stri...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
8848d25133efd7f6358f5e9b6f8ab9bb
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.io.*; import java.util.*; public class A { static FastScanner fs; public static void main(String[] args) { fs=new FastScanner(); // int t = fs.nextInt(); // while (t-->0) solve(); } public static void solve() { int n = fs.nextInt(); ...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
e10b713a00542f1e20140e5617a53375
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.util.*; import java.io.*; public class E1486 { static ArrayList<int[]>[] adjList; public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(); int m = sc.nextInt(); adjList = ne...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
6ade6c259775dae3ff6c6e7cdbee568c
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
//stan hu tao import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; public class x1486E { static final long INF = (Long.MAX_VALUE-420)/3; static ArrayDeque<Edge>[] edges; public static void...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
64d01a0151ebc56a06ef9d96ec53c3f4
train_110.jsonl
1613658900
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter $$$w$$$. You can travel through the roads, but the government made a new law: you can only go through two roa...
512 megabytes
import java.util.*; import java.io.*; public class Div708 { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////...
Java
["5 6\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 5 1\n2 4 2", "3 2\n1 2 1\n2 3 2"]
4 seconds
["0 98 49 25 114", "0 -1 9"]
NoteThe graph in the first example looks like this.In the second example the path from $$$1$$$ to $$$3$$$ goes through $$$2$$$, so the resulting payment is $$$(1 + 2)^2 = 9$$$.
Java 8
standard input
[ "binary search", "brute force", "constructive algorithms", "dp", "flows", "graphs", "shortest paths" ]
abee4d188bb59d82fcf4579c7416a343
First line contains two integers $$$n$$$, $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$1 \leq m \leq min(\frac{n \cdot (n - 1)}{2}, 2 \cdot 10^5)$$$). Next $$$m$$$ lines each contain three integers $$$v_i$$$, $$$u_i$$$, $$$w_i$$$ ($$$1 \leq v_i, u_i \leq n$$$, $$$1 \leq w_i \leq 50$$$, $$$u_i \neq v_i$$$). It's guaranteed tha...
2,200
For every city $$$t$$$ print one integer. If there is no correct path between $$$1$$$ and $$$t$$$ output $$$-1$$$. Otherwise print out the minimum amount of money needed to travel from $$$1$$$ to $$$t$$$.
standard output
PASSED
796ef787dcfa83f8a99d1ed74bbbdb45
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java....
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
db9283f2db3f6fc265ac613099540e27
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; import java.io.*; public class Main { static long mod = 1000000007; static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static void main(String[] args) throws IOException { FastReader sc = new FastReader(); int t = sc.nextInt(); while( t-- ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
916c7d2d77de42bb60053d1216e9df94
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; import java.io.*; public class Solution { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
3a6475ea5ccbfba3cf850b6eac024421
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class feb20 { // *** ++ // +=-==+ +++=- // +-:---==+ *+=----= // +-:---...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
333b183e6aec84743471088f58f24ad6
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; public class j { static class Robot implements Comparable<Robot> { int val,ind; char ch; Robot(int val,char ch,int ind) { this.ind=ind;this.ch=ch; this.val=val; } @Override public int compareTo(Robot...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
5701123e0cee0319ccf6cb25ccf0d654
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; public class Practice { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); int m = sc.nextInt(); int[] start = new int[n]; char[] dir = n...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
938f80ca89bb32d4b5328bb6ab54043e
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; // import java.lang.*; import java.io.*; // THIS TEMPLATE MADE BY AKSH BANSAL. public class Solution { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
a648297d0fb2cf74ace78efc62792906
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; public class Robots { public static void main(String[] args) { Scanner in = new Scanner(System.in); StringBuffer out = new StringBuffer(); int t = in.nextInt(); while (t-- != 0) { int n = in.nextInt(), m = in.nextInt(); int x[] = new int[n]; for...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
f3ce271da082ed5c1e4b81cc634a9511
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
/*input 5 7 12 1 2 3 4 9 10 11 R R L L R R R 2 10 1 6 R R 2 10 1 3 L L 1 10 5 R 7 8 6 1 7 2 3 5 4 R L R L L L L */ import java.util.*; import java.lang.*; import java.io.*; public class Main { static PrintWriter out; static int MOD = 1000000007; static FastReader scan; /*-------- I/...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
7e4bbc057ea73a67d67ef3f059d79e4e
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.PrintWriter; import java.util.*; public class C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int t = sc.nextInt(); for (int i = 0; i < t; i++) { solve(sc, pw); ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
50e03b6886407b22e777a85f3891e77b
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; // Created by @thesupremeone on 16/05/21 public class C { static class Robot implements Comparable<Robot>{ int index; int location; boolean right; public Robot(int index, int location, boolean right) { this.ind...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
e18a502fa740a07e5610537ca040fcec
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.lang.*; public class JaiShreeRam{ static class pair{ int first; int second; public pair(int x,int y) { first=x; second=y; } } static Scanner in=new Scanner(); static ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
3091decc51a299583d06ad86db8f7435
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
//https://codeforces.com/contest/1525/problem/C //C. Robot Collisions import java.util.*; import java.io.*; public class CF_1525_C{ public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(new Outp...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
bec23cbad233b8b04e9a6df76acf9ef6
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; Out...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
1e5d80bbb641f3bd4a9b8d6a8f28d778
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.System.currentTimeMillis; public class Sol{ static class Pair{ int dir, id , pos,life; public Pair(int id, int pos ,int dir ,int life){ this.pos = pos; this.id = id; this.dir =dir; this.life...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
2f9791c87e95543ea01b9bb87dd90b15
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.*; import java.util.*; public class RobotCollision { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
3d056293583e68c8a81896c16ff9034e
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import com.sun.source.tree.Tree; import java.util.*; import java.io.*; public class C { PrintWriter out; StringTokenizer st; BufferedReader br; final int imax = Integer.MAX_VALUE, imin = Integer.MIN_VALUE; final int mod = 1000000007; Map<Integer, Integer> map; long[] ans; ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
fa3726858e6a7c9260e77619e1ad0c3d
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.Arrays; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.Stack; import java.util.StringTokenizer; public class C { public static class Robot { public int pos, dir...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
e244929ee2a715a24e586cf349f1a952
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; public class C { public static void solve(List<Robot> v, int[] ans, int m) { Stack<Robot> stk = new Stack<>(); for (Robot r: v) { if (r.dir == -1) { if (stk.isEmpty()) { stk.push(r); } else { ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
5fe189d0866998e703aa1104cf992397
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; public class Robots { public static void main(String[] args) { Scanner in = new Scanner(System.in); StringBuffer out = new StringBuffer(); int t = in.nextInt(); while (t-- != 0) { int n = in.nextInt(), m = in.nextInt(); int x[] = new int[n]; for...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
362661d9d80d3b30667163c78eb16cd7
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.util.Stack; import java.util.ArrayList; import java.util.Vector; import java.util.Comparator; import ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
660ee8147dd9d9a705985c541ee17975
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader(String s) { try { br = new BufferedReader(new FileReader(s)); } catch (FileNotFoundExcepti...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
449207cd65c00c62c98302bddc88909e
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.math.BigInteger; import java.util.*; import java.io.*; public class Div716 { static int n, m; static int[] a; static int comp(int x, int y) { return a[x] - a[y]; } public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System....
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
97598d1a37801a2b0962af15ee6f6010
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.*; import java.util.*; public class CCC { public static void main(String[] args) throws IOException { int T = readInt(); final Comparator<int[]> comparator = (a, b) -> a[POS] - b[POS]; while (T-- > 0) { int n = readInt(); int m = readInt(); ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
56e2376f3b8390c71eade159ae2da4e7
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.nio.file.Paths; import java.util.*; public class Main extends PrintWriter { static BufferedReader s = new BufferedReader(new InputStreamReader(System.in));Main () { super(S...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
2ae53f5fd9b8cd22ead03f161c6f1bdc
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.*; import java.util.*; public class C { public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static void main(String[] args) throws IOException { readInput(); ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
850d5f8b5d7358a619cdf15756c16280
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; import java.io.*; public class C { static FastIO f; public static void main(String args[]) throws IOException { f = new FastIO(); int t, n, m, x[], ans[], i; char d[]; Stack<Robot> o, e; Robot r[], p, c; t = f.ni(); while(t-->0) { n = f.ni(); ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
f4fb345c5fec085b6ce0dcd0d137e576
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.*; import java.util.*; public class gotoJapan { public static void main(String[] args) throws java.lang.Exception { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream)...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
4bca579e64acbbf7bc6cc54f65238b81
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.PriorityQueue; public class Main { private static void run() throws IOException {...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
045d1a78b3a7c9f57ffee5d761f58796
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
//package edu109div2; import java.util.*; import java.util.stream.Collectors; public class C_Robot_Collisions_2 { static int m; public static class Robot implements Comparable<Robot> { int index; int pos; char dir; int explosion = -1; public Robot(int ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
3763590a911455550f830ed3984271d4
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.HashMap; import java.io.IOException; import java.io.InputStreamReader; import java.util.TreeSet; import j...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
1b247bfa9e85723c45f2ba0369b31fb1
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
/* "Everything in the universe is balanced. Every disappointment you face in life will be balanced by something good for you! Keep going, never give up." Just have Patience + 1... */ import java.util.*; import java.lang.*; import ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
5168a6b08a13960691cdeff1855c36d7
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.*; import java.util.*; public class Collisions { public static void main(String[] args) throws Exception { FastIO in = new FastIO(); int t = in.nextInt(); for (int tc=0; tc<t; tc++) { int n = in.nextInt(); int m = in.nextInt(); int[][] robotData = new int[n][2]; int[] ans =...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
f59479a567d2c779ef2f0049092a13c7
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static class Cow implements Comparable<Cow> { private int pos; private int dir; private int idx; private Cow() {} @Override public int compareTo(Cow o) { return pos-o.pos; ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
0f673a0fddb09bb0223e016c77d86cbe
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; import java.io.*; public class _1525_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
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
83e5293752fb3c67e43cd552f31f7fcd
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.*; public class Main { static final long MOD=1000000007; static final long MOD1=998244353; static long ans=0; //static ArrayList<Integer> ans=n...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
f447e28d4486743ec6612839fbf83c1f
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; /** * @author Mubtasim Shahriar */ public class RobotCollisions { public static void main(String[] args) { InputStream inputS...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
0adfc3f21d606b1a61a25de005bf9880
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class RobotCollisions { static class Point { int x; boolean left; int index; public Point(int x, boolean left, int index) { this.x = x; t...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
c7e4995697115e700254580944f0953a
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.*; import java.nio.charset.StandardCharsets; import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Solution { static class FastReader { BufferedReader br; StringTokenizer st; public FastReade...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
761ed12456f2369a4d3280c271ad647c
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.*; import java.util.*; public class robot_collisions { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); int m = sc.nextInt(); int[] start = new int[n]; ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
957a6742800715a3e12c01438dce6381
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Scanner; import java.util.StringTokenizer; import java.util.function.BiConsumer; import javax.sound.midi.SysexMessage; import java.io.IOException; impo...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
5c74cedd4f83499cfbb5f57a251f3d38
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.*; import java.util.*; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { // InputReader sc = new InputReader(System.in); // PrintWriter out = new PrintWriter(System.out); BufferedReader br = new BufferedR...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
0e6a28b0b15f1e499e32724742100702
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.io.*; import java.util.*; public class A { static int n, m; static int[] x; static char[] d; public static void main(String[] args) throws IOException { f = new Fla...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
4530d4a10aca394b05977c8e16cd06d9
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
//------------------>>>>>>>>>>>>>>>> HI . HOW ARE YOU? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<------------------------------ import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.List; import java.util.StringTokenizer; //----------------------...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
2870351ff8b0b1a568494d8bc56ed807
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; public class GOOD_bot_collisions { public static void solve(List<Robot> v, int[] ans, int m) { Stack<Robot> stk = new Stack<>(); for (Robot r: v) { if (r.dir == -1) { if (stk.isEmpty()) { stk.push(r); } el...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
9985220218102714c9ee06619da663f7
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.*; import java.util.*; public class C implements Runnable { void solve() throws IOException { int t = ri(); while (t-- > 0) { int n = ri(), limit = ri(); Node[] x = new Node[n]; for (int i = 0; i < n; i++) { x[i] = new...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
a1b6dd090c775270edf1783e385bd82a
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
//package robotcollisions; import java.util.*; import java.io.*; public class robotcollosions { static int[] ans; static boolean[] v; static int m; public static void solve(int[][] robots) { //System.out.println("FUNCTION CALL"); TreeSet<int[]> left = new TreeSet<int[]>((a, b) -> a[0] - b[0])...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
ed74a463f2c2542135e2f77bab164461
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
// Rohit Bohra | 18/05/2021 : 01:25:31 import java.io.*; import java.util.*; @SuppressWarnings("unchecked") public class C{ static int[] ans; static class Robot{ int id,x,dir; Robot(int id,int x,int dir){ this.id=id; this.x=x; this.dir=dir; } } ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
be7be79605806058e1fcf264c21a9d39
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; public class Robots { public static void main(String[] args) { Scanner in = new Scanner(System.in); StringBuffer out = new StringBuffer(); int t = in.nextInt(); while (t-- != 0) { int n = in.nextInt(), m = in.nextInt(); int x[] = new int[n]; for...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
2d03ff91b8d192849348fa9c4e7ec533
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.*; import java.util.*; public class Codeforces { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); int t=Integer.parseInt(bu.readLine()); ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
7466058a1ac53cc07948de37029650df
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.*; import java.util.*; /* 1 7 8 6 1 7 2 3 5 4 R L R L L L L */ public class P2 { static FastReader sc=null; static int ans[]; static int w; public static void main(String[] args) { sc=new FastReader(); PrintWriter out=new PrintWriter(System.out)...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
985f88cb254e7b2d9ef93bceac504630
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Codeforces { public static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
19dd59a0d1ae1c37158c0597253e0e2c
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.PriorityQueue; public class Main { private static void run() throws IOException {...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
d57379b27941fe8447cf5ce2f75cf35f
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { static MyScanner scan; static PrintWriter pw; static long MOD = 1_000_000_007; static long INF = 2_000_000_000_000_000_000L; static long inf = 2_000_000_000; public static void main(String[] a...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
b661beab42c8bd1ccd451bf56eca9251
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class A{ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new Bu...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
bcd6e27c170a2a2b840fd926408bad48
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.util.*; import java.io.*; public class _109 { static long m; static long [] res; public static void main(String[] args) { MyScanner sc = new MyScanner(); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); int t = sc.nextInt(); whil...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
8cdaa7853f8cce2f41066ec8755b56ae
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.*; import java.util.*; import javax.swing.text.DefaultStyledDocument.ElementSpec; /** __ __ ( _) ( _) / / \\ / /\_\_ / / \\ / / | \ \ / / \\ / / |\ \ \ / / ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output
PASSED
6d720f5fb4322b69a743dd1b1c809fd5
train_110.jsonl
1621152000
There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$.The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 &lt; x_i &lt; m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No...
256 megabytes
import java.io.*; import java.util.*; public class C { private static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); private static BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out)); private static StringTokenizer st; public static ...
Java
["5\n7 12\n1 2 3 4 9 10 11\nR R L L R R R\n2 10\n1 6\nR R\n2 10\n1 3\nL L\n1 10\n5\nR\n7 8\n6 1 7 2 3 5 4\nR L R L L L L"]
2 seconds
["1 1 1 1 2 -1 2 \n-1 -1 \n2 2 \n-1 \n-1 2 7 3 2 7 3"]
NoteHere is the picture for the seconds $$$0, 1, 2$$$ and $$$3$$$ of the first testcase: Notice that robots $$$2$$$ and $$$3$$$ don't collide because they meet at the same point $$$2.5$$$, which is not integer.After second $$$3$$$ robot $$$6$$$ just drive infinitely because there's no robot to collide with.
Java 11
standard input
[ "data structures", "greedy", "implementation", "sortings" ]
1a28b972e77966453cd8239cc5c8f59a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. Then the descriptions of $$$t$$$ testcases follow. The first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 3 \cdot 10^5$$$; $$$2 \le m \le 10^8$$$) — the number of robots and the coordi...
2,000
For each testcase print $$$n$$$ integers — for the $$$i$$$-th robot output the time it explodes at if it does and $$$-1$$$ otherwise.
standard output