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
7e3ee5c2909d60edc7995ce13ff28e96
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; import java.io.*; public class Main { static Scanner sc = new Scanner(System.in); static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) throws Exception { for (int i = 2; i < 25; i++) { System.out.println("? 1 "+i); long n = sc.nextLong();...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
a71a2ff5d75f9fc517594326a8c7122a
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.*; import javax.swing.plaf.basic.BasicInternalFrameTitlePane.RestoreAction; /* */ public class Codeforces {...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
624424d146ffc0e618d26787fd0c3bc8
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.Scanner; public class ProblemE { /** * @param args */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int attempts = 0; int current = 2; while (attempts < 50) { attempts++; System.out.println("? 1 " + current); ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
18edce1229d382b8f241b444b29583cd
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class E { public static void main(String[] args) { FastScanner fs=new FastScanner(); PrintWriter out = new PrintWriter(System.out); // int T = fs.nextInt(); // for (int tt=0; tt<T; tt++) { // } long res = 0; fo...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
e0effed36836a72b75fb3646274ada2b
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class Main { static InputReader sc; static PrintWriter out; private static final int maxn = (int)(1e5 + 7); public static Long ask(int a, int b) throws Exception { out.println("? " + a + " " + b); out.flush(); Long ret = s...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
acab8a96a0a34c004e11ed6cb23b29bb
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class Main { static InputReader sc; static PrintWriter out; private static final int maxn = (int)(1e5 + 7); public static Long ask(int a, int b) throws Exception { out.println("? " + a + " " + b); out.flush(); Long ret = s...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
72f2126b6641b3a1f26af23bb0ff49df
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
//package Codeforces; import java.io.*; public class E { public static void main (String[] Z) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long one = -1; for (int i = 4 ; i < 27 ; i++) { System.out.printf("? 1 %...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
793f21348620ac57f7c99f90f6db1150
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; /** * @author Nervose.Wu * @date 2022/10/3 12:27 */ public final class S820E { public static void main(Str...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
68d6e1ffc5f4362765090c0ef4e2c03d
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.InputMismatchException; public class GuessTheCycleSize { public static void main(String[] args)throws Exception{ FastReader f=new FastReader(System.in); boolean tryForN=true; long n=-1; int i=1; while (...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
64f363cb67909442b6f572ea52fa5055
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; import java.io.*; public class E_Guess_the_Cycle_Size { static FastReader sc; static PrintWriter out; static void solve() { StringBuilder res = new StringBuilder(); for (int i = 2; i <= 26; i++) { out.printf("? 1 %d\n", i); out.flush()...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
deba2e53d314da6285cb00d3149e85d1
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.List; ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
6dea5f4bcdb0c1e0d3df64e5e302468b
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; import java.io.*; public class Main { static long startTime = System.currentTimeMillis(); // for global initializations and methods starts here // global initialisations and methods end here static void run() { boolean tc = false; AdityaFastIO r = ne...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
5ce4e881bd75ebfcf405b018d9080e8d
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
//package codeforces.round820div3; import java.io.*; import java.util.*; import static java.lang.Math.*; public class E { static InputReader in; static PrintWriter out; public static void main(String[] args) { //initReaderPrinter(true); initReaderPrinter(false); //s...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
5dfafd61de95a5759639b5e62861d9c8
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class E { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
891e8e0f27e459bea1e8a2c3f9569755
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; public class Main { static InputReader sc; public static void main(String[] args) throws Exception { sc=new InputReader(System.in); long ans=-1; int i=4; while(true) { long t1=qry(i-1,i); long t2=qry(i,i-1); ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
f2c4b33412d54ce6ab7dd493a69cea1e
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class E1729 { public static void main(String[] args) throws IOException { InputReader ir = new InputReader(System.in); int n = 3; int loop = 0; while (loop < 50) {...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
dec0220523d5fda8d828d6381413cc12
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; public class Test { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); for(int i = 2; i < 27; i++) { System.out.println("? " + 1 + " " + i); long s = in.nextLong(); if(s == -1) { ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
ee81647b1ea297f843c936e141c20f11
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Map; import java.util.Map.Entry; import java.util.HashMap; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-i...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
1c8c15182bb4e9af7ae0576b4d9a58c7
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; public class E { public static void main(String args[]) { Scanner scan = new Scanner(System.in); long a = 1; long b = 2; while (true) { System.out.println("? " + a + " " + b); System.out.flush(); long ans1 = scan.nextLong(); if (ans1 == 0) { retu...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
c5c0ac6ab59da5a9cac47e96b6602b44
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 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.StringTokenizer; import static java.lang.Math.*; public class GuessTheCycleSize implements Closeable { private ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
4e956c5ec4e261dca35eadd9579707f1
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; import java.io.*; public class codeforces1729E { public static void main(String[] args) throws Exception { FastScanner in = new FastScanner(); PrintWriter pw = new PrintWriter(System.out); for (int i = 2; i<50;i++) { pw.println("? 1 "+i); ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
ad2552ddebf27f04abdb66efeeedd9e0
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class CodeForces { /*-------------------------------------------EDITING CODE STARTS HERE-------------------------------------------*/ public static void solve(int tCase) throws IOException { long ans = -1; for(int i = 2;i<=26;i++){ long x...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
4c9e34241fcfee2f26c34d453d5eef1d
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Main { static final int INF = 0x3f3f3f3f; static final long LNF = 0x3f3f3f3f3f3f3f3fL; public static void main(String[] args) throws IOException { initReader(); solve(); pw.flush(); pw.close(); ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
1c78ede8d4195f4c28a835990c3fa59f
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; /* */ public class E{ static FastReader sc=null; public static void main(String[] args) { sc=new FastReader(); for(int i=2;i<=51;i++) { long l1=Query(1,i),l2=Query(i,1); if(l1==-1) { print(i-1); return; } if(l1==l2)continue...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
87cd02eb26fa8ce17966879d1b32f792
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader bf; static PrintWriter out; static Scanner sc; static StringTokenizer st; static long mod = (long)(1e9+7); static long mod2 = 998244353; static long fact[]; static long inverse[]; public static void main (String[...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
4333a670765a848322c7c522e91fbedb
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.Scanner; public class E { public static void main(String[] args) { Scanner in = new Scanner(System.in); for (int i = 1; i <= 25; i++) { System.out.println("? 1 "+(i+1)); long len1,len2; len1 = in.nextLong(); if(len1==-1){ ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
2cf0e2ed87878135dc3c3529ad8fcf9a
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; public class Main { static InputReader in; static OutputWriter out; public static void main(String[] args) throws Exception { in=new InputReader(System.in); out=new OutputWriter(System.out); long ans=-1; int i=4; while(true) { ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
57740e53b8a4a081b4bd81e8f11099ac
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class E { private static Scan sc = new Scan(); public static void main(String[] args) { for (int i = 0; i < 1; i++) { solve(); System.out.flush(); } } ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
0b524d4a16a89b0a8575398c676ead04
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; /** * * @author eslam */ public class Solution { // Beginning of the solution static Kattio input = new Kattio(); static BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out)); static ArrayList<Ar...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
ab95ea0c70672206f7069b5299bb0b35
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.Scanner; public class Main { static Scanner sc; public static void main(String[] args) { sc=new Scanner(System.in); long []rem=new long[25]; long ans=0; for( int i=0;i<25;i++){ rem[i]=query(1,i+2); } for( int i=0;i<25;i++...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
859d8c31103621865e1a6474ceeb5add
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); long ans=-1; long flag=0; for(int i=2;i<=26;i++) { System.out.println("? 1 "+i); System.out.flush(); long p1...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
b17c8335ee082b0b69d11aada9f85cda
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; import java.io.*; public class Template { FastScanner in; PrintWriter out; public void solve() throws IOException { for (int i = 0; i < 25; i++) { System.out.println("? " + (i + 1) + " " + (i + 2)); System.out.flush(); long res1 = in.nextLong...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
29ae2707f157afa6d09990ae52a30b48
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.lang.reflect.Parameter; import java.util.*; public class Solution { static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int t = 1; while (t-- > 0) { long ans = solve(); System.out.println("! " + ans); ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
aae5397f93c24de644a0f68d71b99af9
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
/** * * @author AshwinA */ import java.util.*; import java.lang.*; import java.io.*; import java.util.stream.*; import java.util.function.*; public class CP_IMP_2{ public static void main (String[] args) throws java.lang.Exception{ // Reader in = new Reader(); // Writer out = new Writer(); // ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
f41b19cdb202e8350eae39b1f9967815
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class TaskE { public static void main(String[] args) { FastReader reader = new FastReader(); // int tt = reader.nextInt(); int tt = 1; for (; tt > 0; ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
a26daa3a996a95721f801a9b322368f8
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; public class test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // int t = sc.nextInt(); // while (t > 0) { for(int i= 2; i<=27; i++){ System.out.flush(); System.out.println("? "+1+" "...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
96ce256ee76f6784c4c58dced09848b3
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; import java.util.stream.IntStream; import java.util.stream.LongStream; public class Main { public static FastReader cin; public static PrintWriter out; public static void main(String[] args) throws Exception { out = ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
3b887c9618f27ad3c987bc7dc847ee59
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; import java.io.*; public class E { public static void main(String[] args) throws IOException { Soumit sc = new Soumit(); long canbe = 0; for(int i=2;i<=26;i++){ System.out.println("? "+(i-1)+" "+(i)); long a = sc.nextLong(); ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
1409642b2be1d0e10bbee26c5526f2c8
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class codeforces_820_E { private static void solve(FastIOAdapter in, PrintWriter out) { int cur = 1; for (int i = 0; i < 25; i++) { int nextCur = cur + 1; out.println("? " + cur + " ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
1492fa527adb878df5dcf6cb54644fb4
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; import java.util.concurrent.atomic.LongAdder; import java.lang.*; import java.math.BigInteger; import java.io.*; public class Solution { static int sieve[]; public static void sieve_initilize(int n) { sieve = new int[n+1]; sieve[2] = 1; for(int i = 0;i<sieve.length;i++)...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
5e91e1c009827ecefb54f23588126dc8
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.nio.charset.StandardCharsets; import java.util.Scanner; public class CF1729E { static Scanner scanner; public static void main(String[] args) { scanner = new Scanner(System.in, StandardCharsets.UTF_8); long ans = solve(); System.out.printf("! %d%n", ans); } ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
f33f9ce4aac890283dd76b0719349d99
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { // static int[] prime = new int[100001]; final static long mod = 1000000007; public static void main...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
eaee3a46e90a41ce3dac9c3971ab0d54
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; public class App { public static void main(String[] args) throws Exception { Scanner s = new Scanner(System.in); int i = 3; int j = 4; long avg = 0; int count = 0; while(true) { System.out.println("? " + i + " " + j); Syst...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
0ca70de9faff6ebe31304f80b9a6c4b0
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
// Input : Pratik import java.io.*; import java.util.*; public class JavaDeveoper { FastScanner in; PrintWriter out; public void solve() throws IOException { for (int i = 0; i < 25; i++) { System.out.println("? " + (i + 1) + " " + (i + 2)); System.out.flush(); long res1 = in.nextLong(); ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
0e1e665232d82a1f03dcd0eca6d5dafb
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.lang.reflect.Parameter; import java.util.*; public class Solution { static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int t = 1; while (t-- > 0) { long ans = solve(); System.out.println("! " + ans); ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
1acc76cef5f18b36cd794ddcb9518321
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class E { final static boolean multipleTests = false; Input in; PrintWriter out; public E() { in = new Input(System.in); out = new PrintWriter(System.out); } public static void main(String[] args) { E solution ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 17
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
ed6063aefc5934946bb80a4ed78ab580
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
/*package whatever //do not write package name here */ import java.io.*; import java.util.*; public class Solution { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readL...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
1d4f0ac4b8eae68d8de1b21f65f4ed9c
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.Arrays; import java.util.Scanner; import java.util.Vector; public class Main { public static void main(String[] args) { int m; Scanner read = new Scanner(System.in); m = read.nextInt(); for (int i = 0; i < m; i++) { long n = read.nextInt(); ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
05d4012b743d6c2ed8073ab6e8887fcc
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.Arrays; import java.util.Scanner; import java.util.Vector; public class Main { public static void main(String[] args) { int m; Scanner read = new Scanner(System.in); m = read.nextInt(); for (int i = 0; i < m; i++) { long n = read.nextInt(); ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
9a6a3a7a49cbff35b4453296c3edbc96
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; import java.util.*; /** * Built using CH...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
5500d61d62625983d6740fcb234e4e9b
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.*; import java.util.*; public class KingSomething { public static void main(String[] args) throws IOException { // IO io = new IO("test.in", "test.out"); IO io = new IO(); int numtime = io.nextInt(); for (int qwe = 0; qwe < numtime; qwe++) { int...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
9e68a949f61be620c8380d81001f7037
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.*; import java.util.*; public class KingSomething { public static void main(String[] args) throws IOException { // IO io = new IO("test.in", "test.out"); IO io = new IO(); int numtime = io.nextInt(); for (int qwe = 0; qwe < numtime; qwe++) { int...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
0cadde4c5a3ead40e9a54d019aa6e6a6
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.*; public class c3 { public static void main(String [] args) { Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t-->0) { int n=s.nextInt(); int a=s.nextInt(); int b=s.nextInt(); long []f=new long[n+1]; for(int i=1;i<n+1;i++) f[i]=s.nextLong(); long sum[]=n...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
edb69ae660653ae89759bb8adf6e0716
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static long mod = 1000000007; public static long[] two; public static void main(String[] args) { PrintWriter pr = new PrintWriter(System.out); FastScanner input = new FastScanner(); int num = input.nextInt(); ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
3b42155311fd1dced28323cb19a71d5a
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String next...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
4213435b1a2baaf634d9bf829980b9a2
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.*;// hamare sath shri Raghunath, to kis baat ki chinta.......... import java.lang.*;// discipline is doing what needs to be done even if you don't want to do it. import java.io.*; public class a { static FastReader sc = new FastReader(); static PrintWriter out = new PrintWriter(System.out)...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
220cd5571290387664466c20ea2101be
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; import java.util.*; /** * Built using CH...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
49cc2068097780b08e0dee9802b4eb68
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.*; import java.lang.Math; import java.lang.reflect.Array; import java.util.*; import javax.swing.text.DefaultStyledDocument.ElementSpec; public final class Solution { static BufferedReader br = new BufferedReader( new InputStreamReader(System.in) ); static BufferedWriter bw = new B...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
e06c57e69659b0dcb68a224c318e6211
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class MyClass { public static void main(String[] args) { FastReader sc=new FastReader(); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int a=sc.nextInt(); int b=sc.nextInt(); lo...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
744fa3476a8537143a0d9176c11c4c0f
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class Main { static class FastScanner { BufferedReader br; StringTokenizer st; FastScanner() { br=new BufferedReader(new InputStreamReader(System.in)); } String next() { while(st=...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
1412c01323e29004f366e794286b5e0c
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
/*----------- ---------------* Author : Ryan Ranaut __Hope is a big word, never lose it__ ------------- --------------*/ import java.io.*; import java.util.*; public class Codeforces2 { static PrintWriter out ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
0009ea155da1fa2d000ca23f85cbbc60
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Scanner; public class Main { private static int MOD = 1000000007; private static long Inf = (long) 1E15; public static void main(String[] args) throws Exception { InputStream inputStre...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
203ed7672ea3fe043dac0291008defcd
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Main4 { static double pi = 3.141592653589; static int mod = (int) 1e9 + 7; public static void main(String[] args) throws IOException { int qwe = in.nextInt(); while (qwe-- > 0) { solve(); ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
cc22cbe297b3a415ce9f836c6fa42e64
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
//package MyPackage; import java.util.*; import java.io.*; public class codec{ static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader(){ br=new BufferedReader(new InputStreamReader(System.in)); } String next(){ ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
647d181678a9fee81fcf9e5ba8721aa5
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.Scanner; public class Solution { static Scanner scan = new Scanner(System.in); public static void main(String[] args) { int cas = scan.nextInt(); while(cas-->0){ int n = scan.nextInt(); long a = scan.nextInt(); long b = scan.ne...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
ff1314a0850b48e55c5505fb2955ce74
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
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 C_Line_Empire { static long mod = Long.MAX_VALUE; public static void main(String[] args) { OutputStream outputStre...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
52a6705d99e15354f4f5d4bd576aeb33
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
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 C_Line_Empire { static long mod = Long.MAX_VALUE; public static void main(String[] args) { OutputStream outputStre...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
e41fd8aa332032c0a7161d098a7a8de7
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class New { public static void main (String[] args) throws java.lang.Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int testCases = Integer.parseIn...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
0cc5b0697f3408a877253083033727c4
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { FastReader sc = new FastReader(); int t = sc.nextInt(); for(int w = 0; w < t; w++){ int n = sc.nextInt(); long a = sc.nextInt(); long b = ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
522fa5e4632900ad72c357a25836e339
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class LineEmpire { public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseI...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
40ad93831570f66e4463c2046b2987f3
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class LineEmpire { public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseI...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
10b981acdf2e95dc268916a066b95612
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.*; public class a{ public static void main(String ...fdsa){ // Scanner sc=new Scanner(System.in); // int t=sc.nextInt(); // while(t-->0){ // int n=sc.nextInt(); // for(int i=0;i<=15;i++){ //...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
f88e14ce7597bd0483fe2b34d6f484e9
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
// package div_2_782; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class C{ public static void main(String[] args){ FastReader sc = new FastReader(); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); long x=sc.nextLo...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
0295d1c8a34410c1fc6c65bb64a2f1de
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; import java.io.*; public class Main { // Graph // prefix sums //inputs public static void main(String args[])throws Exception{ Input sc=new Input(); precalcul...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
c9f2299883082817686a2ee04fa46a9c
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.*; import java.util.Map.Entry; import java.math.*; import java.sql.Array; public class Simple{ public static class Pair implements Comparable<Pair>{ int x; int y; public Pair(int x,int y){ this.x = x; this.y = y; }...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
9bc40974bd39dee011d7a9b907e46dcf
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.*; import java.util.Map.Entry; import java.math.*; import java.sql.Array; public class Simple{ public static class Pair implements Comparable<Pair>{ int x; int y; public Pair(int x,int y){ this.x = x; this.y = y; } ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
b19ad94e7481e4b9952fac0b3d7a1e25
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); static FastReader sc = new FastReader(); public static void main (String[] args) throws java.lang.Exception { int t = sc.nextInt(); wh...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
3ba7607bc69406074e069027524e4b97
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.text.DecimalFormat; import java.util.Arrays; import java.util.*; import java.util.Scanner; import java.util.StringTokenizer; public class copy { static int log=18; static int[][] ancestor; static int[] depth; static voi...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
dc1e6570a01ff6a866ac5821c21d4838
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
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.*...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
499e70be065dc66336884dfcd5bd24ee
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
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.*...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
4df5fa366d0124a151528706eae38af7
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.*; import java.io.*; public class B { static FastScanner fs = new FastScanner(); static PrintWriter pw = new PrintWriter(System.out); static StringBuilder sb = new StringBuilder(""); public static void main(String[] args) { int t = fs.nextInt(); for (...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
edc42ea814478ed08821c4e77d88f1f0
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.*; import java.lang.*; import java.util.*; public class ComdeFormces { public static int cc2; public static pair pr; public static long sum; public static void main(String[] args) throws Exception{ // TODO Auto-generated method stub // Reader.init(System.in); FastReader sc=new FastRea...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
f6d565e377140901cdb3f69d0e89899d
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int tt = Integer.parseInt(in.readLine()); for (int t = 1; t <= tt; t++) { ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
52fbc89b5a8431cc2e4481c1c88d55d2
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Runner { public static void main(String[] argv) { try (Scanner in = new Scanner(System.in)) { int times = in.nextInt(); for (int time = 0; time < times; time++) { int n = in.nextInt(); ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
7446fdffe090e5c807c383503d3d112d
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.*; import java.util.*; public class Main { static int mod = 998244353; static int[][] dir1 = new int[][]{{0,1},{0,-1},{1,0},{-1,0}}; static int[][] dir2 = new int[][]{{0,1},{0,-1},{1,0},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}}; static boolean[] prime = new boolean[10]; static { ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
2a3eb6cf12756772124b3ca16af65dea
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.*; import java.lang.*; import java.math.BigInteger; import java.io.*; public class Main implements Runnable { public static void main(String[] args) { new Thread(null, new Main(), "whatever", 1 << 26).start(); } private FastScanner sc; private PrintWriter pw; ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
fbf9b3056dfe5c7c9f49d29931d21dd2
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.Scanner; public class Main { Object solve(int n, long a, long b, int[] x_) { n += 1; long[] x = new long[n]; x[0] = 0; for (int i = 0; i < x_.length; i++) { x[i+1] = x_[i]; } long[] s = new long[n+1]; for (int i = n-1; i >= 0; i--) { s[i] += x[i] + s[i+1]; } long sol =...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
3022d92b38d66318776718ea182bcc99
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class C { String filename = null; InputReader sc; void solve() { int n = sc.nextInt(); long a = sc.nextLong(); long b = sc.nextLong(); long[] x = new long[n]; for (int i = 0; i < n; i++) { ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
d3cdfc8f19c7de61f7207ebd8b56b8c7
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class practiceb { static FastScanner sc; static int ans; static long[] arr, arr1; static char[][] board; static long mul, mul1; static int[] spf; static char[] ch; s...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
17434aecff4fac7cac2f348e62ab6f9e
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { static final PrintWriter out =new PrintWriter(System.out); static final FastReader sc = new FastReader(); /* _oo0oo_ o8888888o 88" . "88 ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
0c7f655a8ee50140c5808e8887d9e4f8
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
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 Solution { static int mod=(int)998244353; public static void main(String[] args) { Copied io = new Copied(System.in, System.out); ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
72b38e6a29ef8c74d8de44c894474071
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
// package FirstPackage; import java.util.*; import java.lang.Math; import java.io.* ; public class Account { public static class Pair<Object1 ,Object2> { Object1 key ; Object2 val ; Pair(Object1 key ,Object2 val) { this.key = key ; this.val = val ; ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
1d4b401e96633d17df5b30daee84f9a1
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
//<———My cp———— //https://takeuforward.org/interview-experience/strivers-cp-sheet/?utm_source=youtube&utm_medium=striver&utm_campaign=yt_video import java.util.*; import java.io.*; public class Solution{ static PrintWriter pw = new PrintWriter(System.out); static FastReader fr = new FastReader(System.in);...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
109a60cff6ad7bfe83109338f5a0e13c
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Random; import java.util.Set; import java.util.StringTokenizer;...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
785cfa9c83fa6eab7d930739c41b9b5c
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.*; import java.util.*; public class Q1659C { static int mod = (int) (1e9 + 7); static void solve() { int n = i(); long a = l(); long b = l(); long c[] = new long[n + 1]; for (int i = 1; i < c.length; i++) { c[i] = l(); } ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
500dce62693901aea5b137968c682887
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class C782{ public static void main(String[] args){ FastScanner sc = new FastScanner(); int t = sc.nextInt(); for(int tt = 0; tt < t; tt++){ int n = s...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
0ccf19104d4c615b900df3ef3e5fcb40
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.Arrays; import java.util.StringTokenizer; public class C_Line_Empire { static class FastScanner { BufferedReader br=new BufferedReader(new InputStreamReader...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
125c4da41bd47a4b48ac585fc701157f
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.sort; public class Round12 { public static void main(String[] args) { FastReader fastRe...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
5b11f7d0f78cb7b7fa30bed331d89713
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
//Utilities import java.io.*; import java.util.*; public class a { static int t; static int n; static long a, b; static int[] x; static long res; public static void main(String[] args) throws IOException { t = in.iscan(); while (t-- > 0) { n = in.iscan(); a = in.lscan(); b = in.lscan(); ...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output
PASSED
dc0e7c65c7a5e7639368e6a5e81542d4
train_110.jsonl
1650206100
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers.Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0&lt;x_1&lt;x_2&lt;\ldots&lt;x_n$$$. You want to conquer al...
256 megabytes
import java.util.*; import java.io.*; public class lineempire { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); StringTokeniz...
Java
["4\n5 2 7\n3 5 12 13 21\n5 6 3\n1 5 6 21 30\n2 9 3\n10 15\n11 27182 31415\n16 18 33 98 874 989 4848 20458 34365 38117 72030"]
1 second
["173\n171\n75\n3298918744"]
NoteHere is an optimal sequence of moves for the second test case: Conquer the kingdom at position $$$1$$$ with cost $$$3\cdot(1-0)=3$$$. Move the capital to the kingdom at position $$$1$$$ with cost $$$6\cdot(1-0)=6$$$. Conquer the kingdom at position $$$5$$$ with cost $$$3\cdot(5-1)=12$$$. Move the capital to the...
Java 11
standard input
[ "binary search", "brute force", "dp", "greedy", "implementation", "math" ]
ce2b12f1d7c0388c39fee52f5410b94b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. The description of each test case follows. The first line of each test case contains $$$3$$$ integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$1 \leq a,b \leq 10^5$$$). The second line of ea...
1,500
For each test case, output a single integer  — the minimum cost to conquer all kingdoms.
standard output