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
aca2f863f4d90dcf7f13ef4626e82f88
train_001.jsonl
1398612600
As usual, Sereja has array a, its elements are integers: a[1], a[2], ..., a[n]. Let's introduce notation:A swap operation is the following sequence of actions: choose two indexes i, j (i ≠ j); perform assignments tmp = a[i], a[i] = a[j], a[j] = tmp. What maximum value of function m(a) can Sereja get if he is allowed ...
256 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import...
Java
["10 2\n10 -1 2 2 2 2 2 2 -1 10", "5 10\n-1 -1 -1 -1 -1"]
1 second
["32", "-1"]
null
Java 11
standard input
[ "two pointers", "sortings", "brute force" ]
ff69d22bc683e5d1d83438585224c774
The first line contains two integers n and k (1 ≀ n ≀ 200;Β 1 ≀ k ≀ 10). The next line contains n integers a[1], a[2], ..., a[n] ( - 1000 ≀ a[i] ≀ 1000).
1,500
In a single line print the maximum value of m(a) that Sereja can get if he is allowed to perform at most k swap operations.
standard output
PASSED
bd89ec4446bce55f5b29f128405144e1
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
import java.util.Scanner; import java.util.Arrays; public class Balanced { public static void main(String[] args) { Scanner sc= new Scanner(System.in); Integer t= sc.nextInt(); Integer[] l=new Integer[t]; for( Integer i=0; i< l.length;i++){ l[i]=sc.nextInt(); } Arrays.sort(l); i...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
9a76a04522c6dbfe43fbf5b03e4554e9
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class GFG { public static void main (String[] args) { PrintWriter pw=new PrintWriter(System.out); Scanner sc=new Scanner(System.in); int n=sc.nextInt(); Integer[] a=new Integer[n]; for(int i=0;i<n;i++) a[i]=sc.nextInt(); A...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
01bd861bd76a42b4d7a031154acb081a
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
//package CodeforcesProject; import java.io.*; import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Input.input = new Input(); Output.output = new Output(); int quantity = Input.input.ReadInt(); int[] base = Input.in...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
18cb78da239cb75959d24e2be4fed9bd
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
//package CodeforcesProject; import java.io.*; import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Input.input = new Input(); Output.output = new Output(); int quantity = Input.input.ReadInt(); int[] base = Input.in...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
1479f833780f79e5ec20cb72ca1ff808
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
//package CodeforcesProject; import java.io.*; import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Input.input = new Input(); Output.output = new Output(); int quantity = Input.input.ReadInt(); int[] base = Input.in...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
c1bf934367a0fe041b71534313189a21
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
//package CodeforcesProject; import java.io.*; import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Input.input = new Input(); Output.output = new Output(); int quantity = Input.input.ReadInt(); int[] base = Input.in...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
5bf8806f7ed7b6bca13ae5a8a893be74
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
import java.util.*; import java.io.*; public class C544 { public static void main(String[] args) { FastScanner in = new FastScanner(System.in); int N = in.nextInt(); ArrayList<Integer> list = new ArrayList<>(); for(int i = 0; i < N; i++) list.add(in.nextInt()); ...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
c078d7d63e67dea47c32cfabee7c6ea6
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
import java.util.*; import java.io.*; public class Main { static void swap(int arr[], int ind1, int ind2) { int temp = arr[ind1]; arr[ind1]= arr[ind2]; arr[ind2] = temp; } public static void main(String args[]) throws IOException { Scanner scan = new Scanner(System.in)...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
3ac0b3dfff032f72d937e0d8f7e87d67
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
import java.io.*; import java.util.Arrays; import java.math.*; public class main { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(System.out)); int n = Integer.pars...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
fb6174f5d199abe34963a30903802686
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class Main { static InputReader scan = new InputReader(new Bu...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
bf494435ce50325b01e88b80b877a49c
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; public class Main { static InputReader scan = new InputReader(new BufferedInpu...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
e98cd73103804f5e3a3c3764831ea97b
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
import java.util.*; import java.io.*; public class Aaaa { public static void main(String args[]) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(br.readLine()); ArrayList<Integer> a=new ArrayList<>(); String line...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
b2cd1d2d2751da1bcaee71c9e78975a9
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
import java.util.*; import java.io.*; public class aaaaaaaaaaaaaaaa { public void run() throws Exception { FastReader file = new FastReader(); int times = file.nextInt(); ArrayList<Long> n = new ArrayList(); for (int i = 0; i < times; i++) { n.add(file.nextLong()); } Collections.sort(n); int max = 0;...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
bea8772579102871a8782a0e1ca31691
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class b { static int c=0; public static int[] mergesort(int [] a,int[] b){ int i=0; int j=0; int h=0; int k[] = new int[a.length+b.length]; while(i<a.length && j<b.length){ if(a[i]<=b[j]){ ...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
961b5b68abd376b768838b3c8b43a332
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Solve6 { public static void main(String[] args) throws IOException { PrintWriter pw = new PrintWriter(System.out)...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
8c9949d5591886ccbc821944a1bb9e33
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.LinkedList; import java.util.StringTokenizer; public class Solve6 { public static void main...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
dcdd99941c546ac88d3a2c02cc01443c
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class BalancedTeam { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(), max = 0, i_1=0, i_2=0; Integer[] a = new Integer[n]; for (int i = 0; i < n; i++) { a[i]=i...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
f2ca233032228a41e94474b01759a32d
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class BalancedTeam { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(), m=0, a=0, b=0; Integer[] l = new Integer[n]; for (int i=0; i<n; i++) l[i] = in.nextInt(); ...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
277ff70f3ad5e7f26cc96d2366a09b53
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class BalancedTeam { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n=in.nextInt(), max=0, i_1=0, i_2=0; Integer[] a = new Integer[n]; for (int i = 0; i < n; i++) a[i]=in.nextInt...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
836f77bc4312e4d4478d6d8f512fa7dc
train_001.jsonl
1551971100
You are a coach at your local university. There are $$$n$$$ students under your supervision, the programming skill of the $$$i$$$-th student is $$$a_i$$$.You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a te...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class newwinwae { public static void main(String args[]) { Scanner scan=new Scanner(System.in); int n=scan.nextInt(); HashMap<Integer,Integer> map=new HashMap<Integer,Integer>(); int ar[]=new int[n]; for(int i=0;i<n;i++) { ar[i]=scan.nextIn...
Java
["6\n1 10 17 12 15 2", "10\n1337 1337 1337 1337 1337 1337 1337 1337 1337 1337", "6\n1 1000 10000 10 100 1000000000"]
2 seconds
["3", "10", "1"]
NoteIn the first example you can create a team with skills $$$[12, 17, 15]$$$.In the second example you can take all students in a team because their programming skills are equal.In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).
Java 8
standard input
[ "two pointers", "sortings" ]
8b075d96b3c0172d756109b4801d68de
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of students. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is a programming skill of the $$$i$$$-th student.
1,200
Print one integer β€” the maximum possible number of students in a balanced team.
standard output
PASSED
6f0250a0233f611719f8208aaed808df
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class C3 { static FastScanner in = new FastScanner(System.in); publ...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
75be7914be98be27240625644704d203
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; public class C { public static BufferedReader in; public static PrintWriter out; public static void main(String[] args) throws IOException { in = new BufferedReader(ne...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
4240a480d6bd28d681eface53a2b81c8
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.*; import java.util.*; public class Pr279C { public static void main(String[] args) throws IOException { new Pr279C().run(); } BufferedReader in; PrintWriter out; StringTokenizer st; String nextToken() throws IOException { while (st == null || !st.hasMoreTokens()) { st = new StringTokeniz...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
ba32d47b7721349414f58b64974c2c16
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Ladder { public static void main(String[] args) throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer s...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
dffaedad891243afc7a4a1900d354055
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Random; import java.util.StringTokenizer; /** * @author Polyarniy Nickolay */ public class Proble...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
4ba35f56c1a53cd09da428965dca8457
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.InputMismatchException; public class C { public static void main(String[] args) { InputReader in = new InputReader(System.in); int n = in.readInt(); int m = in.readInt(); int[] A = new int[n]; for (int...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
b2b81708750e335f9bc7e68a3cad9079
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
71e892f1c27da5875a53b2780996fec6
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import static java.lang.Math.*; import java.util.*; import java.io.*; public class C { public void solve() throws Exception { int n = nextInt(), m = nextInt(); int[] p = nextArr(n); int[] inc = new int[n]; int[] desc = new int[n]; int idx = 0; for (int i=0; i<n-1; ++i) { if (p[i]>p[i+1]) { ...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
9e9693e9daf60f98b31f01fe61c8a594
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.*; import java.util.*; public class C279 { BufferedReader br; StringTokenizer in; PrintWriter out; public String nextToken() throws IOException { while (in == null || !in.hasMoreTokens()) { in = new StringTokenizer(br.readLine()); } return in.nextToke...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
af22359d8747b1ff66ee51155ca65f58
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
//package codeforces; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class C { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter w...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
76c750de56e3958d603d8bf36b8757e0
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { private void solve() throws IOException { int n = nextInt(); int m = nextInt(); ...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
628cfd7f0083588914fcd006931b0a1a
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.util.*; import java.io.*; public class Codeforces { static int arr[]; static Pair dp[]; public static void main(String[] args) throws IOException { Reader.init(System.in); int n = Reader.nextInt(), m = Reader.nextInt(); int arr[] = new int[n]; f...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
5aabca4667e7e55eef8cb0a05b13d11b
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * * @author sousnake */ public class LADDER_DP { public static void main(String [] args) throws IOException{ ...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
721232f258516f97aa02e41c1a7ce1cd
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class C { public static void main(String[] args) throws Exception { int arLen = nextInt(); int queryCnt = nextInt(); int[] ar = ne...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
1b084d5d90dea2080547c0fc9b056a8f
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @auth...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
1016d7b6d11529d41f5cef9e441bb4c3
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.IOException; import java.util.InputMismatchException; public class Ladder { public static void main(String[] args) { FasterScanner sc = new FasterScanner(); int N = sc.nextInt(); int M = sc.nextInt(); int[] A = sc.nextIntArray(N, 1); int[] fw...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
4b2fff9e758a81f5abb4f0e3db3ea7de
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
// external help was required to solve this sum...my bad... import java.io.*; import java.util.*; public final class ladder { static Scanner sc=new Scanner(System.in); static PrintWriter out=new PrintWriter(System.out); static final String s1="Yes",s2="No"; public static void main(String args[]) throws Exception ...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
f2f0c4913c9d07d4e9989a4f799d19ae
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
// external help was required to solve this sum...my bad... import java.io.*; import java.util.*; public final class ladder { static Scanner sc=new Scanner(System.in); static PrintWriter out=new PrintWriter(System.out); static final String s1="Yes",s2="No"; public static void main(String args[]) throws Exception ...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
d7038631da6b1ade5eeb0f3e8920509a
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
// external help was required to solve this sum...my bad... import java.io.*; import java.util.*; public final class ladder { static Scanner sc=new Scanner(System.in); static PrintWriter out=new PrintWriter(System.out); static final String s1="Yes",s2="No"; public static void main(String args[]) throws Exception ...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
7652938fa4bf48521b32bbf8b1d20204
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.*; import java.util.*; public class C { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; void solve() throws IOException { int n = nextInt(); int q = nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); int[] toUp = new int[n]; int[]...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
75f2da973ae250bab980b2d659fd97a7
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.util.*; import static java.lang.System.*; public class A279 { Scanner sc = new Scanner(in); public static Random rand=new Random(); public void run() { int n=sc.nextInt(),m=sc.nextInt(); int[] a=nextIntArray(n); int[] l=new int[n]; int[] r=new int[n]; ...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
127f0c5068109c880f2e781905868b2d
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; // http://codeforces.com/contest/279/problem/C public class Ladder { public static void main(String[] args) { Scanner s = new Scanner(System.in); int lastNum = Integer.MIN_VALUE; int start = 1; int ...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
ea897f620af0900f44a7c6beb9f4e80a
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; // http://codeforces.com/contest/279/problem/C public class Ladder { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int m = s.nextInt(); int[] a = ...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
5a47d02138c59d45d4e1896ec2cd4c12
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.util.Scanner; import java.util.Arrays; public class C{ public static void main(String args[]){ Scanner input = new Scanner(System.in); int n = input.nextInt(); int q = input.nextInt(); int num[] = new int[n]; int to[] = new int[n]; int up[] = new int...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
8e950b0c5be62017ac1db54914d02479
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.util.Arrays; import java.util.Scanner; /** * * @author Ghost */ public class C { public static boolean DEBUG = false; public static void main(String[] args){ Scanner sc = new S...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
16072f6e223da9c6e935d42a09a6fd22
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Main2 { public static void main(String args[]){ Scanner input = new Scanner(System.in); int n = input.nextInt(); int m = input.nextInt(); int[] a = new int[n]; for(int i = 0 ; i < n ; i++){ a[i] = ...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
d289e42f63cb8fe768be11fe856ff695
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.StreamTokenizer; public class C { static StreamTokenizer st; public static void main(String[] args) throws IOException { st = new StreamToken...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
1d6a9dcdaae05d3942ce27cd2a0d064f
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; import java.math.*; public class Task { public static void main(String[] args) throws IOException { new Task().run(); } StreamTokenizer in; Scanner ins; PrintWriter out; int nextInt() throws IOException { ...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
affb75d54c09cf211855d3900598d91b
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author George Marcus */ public class Main { public static void main(String[] args) { Inpu...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
f61ba4485113722ac6f61b9fe8700449
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) { new Solution().run(); } } final class Solution implements Runnable { final static class Nim { public int index; public...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
8759f23bf1793de5e535ccf789c0ec28
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.util.*; import java.io.*; import static java.util.Arrays.*; import static java.util.Collections.*; import static java.lang.Math.*; public class C { int INF = 1 << 28; //long INF = 1L << 62; double EPS = 1e-10; void run() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
cd54f301abcbffc156f23de7ee59a1e1
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
/* Codeforces Template */ 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 { static long initTime; static final Random rnd = new Random(7777L); static boo...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
d9e3760869499b3e1471d7c30f4d60fc
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.util.*; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; public class Solution { public static void main(String[] args) { InputStrea...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
11787023d287c055ba145cd926d67ae2
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class C implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok; public static void main(String[] args) { new Thread(null, new C(), "", 64*1024*1024).start(); } public void run() { try { long t1 = 0, t2 ...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
2dd2c953d4cd4517200b6f58b619187f
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
//package com.whimsycwd.Round171; import java.util.Arrays; import java.util.Scanner; public class TaskC { static boolean[][] L; static boolean[][] R; static int n; static int m; public static void main(String[] args) { Scanner in = new Scanner(System.in); n = in.nextInt(); m = in.nextInt(); int[] a = new...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
712ca16b78a816d9b02726abf1f6ca91
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.*; import java.util.*; import java.util.List; public class Main { private static StringTokenizer st; private static BufferedReader br; public static void print(Object x) { System.out.println(x + ""); } public static String join(List<?> x, String space) { StringBuilde...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
225243b1812e314049fb8ae8127fdc6a
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.StringTokenizer; public class C { public static void main(S...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
4e4ffe21442520f0280ad2490a8f599d
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchExcep...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
d1e9a58bcb6a89b254adaecf149a77e1
train_001.jsonl
1362411000
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2, ..., ari. For each query you should check whether the correspon...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchExcep...
Java
["8 6\n1 2 1 3 3 5 2 1\n1 3\n2 3\n2 4\n8 8\n1 4\n5 8"]
2 seconds
["Yes\nYes\nNo\nYes\nNo\nYes"]
null
Java 7
standard input
[ "dp", "two pointers", "implementation" ]
c39db222c42d8e85dee5686088dc3dac
The first line contains two integers n and m (1 ≀ n, m ≀ 105) β€” the number of array elements and the number of queries. The second line contains the sequence of integers a1, a2, ..., an (1 ≀ ai ≀ 109), where number ai stands for the i-th array element. The following m lines contain the description of the queries. The i...
1,700
Print m lines, in the i-th line print word "Yes" (without the quotes), if the subsegment that corresponds to the i-th query is the ladder, or word "No" (without the quotes) otherwise.
standard output
PASSED
8553a8f1a05ad91b1c419969762448db
train_001.jsonl
1589286900
For the multiset of positive integers $$$s=\{s_1,s_2,\dots,s_k\}$$$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $$$s$$$ as follow: $$$\gcd(s)$$$ is the maximum positive integer $$$x$$$, such that all integers in $$$s$$$ are divisible on $$$x$$$. $$$\textrm{lcm}(s)$$$ is the minimum posi...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class Scan { private byte[] buf=new byte[1024]; private int index; private InputStream in; private int total; public Scan() { in=System.in; } public int scan()throws IOExcepti...
Java
["2\n1 1", "4\n10 24 40 80", "10\n540 648 810 648 720 540 594 864 972 648"]
3 seconds
["1", "40", "54"]
NoteFor the first example, $$$t=\{\textrm{lcm}(\{1,1\})\}=\{1\}$$$, so $$$\gcd(t)=1$$$.For the second example, $$$t=\{120,40,80,120,240,80\}$$$, and it's not hard to see that $$$\gcd(t)=40$$$.
Java 11
standard input
[ "number theory", "math" ]
3634a3367a1f05d1b3e8e4369e8427fb
The first line contains one integer $$$n\ (2\le n\le 100\,000)$$$. The second line contains $$$n$$$ integers, $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 200\,000$$$).
1,600
Print one integer: $$$\gcd(\{\textrm{lcm}(\{a_i,a_j\})\ |\ i&lt;j\})$$$.
standard output
PASSED
ae24cd4660b6c4629be9e87f23bec125
train_001.jsonl
1589286900
For the multiset of positive integers $$$s=\{s_1,s_2,\dots,s_k\}$$$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $$$s$$$ as follow: $$$\gcd(s)$$$ is the maximum positive integer $$$x$$$, such that all integers in $$$s$$$ are divisible on $$$x$$$. $$$\textrm{lcm}(s)$$$ is the minimum posi...
256 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); int n=Integer.parseInt(bu.readLine()); String s[]=bu.read...
Java
["2\n1 1", "4\n10 24 40 80", "10\n540 648 810 648 720 540 594 864 972 648"]
3 seconds
["1", "40", "54"]
NoteFor the first example, $$$t=\{\textrm{lcm}(\{1,1\})\}=\{1\}$$$, so $$$\gcd(t)=1$$$.For the second example, $$$t=\{120,40,80,120,240,80\}$$$, and it's not hard to see that $$$\gcd(t)=40$$$.
Java 11
standard input
[ "number theory", "math" ]
3634a3367a1f05d1b3e8e4369e8427fb
The first line contains one integer $$$n\ (2\le n\le 100\,000)$$$. The second line contains $$$n$$$ integers, $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 200\,000$$$).
1,600
Print one integer: $$$\gcd(\{\textrm{lcm}(\{a_i,a_j\})\ |\ i&lt;j\})$$$.
standard output
PASSED
bbb36570698aaab8b53479421d6765c8
train_001.jsonl
1589286900
For the multiset of positive integers $$$s=\{s_1,s_2,\dots,s_k\}$$$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $$$s$$$ as follow: $$$\gcd(s)$$$ is the maximum positive integer $$$x$$$, such that all integers in $$$s$$$ are divisible on $$$x$$$. $$$\textrm{lcm}(s)$$$ is the minimum posi...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchException; public class C { //author: Nagabhushan S Baddi private static int n; private static ...
Java
["2\n1 1", "4\n10 24 40 80", "10\n540 648 810 648 720 540 594 864 972 648"]
3 seconds
["1", "40", "54"]
NoteFor the first example, $$$t=\{\textrm{lcm}(\{1,1\})\}=\{1\}$$$, so $$$\gcd(t)=1$$$.For the second example, $$$t=\{120,40,80,120,240,80\}$$$, and it's not hard to see that $$$\gcd(t)=40$$$.
Java 11
standard input
[ "number theory", "math" ]
3634a3367a1f05d1b3e8e4369e8427fb
The first line contains one integer $$$n\ (2\le n\le 100\,000)$$$. The second line contains $$$n$$$ integers, $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 200\,000$$$).
1,600
Print one integer: $$$\gcd(\{\textrm{lcm}(\{a_i,a_j\})\ |\ i&lt;j\})$$$.
standard output
PASSED
bd4b00943853831dd5b748b962ee9e00
train_001.jsonl
1589286900
For the multiset of positive integers $$$s=\{s_1,s_2,\dots,s_k\}$$$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $$$s$$$ as follow: $$$\gcd(s)$$$ is the maximum positive integer $$$x$$$, such that all integers in $$$s$$$ are divisible on $$$x$$$. $$$\textrm{lcm}(s)$$$ is the minimum posi...
256 megabytes
import java.util.*; public class Main { static long GCD(long a, long b) { while(a > 0 && b > 0) { if (a > b) a %= b; else b %= a; } return a + b; } static long LCM(long a, long b) { return a / GCD(a, b) * b; } ...
Java
["2\n1 1", "4\n10 24 40 80", "10\n540 648 810 648 720 540 594 864 972 648"]
3 seconds
["1", "40", "54"]
NoteFor the first example, $$$t=\{\textrm{lcm}(\{1,1\})\}=\{1\}$$$, so $$$\gcd(t)=1$$$.For the second example, $$$t=\{120,40,80,120,240,80\}$$$, and it's not hard to see that $$$\gcd(t)=40$$$.
Java 11
standard input
[ "number theory", "math" ]
3634a3367a1f05d1b3e8e4369e8427fb
The first line contains one integer $$$n\ (2\le n\le 100\,000)$$$. The second line contains $$$n$$$ integers, $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 200\,000$$$).
1,600
Print one integer: $$$\gcd(\{\textrm{lcm}(\{a_i,a_j\})\ |\ i&lt;j\})$$$.
standard output
PASSED
5e83a02153950a9aba086236ef1cc100
train_001.jsonl
1589286900
For the multiset of positive integers $$$s=\{s_1,s_2,\dots,s_k\}$$$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $$$s$$$ as follow: $$$\gcd(s)$$$ is the maximum positive integer $$$x$$$, such that all integers in $$$s$$$ are divisible on $$$x$$$. $$$\textrm{lcm}(s)$$$ is the minimum posi...
256 megabytes
/** * ******* Created on 12/5/20 5:22 PM******* */ import java.io.*; import java.util.*; public class C1350 implements Runnable { private static final int MAX = 2*(int) (1E5 + 5); private static final int MOD = (int) (1E9 + 7); private static final long Inf = (long) (1E14 + 10); private static fin...
Java
["2\n1 1", "4\n10 24 40 80", "10\n540 648 810 648 720 540 594 864 972 648"]
3 seconds
["1", "40", "54"]
NoteFor the first example, $$$t=\{\textrm{lcm}(\{1,1\})\}=\{1\}$$$, so $$$\gcd(t)=1$$$.For the second example, $$$t=\{120,40,80,120,240,80\}$$$, and it's not hard to see that $$$\gcd(t)=40$$$.
Java 11
standard input
[ "number theory", "math" ]
3634a3367a1f05d1b3e8e4369e8427fb
The first line contains one integer $$$n\ (2\le n\le 100\,000)$$$. The second line contains $$$n$$$ integers, $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 200\,000$$$).
1,600
Print one integer: $$$\gcd(\{\textrm{lcm}(\{a_i,a_j\})\ |\ i&lt;j\})$$$.
standard output
PASSED
7681a702a8e2d95b367944faeeeb70a3
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class Main { public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter(System.out); BufferedReader in = new BufferedReader(new Inpu...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 8
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
db19e98360b583996a5c1aeea93c8594
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class Main { public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter(System.out); BufferedReader in = new BufferedReader(new Inpu...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 8
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
b9f417879d6525041bfca36e7c202795
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.util.*; import java.io.*; public class A178 { public static void main(String[] args) throws IOException { FS input = new FS(System.in); int n = input.nextInt(); int[] as = new int[n]; long[] res = new long[n-1]; for(int i = 0; i<n-1; i++) { as[i] += input.nextInt(); /...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 8
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
cfd0f42374708a3742461a0776c2a540
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; public class CodeForces { public static void main(String[] args) { Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int n = input.nextInt(); int[] array = new int[n]; for (int i = 0; ...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 8
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
c846d3b6a0aa5da864167d0a2a9fd63c
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.util.Scanner; public class A178 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int N = in.nextInt(); long[] A = new long[N]; for (int n=0; n<N; n++) { A[n] = in.nextInt(); } StringBuilder output = new StringBu...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 8
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
9144a49bca6ab86f5f032769b191547d
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.*; public class A { final int MOD = 1000000007; final double eps = 1e-12; public A () throws IOException { int N = sc.nextInt(); long [] A = sc.nextLongs(); start(); long res = 0; for (int k = 0; k < N-1; ++k) { int t = 0; while ((k+1) + (1 << t) <= N) ++t; --t; A[k + (1...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
6f5d056c4e0ba6d97e27efc3089c2618
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.util.Scanner; public class A { static int[] mas2 = new int[30]; static { int x = 1; mas2[0] = x; for (int i = 1; i < 30; i++) { x = x * 2; mas2[i] = x; } } public static int getLast(int n) { int i = 0; ...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
ed9625eb95cd53ce74c9b280ec0def76
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.*; import java.util.*; public class A implements Runnable { private MyScanner in; private PrintWriter out; private void solve() { int n = in.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; ++i) { a[i] = in.nextInt(); } long actions...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
ff6e4de34a0157d523dd6dfc456e6657
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.BigInte...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
405abe0acf85c00952c954daf8e8a948
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Solver { StringTokenizer st; BufferedReader in; PrintWriter out; public static void main(String[] args) throws NumberFormatException,...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
985c21e54623d11c09cc840a8caaaf57
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.*; import java.util.*; public class A1 { public void solve() throws IOException { int n = nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); for (int i = 1; i < n; i++) a[i] += a[i - 1]; int ans = 0; for (int i = 0; i < n - 1; i++) { if (a[i] == 0) { writer...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
1b8ed008ff0e2e33a92c8b9f6fb3ed41
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.awt.*; import java.awt.geom.*; import java.io.*; import java.math.*; import java.text.*; import java.util.*; import java.util.Queue; import com.sun.org.apache.bcel.internal.generic.LLOAD; /* br = new BufferedReader(new FileReader("input.txt")); pw = new PrintWriter(new BufferedWriter(new FileWriter("out...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
76a9a73602c66ae8c4a83f9278ab34a1
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.StreamTokenizer; public class A { static StreamTokenizer st; public static void main(String[] args) throws ...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
4aa2c9eeca7ecdcbb56a6c4978202af6
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.Writer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author Erik ...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
148ce866afbeee7cf31b8ede530f7ad4
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class A { BufferedReader in; StringTokenizer str; PrintWriter out; String SK; String next() throws IOException { while ((str == null) || (!str.hasMoreTokens())) { SK = in.readLine(); if (SK == null) return null; str = new StringTokenizer(S...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
0994e91253f127e3793910f802f95ab4
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.*; import java.util.*; public class Solution { private StringTokenizer st; private BufferedReader in; private PrintWriter out; int[] a; int[] d; long dfs(int i, int last, int dd) { if (dd >= d[i]) { return 0; } long ret = (long)(d[i] - dd) * a[i]; d[i] = dd; for (int j = 1; j <= ...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
09a05a4b244181dc3955212673ed9e3f
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.*; import java.util.*; public class Main { BufferedReader br; int n; public int findPos(int idx) { int ret; for (int i = 1;; i <<= 1) { ret = idx + i; if (ret >= n) { i >>= 1; ret = idx + i; break; } } return ret; } public void g...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
4593f64ee2c7cb18b945b056051817e9
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.*; import java.util.*; public class A { final String filename = new String("A").toLowerCase(); void solve() throws Exception { int n = nextInt(); long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = nextInt(); } long curAns = 0; for (int i = 0; i < n - 1; i++) { int last...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
01939135947b4509de8d846266be9138
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.util.Scanner; public class AAbbyyHard { /** * @param args */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextLong(); } long m = 0; for (int i = 0; i < n-1; i++) {...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
595b2a8e0c3f9fc7119a0a83004f47fb
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class A { public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(); ...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
f0db03fc05cbc6c8359a11f1f8bfb998
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.*; import java.util.LinkedList; import java.util.Scanner; public class Main1 { static int n; static int[] nums; public static void ReadConsole() { Scanner in = new Scanner(System.in); n = Integer.parseInt(in.nextLine()); String str = in.nextLine(); String[...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
2e32a7dff3c63904a27aaeac3766ab67
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.util.*; /* * * A.java * Written by Andy Huang: 8:19:51 AM Apr 28, 2012 */ public class A { static final int twoe[] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536}; static boolean toend[]; static void solve() { int n = in.nInt(); long a[] = new long[n]; toend = new bo...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
6f0a5d3cca258155cdf0531dea739ce5
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
//package abbyy2.hard; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; public class A { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int[] t = new int[20]; t[0] = 1; for(int i = 1;i <= 1...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
11bfd1609ae7bd703441f44eca5ef253
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.util.Scanner; public class Education{ public static int power(int i, int n){ int sum = 1; while( sum*2 <= n-i ){ sum *= 2; } return sum + i; } public static int result(int k, int n, int[] a){ int count = 0; for(int i = 1; i <= k; i++){ a[power(i, n)-1] += a[i-1]; count += a[i-1]...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
26d83e9f0acce684c79edc37944748fe
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.*; import java.util.*; public class A { String line; StringTokenizer inputParser; BufferedReader is; FileInputStream fstream; DataInputStream in; String FInput=""; void openInput(String file) { if(file==null)is = new BufferedReader(new InputStreamReader(System.in));//stdin else { try...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
09bcead156a3f1772ac67cd70e324499
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class a { static int Div2(int n){ int count = 0; while (n !=1) {count++; n/=2;} return count; } public static void main(String args[]){ Scanner in = new Scanner (System.in); int n = in.nextInt(); int two = Div2(n); int t = (int...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
403acf1489cf0a01130931ac2b62e3ee
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.awt.Point; import java.io.*; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class A implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); public static void main(String[] args) { new Threa...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
f5d9c4a972eb0fc0f7037e43090555b8
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Locale; import java.util.StringTokenizer; public class A { private void solve() throws IOException { int n = nextInt()...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
14f360abcb2c7d7a8bf40ec331f712fb
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Scanner; import java.util.StringTokenizer; public class Main { static BufferedReader reader; static StringTokenizer tokenizer; sta...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
aef6256ead31c69057c10213dea2e791
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.*; public class A2{ public static void main(String ar[]){ try{ BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(in.readLine()); String s=in.readLine(); int a[]=new int[n+1]; int i=1; for(int j=0;j<s.length();j++){ char c=s.charAt(j);...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
46bc82a0db96ba92c19b34908b99e6d6
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.*; import java.util.*; public class taskA { PrintWriter out; BufferedReader br; StringTokenizer st; String nextToken() throws IOException { while ((st == null) || (!st.hasMoreTokens())) st = new StringTokenizer(br.readLine()); return st.nextToken(); } public int nextInt() throws IOExcept...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
b292b1c7aa34e677139c04df5a67c93e
train_001.jsonl
1335614400
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequence)...
256 megabytes
import java.io.*; import java.util.*; public class CF { public static void main(String [] args) throws IOException { BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(stdin.readLine()); String [] l = stdin.readLine().split(" "); int [] a = new int[n+1]; i...
Java
["4\n1 0 1 2", "8\n1 2 3 4 5 6 7 8"]
2 seconds
["1\n1\n3", "1\n3\n6\n10\n16\n24\n40"]
null
Java 6
standard input
[ "greedy" ]
c7e49c643dd8738f273c0d24e56c505f
The first input line contains a single integer n. The second line contains n integers ai (0 ≀ ai ≀ 104), separated by single spaces. The input limitations for getting 20 points are: 1 ≀ n ≀ 300 The input limitations for getting 50 points are: 1 ≀ n ≀ 2000 The input limitations for getting 100 points are: 1 ≀...
1,000
Print exactly n - 1 lines: the k-th output line must contain the minimum number of moves needed to make the first k elements of the original sequence ai equal to zero. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use the cin, cout streams, or the %I64d specifier.
standard output
PASSED
22718b7cb931b0ef8b40075cfc48d2e0
train_001.jsonl
1390231800
Iahub got lost in a very big desert. The desert can be represented as a n × n square matrix, where each cell is a zone of the desert. The cell (i, j) represents the cell at row i and column j (1 ≀ i, j ≀ n). Iahub can go from one cell (i, j) only down or right, that is to cells (i + 1, j) or (i, j + 1). Also, there are...
256 megabytes
import java.awt.Point; import java.io.IOException; import java.io.InputStream; import java.util.Collections; import java.util.Comparator; import java.util.InputMismatchException; import java.util.LinkedList; public class D { public static void merge(Point[] B, int cnt1, Point[] N, int cnt2) { for (int i =...
Java
["4 2\n1 3\n1 4", "7 8\n1 6\n2 6\n3 5\n3 6\n4 3\n5 1\n5 2\n5 3", "2 2\n1 2\n2 1"]
1 second
["6", "12", "-1"]
NoteConsider the first sample. A possible road is: (1, 1)  →  (1, 2)  →  (2, 2)  →  (2, 3)  →  (3, 3)  →  (3, 4)  →  (4, 4).
Java 6
standard input
[ "implementation" ]
50a3dce28a479d140781a0db4eac363e
The first line contains two integers n (1 ≀ n ≀ 109) and m (1 ≀ m ≀ 105). Each of the next m lines contains a pair of integers, x and y (1 ≀ x, y ≀ n), representing the coordinates of the volcanoes. Consider matrix rows are numbered from 1 to n from top to bottom, and matrix columns are numbered from 1 to n from left t...
2,500
Print one integer, the minimum time in which Iahub can arrive at cell (n, n). If no solution exists (there is no path to the final cell), print -1.
standard output
PASSED
741d4098d9206abf1fc15d0979ccba31
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; impor...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search", "implementation", "brute force" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer nΒ β€” the length of the sequence of games (1 ≀ n ≀ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number kΒ β€” the number of options for numbers s and t. In each of the following k lines print two integers si and tiΒ β€” the option for numbers s and t. Print the options in the order of increasing si, and for equal siΒ β€” in the order of increasing ti.
standard output
PASSED
d759b0174464173bb3f4f9b4d1a6f877
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class tennis { public static void main(String[] args) throws IOException { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); b...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search", "implementation", "brute force" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer nΒ β€” the length of the sequence of games (1 ≀ n ≀ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number kΒ β€” the number of options for numbers s and t. In each of the following k lines print two integers si and tiΒ β€” the option for numbers s and t. Print the options in the order of increasing si, and for equal siΒ β€” in the order of increasing ti.
standard output