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
5b0286a7c1c0a6e28e197c117e08c053
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.fill; import static java.util.Arrays.binarySearch; import static java.util.Arrays.sort; public class Main { public static void main(String[] args) throws IOException { new Thread(null, new Runnable() { public vo...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≀ n ≀ 109, 1 ≀ q ≀ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≀ i ≀ j ≀ n) β€” is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line β€” the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
472991fa99ca54f2883562ae54399d32
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.util.*; import java.io.*; public class Main { // File file = new File("input.txt"); // Scanner in = new Scanner(file); // PrintWriter out = new PrintWriter(new FileWriter("output.txt")); public static void main(String[] args) { // Scanner in = new Scanner(Sys...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
1d9eb96c2512acf0c6d03142fc7f070d
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.util.Scanner; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.lang.Math; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t =...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
e91d586dddcdab4dbf7a5218f85ace65
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class A { static class Task { public void solve(int testNumber, InputReader in, PrintWriter out) { int t = in.nextInt(); while ((t--) > 0) { int n = in.nextInt(); in...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
207fdc48b870bb74141ba40015ab030f
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import javax.annotation.processing.Filer; import java.util.*; import java.io.*; public class dreamooon { public static void main(String[]args)throws Exception{ Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); for(int i = 0; i <...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
ad96d295a151acdbd3e619422fd14a1d
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
a513bc33239952e020b8f7b737e177e2
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
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 { public static void main (String[]args) throws IOException { Scanner in = new Scanner(System.in); ...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
415290d7a17114291b404a73f49e3532
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.util.*; public class Main{ public static void main( String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while(t-- > 0) { int n = scan.nextInt(); int x = scan.nextInt(); int a[] = new int[n+1]; int f...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
4b2b273ee419e4ef9ec606600fb24495
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.util.*; public class ranking { public static void main(String[] args){ Scanner myScanner = new Scanner(System.in); int t = myScanner.nextInt(); for (int i = 0; i < t; i++) { int n = myScanner.nextInt(); int x = myScanner.nextInt(); boolean[] ar...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
ccd3b511930d3bab321e514ad07d5d10
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.util.HashSet; import java.util.Scanner; public class codeforces { public static void main(String[] args) { Scanner scn=new Scanner(System.in); int t=scn.nextInt(); StringBuilder sb=new StringBuilder(); while(t-->0){ int n=scn.nextInt(); int x=scn.nextInt(); HashSet<Integer>hm=new HashSet...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
9d83e1db0dfcef37906384105ab7412d
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while (t-- > 0) { int n = scan.nextInt(); int x = scan.nextInt(); boolean[] a...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
815efd957aba8cadd9d82740bd6aed5d
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.util.*;import java.io.*;import java.math.*; public class RankingCollection { public static void process()throws IOException { int n = ni(), x = ni(); int[] a = nai(n); TreeSet<Integer> st = new TreeSet<Integer>(); for(int i : a) st.add(i); //pn(st)...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
cae767b057639e6e5db8c7cddb93bda0
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.io.IOException; import java.io.InputStreamReader; import java.io.BufferedReader; import java.util.*; import java.math.*; import java.io.*; import java.text.*; import java.math.BigInteger; public class Main { //Life's a bitch public static boolean[] sieve(long n) { boolean[] prime =...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
8da20ad03a63c1695785a53470c56d3f
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static final boolean N_CASE = true; private void solve() { int n = sc.nextInt(); int x = sc.nextInt(); List<Integer> a = sc.nextList(n); Collections.sort(a); int ans = 0; for (int i = 0; i < n;...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
e6a8d7e4a696f8dcd35b150f78232e48
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Q1 { public static long solver(Scanner sc) { return 0; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); //long val = solver(sc); int t = sc.nextInt(); for(int tt=0;tt<t...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
0f3d49528ba3cab87873cd3a8da7e0a6
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Class1 { public static int resolver(int[]dizi,int contest_sayisi) { boolean flag = false; int sonuc = 0; while(contest_sayisi>0) { for(int i=1;;i++) { flag =false; for(int j=0;j<dizi.length;j++) { if(dizi[j]==i) { flag = tr...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
07eb4ab47a21aed0bd2efec7cd909cbb
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class a { public static void main(String[] args) { Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t-->0) { int n=s.nextInt(); int x=s.nextInt(); int arr[]=new int[n]...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
63893ba5f36308962105dffbee214e90
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.StringTokenizer; import java.util.Scanner; import java.lang.*; import java.io.*; import java.util.*; import java.lang.Integer; import java.util.HashMa...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
d3110325f168ae12fdfb38b528af2ba0
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import javax.management.MBeanRegistration; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.StringTokenizer; import java.util.Scanner; import java.lang.*; import java.io.*; import java.util.*; import...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
1415fc647161dfd7ef7921396ccd2718
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class cp { static String removedup(char str[], int n) { int index = 0; for (int i = 0; i < n; i++) { int j; for (j = 0; j < i; j++) { ...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
cd1d249bba522fd4839a2ac089d4d3cc
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { //solution start :-) Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); int x...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
a865ea1482356dd6379de403b73c9e0f
train_002.jsonl
1585924500
Dreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from $$$1$$$ to $$$54$$$ after two more rated contests. It's amazing!Based on this, you come up with the following problem:There is a person who participated in $$$n$$$ Codeforces rounds. His place in the first roun...
256 megabytes
import java.util.*; public class ranking{ public static void main (String args []){ Scanner sc = new Scanner(System.in); int numCases = sc.nextInt(); for(int i = 0; i < numCases; i++){ int contestDone= sc.nextInt(); int contestLeft = sc.nextInt(); bo...
Java
["5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20"]
1 second
["5\n101\n2\n2\n60"]
NoteThe first test case is described in the statement.In the second test case, the person has one hundred future contests, so he can take place $$$1,2,\ldots,99$$$ and place $$$101$$$ on them in some order, to collect places $$$1,2,\ldots,101$$$.
Java 11
standard input
[ "implementation" ]
e5fac4a1f3a724234990fe758debc33f
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5$$$) denoting the number of test cases in the input. Each test case contains two lines. The first line contains two integers $$$n, x$$$ ($$$1 \leq n, x \leq 100$$$). The second line contains $$$n$$$ positive non-zero integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
900
For each test case print one line containing the largest $$$v$$$, such that it is possible that after $$$x$$$ other contests, for each $$$1 \leq i \leq v$$$, there will exist a contest where this person took the $$$i$$$-th place.
standard output
PASSED
a321ecde9930e4ef0913b6eecf686d0c
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.util.Scanner; public class C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int r = sc.nextInt(); int[] x = new int[n]; for(int i=0;i<n;i++) { x[i] = sc.nextInt(); } double[] pY = new double[n]; pY[0]=r; for(int i=1;i<n;i++) { ...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
6dd83f8846dee2ad098dc84147ebc8bf
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
cbec639d114b4b0a85151bce6d5a1c68
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.io.*; import java.util.*; public class C { String fileName = "C"; public double r; public double getY(double x2, double x1, double y1) { /*double y1 = y[i - 1]; double x1 = x[i - 1]; double x2 = x[i];*/ double C = y1 * y1 - 4D * r * r + (x2 - x1) * (x2 - x1); ...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
77a30273d0a97635790733c5d519b62a
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.util.StringTokenizer; public class main { ...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
905ac5057c97f3d7b72a9a73c25a7c7b
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package javaapplication4; /** * * @author DINH */ import java.io.OutputStream; import java.io.IOException; import java.io.InputSt...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
dcaf07c57a1f3a254cf16d447fae8a43
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.awt.List; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Codeforces908C { public static ArrayList<Double> realHeights = new ArrayList<Double>(); public static ArrayList<Integer> heights = new ArrayList<>(); public static int n; public sta...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
7b77c0b485bfadcab445000752e9acb6
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class C908{ void solve() { int n = ni(), r = ni(); int[] a = ia(n); double[] ys = new double[n]; for(int i=0;i<n;i++) { ys[i] = r; for(int j=0;...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
49e38496406cf396455a2d58fbfa7cf7
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.io.*; import java.util.*; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din = new DataIn...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
4a29520cd03e7aa5dc04c085e0af7574
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import com.sun.org.apache.xerces.internal.util.SynchronizedSymbolTable; import jdk.management.cmm.SystemResourcePressureMXBean; import java.awt.*; import java.io.*; import java.lang.reflect.Array; import java.text.DecimalFormat; import java.util.*; import java.util.List; import java.math.*; public class Newbie { ...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
5d7ad6f4842864ec303a3b3ca0b76c22
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class C_2017 { InputStream is; PrintWriter out; int n; long a[]; private boolean oj = System.getProperty("ONLINE_JUDGE") != ...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
4671528235256f64662ef39f6d02a5a9
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
//package practice; import java.io.*; import java.math.*; import java.util.*; /** * * @author Tushar 29 Dec, 2017 */ public class C { public static void main(String args[]) { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); int t = 1; ...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
6e9c2f8d6820a4b0a156b7a1b1fe8c21
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.util.Scanner; public class C { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); int n = input.nextInt(); int r = input.nextInt(); int coordinatesX[] = new int[n]; for(int i = 0;i < n;i++) coordinatesX[i] = input.nextInt(); ...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
79c8426568b57a8b158ba12c740a86e3
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
//package codeforces.GoodBye17; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class C { ...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
5891512d409e8bf0158cfec1b3e237da
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import javafx.scene.layout.Priority; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; public class C { int N,r; int[] x; double[] y; private void solve() { N = nextInt(); r = nextInt(); x = new int[N]; y = new do...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
68a4c0a455688e39921fe0e7e88813d5
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import javafx.scene.layout.Priority; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; public class C { int N,r; int[] x; double[] y; private void solve() { N = nextInt(); r = nextInt(); x = new int[N]; y = new do...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
423de6f421fd8e3f12801faf4c706ede
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import javafx.scene.layout.Priority; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; public class C { int N,r; int[] x; ArrayList<Point> points; private class Point implements Comparable<Point>{ double y,x; public Point(double ...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
a27050964084e063ee8f7c085ce81752
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public cl...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
56818e79b3ef709d925ad30d06fc0c4a
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
/*package whatever //do not write package name here */ import java.io.*; import java.util.* ; public class Main { public static int mod(int n) { if(n<0) { return -n ; } return n ; } public static void main (String[] args) { Scanner s=new Scanner(System.in...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
53db7192fa30fd40f741635fffa48af4
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.io.Writer; im...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
96f080bb19c7f1710c0bcd57a42e1ff3
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.io.*; import java.util.*; public class CODEFORCES { @SuppressWarnings("rawtypes") static InputReader in; static PrintWriter out; public static double distance(int a, int b, int x, int y) { return Math.sqrt(((long) (a - x) * (long) (a - x)) + ((long) (b - y) * (long) (b - y))); } static void solv...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
49aa57597ee0d974a689df0656737b80
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.math.*; public class Prac{ static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; public InputReader(InputStream st) { ...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
2dfea077c8599574151a3ee1399db6e5
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.io.*; public class Solution { public static void main(String[] args)throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String temp1=br.readLine(); String[] temp2=temp1.split(" "); int n=Integer.parseInt(temp2[0]); int r=Integer.parseInt(temp2[1]); int[...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
8ee6a6ce0dc72e3c584f064f767ab3ee
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
//package goodbye2017; import java.util.*; public class problemC { public static void main(String args[]) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int r = in.nextInt(); int[] x = new int[n]; double[] result = new double[n]; StringBuilder sb = new StringBuilder(); for(int i = 0; i <...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
958d4385c7cc1f5f43511dbb4fdca283
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.math.*; public class Codeforces { static class FastReader { BufferedReader br; StringTokenizer st; FastReader() { br = new BufferedReader(new InputStreamReader(System.in))...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
bcdab5dc29004ca4bfc3e5c2e041f3eb
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { TaskC Solver = new TaskC(); Solver.Solve(); } private static class TaskC { private void Solve() { Scanner in = new Scanner(System.in); int n = in.nextInt(); int...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
47d1210cda87c5e9a2ac63024b19f980
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.FileNotFoundException; import java.util.StringTokenizer; import java.io.Writer; import java.io.Buffer...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
ebfd2f72661c5106256157f44d2f73bc
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc =new Scanner(System.in); int n=sc.nextInt(); double r=sc.nextDouble(); int xcoord[] =new int[n]; double ycoord[]= new double[n]; for(int i=0;i<n;i++) {...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
faf0f1f3f4b93fee7d28aa0d51cd76e5
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class NEW_YEAR_AND_CURLING { public static void main(String[] args) { Scanner nik = new Scanner(System.in); int n = nik.nextInt(); int r = nik.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = nik.nextInt(); } HashMa...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
e085f4bebddce7cbd73d2d60d3433f60
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String[] args) throws IOException { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); int n = in.nextInt(); double r = in.nextInt(); double[...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
2d9089894a7a211592e82b7d40b7e831
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Sa...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
ae491da9af00ac6c15d09adae9bfdaab
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.File; import java.io.FileNotFoundException; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.FileRe...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
ad6adb4397355ad8a8eebfc56a6774a3
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.util.Scanner; import java.util.Stack; public class soez { public static void main(String args[]) { Scanner scan=new Scanner(System.in); int n=scan.nextInt(); int r=scan.nextInt(); int ar[]=new int[n]; double ys[]=new double[100000]; for(int i=0;i<n;i++) { ar[i]=scan.nextInt(); } //will alw...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
f8117aa6bf2757e54deaf0ff1dc17853
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.io.*; import java.util.*; public class C { static class Disk { int i; double yc; Disk(int i, double yc) { this.i = i; this.yc = yc;} @Override public String toString() { return "Disk " + i + " @ " + yc; } } public static void main(Str...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
a87416799937b252fdadc31211fbc82c
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.awt.*; import java.io.*; import java.util.*; public class TaskC { public static void main(String[] args) { new TaskC(System.in, System.out); } static class Solver implements Runnable { int n; double r; double[] x, heights; InputReader in; PrintWriter out; void solve() throws IOExceptio...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
14290463177d93d54827c2310196cbde
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.io.*; import java.util.*; /* * CodeForces GoodBye2017 Curling * @derrick20 */ public class Curling { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); R = sc.nextDouble(); x = new double[N]; y ...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
2d65b54f108d1435f18256852562717a
train_002.jsonl
1514562000
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i-th disk, she will place its center at the point (xi, 10100). She will then...
256 megabytes
import java.awt.Point; import java.awt.geom.Point2D; import java.math.BigDecimal; import java.math.MathContext; import java.util.Scanner; import java.util.*; public class Ctask { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(), r ...
Java
["6 2\n5 5 6 8 3 12"]
2 seconds
["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613"]
NoteThe final positions of the disks will look as follows: In particular, note the position of the last disk.
Java 8
standard input
[ "implementation", "geometry", "brute force", "math" ]
3cd019d1016cb3b872ea956c312889eb
The first line will contain two integers n and r (1 ≀ n, r ≀ 1 000), the number of disks, and the radius of the disks, respectively. The next line will contain n integers x1, x2, ..., xn (1 ≀ xi ≀ 1 000)Β β€” the x-coordinates of the disks.
1,500
Print a single line with n numbers. The i-th number denotes the y-coordinate of the center of the i-th disk. The output will be accepted if it has absolute or relative error at most 10 - 6. Namely, let's assume that your answer for a particular value of a coordinate is a and the answer of the jury is b. The checker pro...
standard output
PASSED
143e40cef7ce88483e848960c6d401ec
train_002.jsonl
1589628900
You have to restore the wall. The wall consists of $$$N$$$ pillars of bricks, the height of the $$$i$$$-th pillar is initially equal to $$$h_{i}$$$, the height is measured in number of bricks. After the restoration all the $$$N$$$ pillars should have equal heights.You are allowed the following operations: put a brick o...
256 megabytes
import java.io.BufferedOutputStream; import java.io.Closeable; import java.io.DataInputStream; import java.io.Flushable; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.InputMismatchException; /** * Built using CHelper plug-in * Actual solution is at the top */ ...
Java
["3 1 100 100\n1 3 8", "3 100 1 100\n1 3 8", "3 100 100 1\n1 3 8", "5 1 2 4\n5 5 3 6 5", "5 1 2 2\n5 5 3 6 5"]
1 second
["12", "9", "4", "4", "3"]
null
Java 11
standard input
[ "greedy", "math", "sortings", "binary search", "ternary search" ]
c9c65223b8575676647fe943f8dff25a
The first line of input contains four integers $$$N$$$, $$$A$$$, $$$R$$$, $$$M$$$ ($$$1 \le N \le 10^{5}$$$, $$$0 \le A, R, M \le 10^{4}$$$)Β β€” the number of pillars and the costs of operations. The second line contains $$$N$$$ integers $$$h_{i}$$$ ($$$0 \le h_{i} \le 10^{9}$$$)Β β€” initial heights of pillars.
2,100
Print one integerΒ β€” the minimal cost of restoration.
standard output
PASSED
97dc38a65a1d4d802b391a11bfa0751f
train_002.jsonl
1589628900
You have to restore the wall. The wall consists of $$$N$$$ pillars of bricks, the height of the $$$i$$$-th pillar is initially equal to $$$h_{i}$$$, the height is measured in number of bricks. After the restoration all the $$$N$$$ pillars should have equal heights.You are allowed the following operations: put a brick o...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class E { static class Task { private long getCost(int h, int[] hArr, int a, int r, int m) { long addCount = 0; long removeCount = 0; for (int num : hArr) { if (num < h)...
Java
["3 1 100 100\n1 3 8", "3 100 1 100\n1 3 8", "3 100 100 1\n1 3 8", "5 1 2 4\n5 5 3 6 5", "5 1 2 2\n5 5 3 6 5"]
1 second
["12", "9", "4", "4", "3"]
null
Java 11
standard input
[ "greedy", "math", "sortings", "binary search", "ternary search" ]
c9c65223b8575676647fe943f8dff25a
The first line of input contains four integers $$$N$$$, $$$A$$$, $$$R$$$, $$$M$$$ ($$$1 \le N \le 10^{5}$$$, $$$0 \le A, R, M \le 10^{4}$$$)Β β€” the number of pillars and the costs of operations. The second line contains $$$N$$$ integers $$$h_{i}$$$ ($$$0 \le h_{i} \le 10^{9}$$$)Β β€” initial heights of pillars.
2,100
Print one integerΒ β€” the minimal cost of restoration.
standard output
PASSED
ab75828e81e37e1f8e9d45083895c13a
train_002.jsonl
1589628900
You have to restore the wall. The wall consists of $$$N$$$ pillars of bricks, the height of the $$$i$$$-th pillar is initially equal to $$$h_{i}$$$, the height is measured in number of bricks. After the restoration all the $$$N$$$ pillars should have equal heights.You are allowed the following operations: put a brick o...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class E { static class Task { private long getCost(int h, int[] hArr, int a, int r, int m) { long addCount = 0; long removeCount = 0; for (int num : hArr) { if (num < h)...
Java
["3 1 100 100\n1 3 8", "3 100 1 100\n1 3 8", "3 100 100 1\n1 3 8", "5 1 2 4\n5 5 3 6 5", "5 1 2 2\n5 5 3 6 5"]
1 second
["12", "9", "4", "4", "3"]
null
Java 11
standard input
[ "greedy", "math", "sortings", "binary search", "ternary search" ]
c9c65223b8575676647fe943f8dff25a
The first line of input contains four integers $$$N$$$, $$$A$$$, $$$R$$$, $$$M$$$ ($$$1 \le N \le 10^{5}$$$, $$$0 \le A, R, M \le 10^{4}$$$)Β β€” the number of pillars and the costs of operations. The second line contains $$$N$$$ integers $$$h_{i}$$$ ($$$0 \le h_{i} \le 10^{9}$$$)Β β€” initial heights of pillars.
2,100
Print one integerΒ β€” the minimal cost of restoration.
standard output
PASSED
7304578a18f5a0ecc1c470623a0260ba
train_002.jsonl
1589628900
You have to restore the wall. The wall consists of $$$N$$$ pillars of bricks, the height of the $$$i$$$-th pillar is initially equal to $$$h_{i}$$$, the height is measured in number of bricks. After the restoration all the $$$N$$$ pillars should have equal heights.You are allowed the following operations: put a brick o...
256 megabytes
import java.io.*; import java.util.*; public class Abc { static long n,a,r,m; public static void main(String[] args) throws Exception { FastReader sc = new FastReader(); n=sc.nextInt();a=sc.nextInt();r=sc.nextInt();m=Math.min(sc.nextInt(),a+r); long h[]=new long[(int) n]; for (...
Java
["3 1 100 100\n1 3 8", "3 100 1 100\n1 3 8", "3 100 100 1\n1 3 8", "5 1 2 4\n5 5 3 6 5", "5 1 2 2\n5 5 3 6 5"]
1 second
["12", "9", "4", "4", "3"]
null
Java 11
standard input
[ "greedy", "math", "sortings", "binary search", "ternary search" ]
c9c65223b8575676647fe943f8dff25a
The first line of input contains four integers $$$N$$$, $$$A$$$, $$$R$$$, $$$M$$$ ($$$1 \le N \le 10^{5}$$$, $$$0 \le A, R, M \le 10^{4}$$$)Β β€” the number of pillars and the costs of operations. The second line contains $$$N$$$ integers $$$h_{i}$$$ ($$$0 \le h_{i} \le 10^{9}$$$)Β β€” initial heights of pillars.
2,100
Print one integerΒ β€” the minimal cost of restoration.
standard output
PASSED
81f82ce55833337e361b794afd41e19d
train_002.jsonl
1589628900
You have to restore the wall. The wall consists of $$$N$$$ pillars of bricks, the height of the $$$i$$$-th pillar is initially equal to $$$h_{i}$$$, the height is measured in number of bricks. After the restoration all the $$$N$$$ pillars should have equal heights.You are allowed the following operations: put a brick o...
256 megabytes
// Working program with FastReader import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; import java.util.TreeMap; public class problem5 { static class FastReader { BufferedReader...
Java
["3 1 100 100\n1 3 8", "3 100 1 100\n1 3 8", "3 100 100 1\n1 3 8", "5 1 2 4\n5 5 3 6 5", "5 1 2 2\n5 5 3 6 5"]
1 second
["12", "9", "4", "4", "3"]
null
Java 11
standard input
[ "greedy", "math", "sortings", "binary search", "ternary search" ]
c9c65223b8575676647fe943f8dff25a
The first line of input contains four integers $$$N$$$, $$$A$$$, $$$R$$$, $$$M$$$ ($$$1 \le N \le 10^{5}$$$, $$$0 \le A, R, M \le 10^{4}$$$)Β β€” the number of pillars and the costs of operations. The second line contains $$$N$$$ integers $$$h_{i}$$$ ($$$0 \le h_{i} \le 10^{9}$$$)Β β€” initial heights of pillars.
2,100
Print one integerΒ β€” the minimal cost of restoration.
standard output
PASSED
e0e56153e9f7c4cda0b16775b3b2840c
train_002.jsonl
1589628900
You have to restore the wall. The wall consists of $$$N$$$ pillars of bricks, the height of the $$$i$$$-th pillar is initially equal to $$$h_{i}$$$, the height is measured in number of bricks. After the restoration all the $$$N$$$ pillars should have equal heights.You are allowed the following operations: put a brick o...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.stream.IntStream; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.util.Random; import java.util.OptionalInt; import java.io.InputStr...
Java
["3 1 100 100\n1 3 8", "3 100 1 100\n1 3 8", "3 100 100 1\n1 3 8", "5 1 2 4\n5 5 3 6 5", "5 1 2 2\n5 5 3 6 5"]
1 second
["12", "9", "4", "4", "3"]
null
Java 11
standard input
[ "greedy", "math", "sortings", "binary search", "ternary search" ]
c9c65223b8575676647fe943f8dff25a
The first line of input contains four integers $$$N$$$, $$$A$$$, $$$R$$$, $$$M$$$ ($$$1 \le N \le 10^{5}$$$, $$$0 \le A, R, M \le 10^{4}$$$)Β β€” the number of pillars and the costs of operations. The second line contains $$$N$$$ integers $$$h_{i}$$$ ($$$0 \le h_{i} \le 10^{9}$$$)Β β€” initial heights of pillars.
2,100
Print one integerΒ β€” the minimal cost of restoration.
standard output
PASSED
b56bda84fd0595607dce3736c47b43f4
train_002.jsonl
1589628900
You have to restore the wall. The wall consists of $$$N$$$ pillars of bricks, the height of the $$$i$$$-th pillar is initially equal to $$$h_{i}$$$, the height is measured in number of bricks. After the restoration all the $$$N$$$ pillars should have equal heights.You are allowed the following operations: put a brick o...
256 megabytes
//package round643; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class E { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(); lon...
Java
["3 1 100 100\n1 3 8", "3 100 1 100\n1 3 8", "3 100 100 1\n1 3 8", "5 1 2 4\n5 5 3 6 5", "5 1 2 2\n5 5 3 6 5"]
1 second
["12", "9", "4", "4", "3"]
null
Java 11
standard input
[ "greedy", "math", "sortings", "binary search", "ternary search" ]
c9c65223b8575676647fe943f8dff25a
The first line of input contains four integers $$$N$$$, $$$A$$$, $$$R$$$, $$$M$$$ ($$$1 \le N \le 10^{5}$$$, $$$0 \le A, R, M \le 10^{4}$$$)Β β€” the number of pillars and the costs of operations. The second line contains $$$N$$$ integers $$$h_{i}$$$ ($$$0 \le h_{i} \le 10^{9}$$$)Β β€” initial heights of pillars.
2,100
Print one integerΒ β€” the minimal cost of restoration.
standard output
PASSED
a3001f87b88dfe86c1e0eccca24d62c6
train_002.jsonl
1589628900
You have to restore the wall. The wall consists of $$$N$$$ pillars of bricks, the height of the $$$i$$$-th pillar is initially equal to $$$h_{i}$$$, the height is measured in number of bricks. After the restoration all the $$$N$$$ pillars should have equal heights.You are allowed the following operations: put a brick o...
256 megabytes
import java.io.*; import java.util.*; public class E { public static void main (String[] args) { new E(); } int N; int ADD, REM, MOV; long TOTSUM; int[] a; public E() { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); System.err.println(""); N = fs.nextInt(); ADD =...
Java
["3 1 100 100\n1 3 8", "3 100 1 100\n1 3 8", "3 100 100 1\n1 3 8", "5 1 2 4\n5 5 3 6 5", "5 1 2 2\n5 5 3 6 5"]
1 second
["12", "9", "4", "4", "3"]
null
Java 11
standard input
[ "greedy", "math", "sortings", "binary search", "ternary search" ]
c9c65223b8575676647fe943f8dff25a
The first line of input contains four integers $$$N$$$, $$$A$$$, $$$R$$$, $$$M$$$ ($$$1 \le N \le 10^{5}$$$, $$$0 \le A, R, M \le 10^{4}$$$)Β β€” the number of pillars and the costs of operations. The second line contains $$$N$$$ integers $$$h_{i}$$$ ($$$0 \le h_{i} \le 10^{9}$$$)Β β€” initial heights of pillars.
2,100
Print one integerΒ β€” the minimal cost of restoration.
standard output
PASSED
75362a252ebcd65b05092d0e51352f91
train_002.jsonl
1589628900
You have to restore the wall. The wall consists of $$$N$$$ pillars of bricks, the height of the $$$i$$$-th pillar is initially equal to $$$h_{i}$$$, the height is measured in number of bricks. After the restoration all the $$$N$$$ pillars should have equal heights.You are allowed the following operations: put a brick o...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; ...
Java
["3 1 100 100\n1 3 8", "3 100 1 100\n1 3 8", "3 100 100 1\n1 3 8", "5 1 2 4\n5 5 3 6 5", "5 1 2 2\n5 5 3 6 5"]
1 second
["12", "9", "4", "4", "3"]
null
Java 11
standard input
[ "greedy", "math", "sortings", "binary search", "ternary search" ]
c9c65223b8575676647fe943f8dff25a
The first line of input contains four integers $$$N$$$, $$$A$$$, $$$R$$$, $$$M$$$ ($$$1 \le N \le 10^{5}$$$, $$$0 \le A, R, M \le 10^{4}$$$)Β β€” the number of pillars and the costs of operations. The second line contains $$$N$$$ integers $$$h_{i}$$$ ($$$0 \le h_{i} \le 10^{9}$$$)Β β€” initial heights of pillars.
2,100
Print one integerΒ β€” the minimal cost of restoration.
standard output
PASSED
4e1cc68c8ea2d93cbf4478a279445132
train_002.jsonl
1589628900
You have to restore the wall. The wall consists of $$$N$$$ pillars of bricks, the height of the $$$i$$$-th pillar is initially equal to $$$h_{i}$$$, the height is measured in number of bricks. After the restoration all the $$$N$$$ pillars should have equal heights.You are allowed the following operations: put a brick o...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; ...
Java
["3 1 100 100\n1 3 8", "3 100 1 100\n1 3 8", "3 100 100 1\n1 3 8", "5 1 2 4\n5 5 3 6 5", "5 1 2 2\n5 5 3 6 5"]
1 second
["12", "9", "4", "4", "3"]
null
Java 11
standard input
[ "greedy", "math", "sortings", "binary search", "ternary search" ]
c9c65223b8575676647fe943f8dff25a
The first line of input contains four integers $$$N$$$, $$$A$$$, $$$R$$$, $$$M$$$ ($$$1 \le N \le 10^{5}$$$, $$$0 \le A, R, M \le 10^{4}$$$)Β β€” the number of pillars and the costs of operations. The second line contains $$$N$$$ integers $$$h_{i}$$$ ($$$0 \le h_{i} \le 10^{9}$$$)Β β€” initial heights of pillars.
2,100
Print one integerΒ β€” the minimal cost of restoration.
standard output
PASSED
90b7b6c85b5bc3f4edbcac1c8a56bd2c
train_002.jsonl
1589628900
You have to restore the wall. The wall consists of $$$N$$$ pillars of bricks, the height of the $$$i$$$-th pillar is initially equal to $$$h_{i}$$$, the height is measured in number of bricks. After the restoration all the $$$N$$$ pillars should have equal heights.You are allowed the following operations: put a brick o...
256 megabytes
import java.io.*; import java.util.*; public class Main { private long cal(List<Integer> h, long rh, int A, int R, int M) { long top = 0, down = 0; for (int hv : h) { top += Math.max(0, hv - rh); down += Math.max(0, rh - hv); } if (top > down) { ...
Java
["3 1 100 100\n1 3 8", "3 100 1 100\n1 3 8", "3 100 100 1\n1 3 8", "5 1 2 4\n5 5 3 6 5", "5 1 2 2\n5 5 3 6 5"]
1 second
["12", "9", "4", "4", "3"]
null
Java 11
standard input
[ "greedy", "math", "sortings", "binary search", "ternary search" ]
c9c65223b8575676647fe943f8dff25a
The first line of input contains four integers $$$N$$$, $$$A$$$, $$$R$$$, $$$M$$$ ($$$1 \le N \le 10^{5}$$$, $$$0 \le A, R, M \le 10^{4}$$$)Β β€” the number of pillars and the costs of operations. The second line contains $$$N$$$ integers $$$h_{i}$$$ ($$$0 \le h_{i} \le 10^{9}$$$)Β β€” initial heights of pillars.
2,100
Print one integerΒ β€” the minimal cost of restoration.
standard output
PASSED
c2fcee1c67471039e6f34f3a0d196b55
train_002.jsonl
1589628900
You have to restore the wall. The wall consists of $$$N$$$ pillars of bricks, the height of the $$$i$$$-th pillar is initially equal to $$$h_{i}$$$, the height is measured in number of bricks. After the restoration all the $$$N$$$ pillars should have equal heights.You are allowed the following operations: put a brick o...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; 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.ut...
Java
["3 1 100 100\n1 3 8", "3 100 1 100\n1 3 8", "3 100 100 1\n1 3 8", "5 1 2 4\n5 5 3 6 5", "5 1 2 2\n5 5 3 6 5"]
1 second
["12", "9", "4", "4", "3"]
null
Java 11
standard input
[ "greedy", "math", "sortings", "binary search", "ternary search" ]
c9c65223b8575676647fe943f8dff25a
The first line of input contains four integers $$$N$$$, $$$A$$$, $$$R$$$, $$$M$$$ ($$$1 \le N \le 10^{5}$$$, $$$0 \le A, R, M \le 10^{4}$$$)Β β€” the number of pillars and the costs of operations. The second line contains $$$N$$$ integers $$$h_{i}$$$ ($$$0 \le h_{i} \le 10^{9}$$$)Β β€” initial heights of pillars.
2,100
Print one integerΒ β€” the minimal cost of restoration.
standard output
PASSED
26b78ea984f6e5b27f131e0222aa9eec
train_002.jsonl
1589628900
You have to restore the wall. The wall consists of $$$N$$$ pillars of bricks, the height of the $$$i$$$-th pillar is initially equal to $$$h_{i}$$$, the height is measured in number of bricks. After the restoration all the $$$N$$$ pillars should have equal heights.You are allowed the following operations: put a brick o...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); static int N; static long A, R, M; static int[] H; static long[] sum; public static void main(String[] args) { N = sc.nextInt(); A = sc...
Java
["3 1 100 100\n1 3 8", "3 100 1 100\n1 3 8", "3 100 100 1\n1 3 8", "5 1 2 4\n5 5 3 6 5", "5 1 2 2\n5 5 3 6 5"]
1 second
["12", "9", "4", "4", "3"]
null
Java 11
standard input
[ "greedy", "math", "sortings", "binary search", "ternary search" ]
c9c65223b8575676647fe943f8dff25a
The first line of input contains four integers $$$N$$$, $$$A$$$, $$$R$$$, $$$M$$$ ($$$1 \le N \le 10^{5}$$$, $$$0 \le A, R, M \le 10^{4}$$$)Β β€” the number of pillars and the costs of operations. The second line contains $$$N$$$ integers $$$h_{i}$$$ ($$$0 \le h_{i} \le 10^{9}$$$)Β β€” initial heights of pillars.
2,100
Print one integerΒ β€” the minimal cost of restoration.
standard output
PASSED
c0c6e6f50cee213a6bd6b38805bbc20e
train_002.jsonl
1589628900
You have to restore the wall. The wall consists of $$$N$$$ pillars of bricks, the height of the $$$i$$$-th pillar is initially equal to $$$h_{i}$$$, the height is measured in number of bricks. After the restoration all the $$$N$$$ pillars should have equal heights.You are allowed the following operations: put a brick o...
256 megabytes
import java.io.*; import java.util.*; public class Main { int n,a,r,m,h[]; long cum[]; final long inf=(long)(1e18+1); private void solve()throws IOException { n=nextInt(); a=nextInt(); r=nextInt(); m=nextInt(); h=new int[n+1]; cum=new long[n+1]; for(int i=1;i<=n;i++) h[i]=nextInt(); Arrays.sort(...
Java
["3 1 100 100\n1 3 8", "3 100 1 100\n1 3 8", "3 100 100 1\n1 3 8", "5 1 2 4\n5 5 3 6 5", "5 1 2 2\n5 5 3 6 5"]
1 second
["12", "9", "4", "4", "3"]
null
Java 11
standard input
[ "greedy", "math", "sortings", "binary search", "ternary search" ]
c9c65223b8575676647fe943f8dff25a
The first line of input contains four integers $$$N$$$, $$$A$$$, $$$R$$$, $$$M$$$ ($$$1 \le N \le 10^{5}$$$, $$$0 \le A, R, M \le 10^{4}$$$)Β β€” the number of pillars and the costs of operations. The second line contains $$$N$$$ integers $$$h_{i}$$$ ($$$0 \le h_{i} \le 10^{9}$$$)Β β€” initial heights of pillars.
2,100
Print one integerΒ β€” the minimal cost of restoration.
standard output
PASSED
2ea96d26410729040683acb831f4f24e
train_002.jsonl
1589628900
You have to restore the wall. The wall consists of $$$N$$$ pillars of bricks, the height of the $$$i$$$-th pillar is initially equal to $$$h_{i}$$$, the height is measured in number of bricks. After the restoration all the $$$N$$$ pillars should have equal heights.You are allowed the following operations: put a brick o...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.HashSet; import java.util.Iterator; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is...
Java
["3 1 100 100\n1 3 8", "3 100 1 100\n1 3 8", "3 100 100 1\n1 3 8", "5 1 2 4\n5 5 3 6 5", "5 1 2 2\n5 5 3 6 5"]
1 second
["12", "9", "4", "4", "3"]
null
Java 11
standard input
[ "greedy", "math", "sortings", "binary search", "ternary search" ]
c9c65223b8575676647fe943f8dff25a
The first line of input contains four integers $$$N$$$, $$$A$$$, $$$R$$$, $$$M$$$ ($$$1 \le N \le 10^{5}$$$, $$$0 \le A, R, M \le 10^{4}$$$)Β β€” the number of pillars and the costs of operations. The second line contains $$$N$$$ integers $$$h_{i}$$$ ($$$0 \le h_{i} \le 10^{9}$$$)Β β€” initial heights of pillars.
2,100
Print one integerΒ β€” the minimal cost of restoration.
standard output
PASSED
87a0d60b4db63ef5fa347d8183d13d88
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.Scanner; public class Army { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int [] di= new int [n-1]; for(int i=0;i<di.length;i++) di[i]=sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); ...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
82bb02c8989206b407a88f72cbf08bc5
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.Scanner; public class Two { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int n1=n-1; int [] tmp=new int [n1]; for(int i=0;i<n1;i++){ tmp[i]=sc.nextInt(); } int a=s...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
b47e922e9a664ab99fdf3325353fea4e
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.*; public class fuchacm { public static void main(String []args){ int d=0; Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int arr[]=new int [n-1]; int s=0; for (int i = 0; i < n-1; i++) { arr[i]=sc.nextInt(); } int a=sc.nextInt();int b=sc.nextInt(); for(int i=a-1;i<b-1;i++){ ...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
a11ba1f8bbedd0811b6770ed18ea7a04
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Monty1{ public static void main(String[] args) { Scanner s=new Scanner(System.in); int a,b,sum=0,n,i; int[] z=new int[100]; n=s.nextInt(); z[0]=0; for (i = 1; i < n; i++) { z[i]=s.nextInt(); ...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
330dde162c94a2d3acae414fdd04dd2a
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Atanas */ public class Main { public static void main(String[] args) { InputStream in...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
b00da0073bb4afc273dd2c29f3043a98
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
56714bf4dc15e6e529ac354df4764409
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class CP { public static void main(String[] args) { InputStreamReader ir = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(ir); String line; String[] ar; try { int n = Integ...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
f1c601f56997a0059fbaaa9a85ae8e32
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.Scanner; public class raef{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int[] arr=new int[n-1]; for(int i=0;i<n-1;i++){ int x=sc.nextInt(); arr[i]=x; } ...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
d8f3890a7eb087a482f4dc4d34f0d65c
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.Scanner; public class Army { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[]array = new int[n-1]; for (int i = 0; i < array.length; i++) { array[i] = scan.nextInt(); } int a = scan.nextInt(); int b = scan.nextInt(); i...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
dd89d652e6a669020b1922bd49132504
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.Scanner; public class Army { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[]array = new int[n-1]; for (int i = 0; i < array.length; i++) { array[i] = scan.nextInt(); } int a = scan.nextInt(); int b = scan.nextInt(); i...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
973e332cfca67904aac7632b3c8dbdfd
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.lang.*; import java.util.*; import java.io.*; public class test { Scanner sc=new Scanner(System.in); PrintWriter pr=new PrintWriter(System.out,true); public static void main(String... args) { test c=new test(); c.prop(); } public void prop() { int n,x,y,sum=0; n=sc...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
b1c05f467219350c79058ba7492313b6
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt() - 1; int[] d = new int[n]; for (int i = 0; i < n; i++) { d[i] = sc.nextInt(); } int a = sc.nextInt() - 1; ...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
06b2ba463bffa94cf328ab26315bfff0
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.Scanner; public class Army { public static void main(String[] args) { Scanner scan= new Scanner(System.in); int n=scan.nextInt(); int[] a= new int[n]; int c=0; for(int i=0;i<n-1;i++) { a[i]=scan.nextInt(); } int a1= scan.nextInt(); int b=scan.nextInt(); int ans=0; for(int i=...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
ab73e38e037d9e31f9ecdf4dbd7245e5
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.io.IOException ; import java.io.BufferedReader ; import java.io.InputStreamReader ; import java.io.PrintWriter ; import java.util.StringTokenizer ; import java.util.*; public class MY { public static void main (String [] args) throws IOException { BufferedReader p = new BufferedReader (new InputStream...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
17983c2bb6cc6edf496c8dd36eb487a2
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.*; import java.util.Map.Entry; import java.io.*; public class Q1 { static int[]d; static int[][]memo; public static voi...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
a8e65303c3671bea9da1f5364c77c4e4
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.*; import java.util.Map.Entry; import java.io.*; public class Q1 { static int[]d; public static void main(String[] args) ...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
67ce3ee65f22a647a8b1145636b04ce0
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int arr[] = new int[n]; for (int i = 0; i < n - 1; i++) { arr[i] = in.nextInt(); } int a = in.nextInt(); int b = in.nextInt(); int sum = 0; for (; a ...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
21938edbaa688f823c0cac9598ce214a
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); int[] arr = new int[a - 1]; int sum = 0; for (int i = 0; i < arr.length; i++) { arr[i] = in.nextInt(); } int a1 = in.nextInt(); ...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
eb5c96ef13b7d9c41df0971a26baf733
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scn=new Scanner(System.in); int n=Integer.parseInt(scn.nextLine()); int[] container=new int[n-1]; for(int i=0; i<n-1; i++) container[i]=s...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
58d3dd0f202eeed618cca3487cf89195
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.Scanner; public class bobosdf { public static void main(String[] args) { Scanner in = new Scanner(System.in); int x = in.nextInt(); int[] levels = new int[x]; for (int i = 0; i < x-1; i++) { levels[i] = in.nextInt(); } int a = in.nextInt...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
15b8a507b4df26e34d46bc733681d8ec
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.Scanner; public class rank { public static void main(String[] args) { Scanner cin=new Scanner(System.in); int rank=cin.nextInt(); int []year=new int[rank-1]; int sum=0; for(int i=0;i<rank-1;i++) { year[i]=cin.nextInt(); ...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
e0b78d490c8b291c6f4bbfeb56404714
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.Scanner; public class chion { public static void main(String[] args) { Scanner cin=new Scanner(System.in); int arr[]=new int[cin.nextInt()]; arr[1]=cin.nextInt(); for (int i = 2; i < arr.length; i++) { arr[i]=cin.nextInt(); arr[i]+=arr[i-1];...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
b09ae88eb247dc850e98fe42fbfc47c6
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.*; public class Army { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int ar[]=new int[n-1]; for(int i=0;i<n-1;i++) ar[i]=sc.nextInt(); int a=sc.nextInt(); int b=sc.nextInt(); int sum=0; for(int i=a-1;i<b-1;i++) { sum=sum+ar[i];...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
a78c5e0aa6300db5745b9457853097f5
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.io.*; import java.math.*; import java.text.*; import java.util.*; import java.util.regex.*; public class Solution{ InputStream is; PrintWriter out; String INPUT = ""; Random r = new Random(); Scanner in=new Scanner(System.in); long mod=1000000007l; public void solve(){ ...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
f376f3ff3a81c161c6be9834008ab6b3
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Hello{ InputStream is; PrintWriter out; String INPUT = ""; Scanner in=new Scanner(System.in); public void solve(){ in...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
99466c823e82e274beb5a4e67d071adb
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int [] year = new int [n-1]; for (int i = 0; i < year.length; i++) { year [i]= input.nextInt(); } ...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output
PASSED
3dac7c34236afdc3de7f21ab61cb5635
train_002.jsonl
1288440000
The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i + 1. Reaching a certain rank i having not reached all the previous i - 1 ranks is impossible.Vasya has ju...
256 megabytes
import java.util.*; public class CodeForces { public static void main(String[] args){ //BufferedReader input=new BufferedReader(new InputStreamReader(System.in)); Scanner input=new Scanner(System.in); int n=input.nextInt(); int sum=0; int []years=new int[n-1]; for(int...
Java
["3\n5 6\n1 2", "3\n5 6\n1 3"]
2 seconds
["5", "11"]
null
Java 8
standard input
[ "implementation" ]
69850c2af99d60711bcff5870575e15e
The first input line contains an integer n (2 ≀ n ≀ 100). The second line contains n - 1 integers di (1 ≀ di ≀ 100). The third input line contains two integers a and b (1 ≀ a &lt; b ≀ n). The numbers on the lines are space-separated.
800
Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.
standard output