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
4ebc7a93b3c326b7800540ed002325ae
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Main p = new Main(); p.solve(); } public void solve(){ int n, k; Scanner in = new Scanner(System.in); n = in.nextInt(); k = in.nextInt(); Team[] m = new Team[n]; ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
4890a5c18721b6bc82b169cb7e073166
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.ArrayList; import java.util.Collections; public class RankList { public static void main(String[] args) throws java.io.IOException{ java.util.Scanner sc = new java.util.Scanner(new java.io.BufferedInputStream(System.in)); int members = sc.nextInt(); int place = sc.nextInt()...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
29db3496c1fd9a2e755ad6217c467d96
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; im...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
c174333b0e05b0a275be18c2a28a6dca
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; im...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
6a00bdc7691d9b80d4f7301defddd6a1
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.Scanner; /* * @author zezo * date : Feb 10, 2014 */ public class RankList { public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); rank[] myrank = new rank[n]; ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
6ced2cbb0611421283cb46ca3059b954
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.Scanner; /* * @author zezo * date : Feb 10, 2014 */ public class RankList { public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); rank[] myrank = new rank[n]; ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
15043dcbd51dd05fe96bb7ddc46f8240
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] a = new int[n]; int[] b = new int[n]; for(int i = 0; i < n; i++) { a[i] = sc.nextInt(); b[i] = sc.nextInt(); } int m = 0...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
85566e7c96a1f10a975e66c3ec72f288
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Ranklist { public static void main(String[]args) throws IOException{ BufferedReader br =new BufferedReader(new InputStreamReader(System.in)); StringTokenizer str=new StringTok...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
b11d91946e30ffe8136ea0dc91ae7a83
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.*; import java.security.SecureRandom; import java.util.*; import java.math.*; import java.awt.geom.*; import static java.lang.Math.*; public class Solution implements Runnable { class Pair implements Comparable<Pair> { int col; int time; int place; ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
4fd79c434a2ca9eaa140e95ec99e335f
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main8 { public static class Node implements Comparable<Node> { int p, t; public Node(int p, int t) { this.p = p; this.t = t; } @Override public int compareTo(Node o) { // TODO Auto-generated method stub int r = new Intege...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
f74e546ce426f86d503e515cc201126f
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Scanner; import java.util.Stack; import java.util.TreeMap; public class yo { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(), m = scanner.nextInt()-1, captureAlias...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
93e7939616833bdeae16acb7a597a9bb
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class RankList { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int n = cin.nextInt(); int k = cin.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = cin....
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
0673bfa78552567ff78dc9f9bb5a47de
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; import java.io.Writer; import java.math.BigInteger; import jav...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
98332bc6bb6f5526d52a66381024ccf1
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.Scanner; public class main { public static void main ( String args [] ){ Scanner input = new Scanner (System.in); int n ; int k ; int [][] array = new int [100][2]; n = input.nextInt(); k = input.nextInt(); for(int i = 0 ; i < n ; i++){ for(int j = 0 ; j < 2 ; j ++){ array[i][j] ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
63623b7217c2bec9a5cee3149a2612b0
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.*; import java.awt.Point; public class Rank { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input=new Scanner(System.in); int numberteam=input.nextInt(); int place =input.nextInt(); int x; int y; Point[] array = new Point[numberteam]; for(int i...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
bd32169cfa10ab1a2806627a7d373416
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.*; import java.util.*; /** * * @coder Altynbek Nurgaziyev */ public class C166A { String fileName = ""; class Pair implements Comparable<Pair> { int p, t; public Pair(int p, int t) { this.p = p; this....
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
15316e5114845a38451265d6fd911dbc
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class Main { static final int INF = 1000000000; public static void main(String[] args) throws Exception { Scanner input = new Scanner(System.in); int n, k; n = input...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
45abb1085444ef1014501d5eff420855
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Rank { public static void main (String args[]) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] data = br.readLine().split(" ");...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
80eebd6d98e73482fc48d9ded0381a15
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class ordenRangoLista { //http://codeforces.com/problemset/problem/166/A public static void main(String[] args) { Scanner scaner = new Scanner(System.in); int n =scaner.nextInt(); int k = scaner.nextInt(); int p =0; int t =0; int[] m = new...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
23fc2dfe531840f3ea77b7e481d74e67
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
//package TestOnly.Div2A_113.Code1; 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 Main { FastScanner in; PrintWriter out; public void solve() throws IOException { i...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
ae23f50f1d7ab82526e8f736c7326aa7
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner input = new Scanner(System.in); int n = input.nextInt(); int k = input.nextInt(); //how many teams sharing this place int a[] = new int[n]; for(int i = 0;i < n;i++){ a[i] = input....
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
d4d340fdeb267855a7cf118d16b11e43
train_003.jsonl
1533047700
You are given two strings $$$s$$$ and $$$t$$$. Both strings have length $$$n$$$ and consist of lowercase Latin letters. The characters in the strings are numbered from $$$1$$$ to $$$n$$$.You can successively perform the following move any number of times (possibly, zero): swap any two adjacent (neighboring) characters...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHel...
Java
["6\nabcdef\nabdfec", "4\nabcd\naccd"]
1 second
["4\n3 5 4 5", "-1"]
NoteIn the first example the string $$$s$$$ changes as follows: "abcdef" $$$\rightarrow$$$ "abdcef" $$$\rightarrow$$$ "abdcfe" $$$\rightarrow$$$ "abdfce" $$$\rightarrow$$$ "abdfec".In the second example there is no way to transform the string $$$s$$$ into the string $$$t$$$ through any allowed moves.
Java 8
standard input
[ "implementation" ]
48e323edc41086cae52cc0e6bdd84e35
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 50$$$) — the length of strings $$$s$$$ and $$$t$$$. The second line of the input contains the string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. The third line of the input contains the string $$$t$$$ consisting of $$$n$$$ lowercase Lat...
1,200
If it is impossible to obtain the string $$$t$$$ using moves, print "-1". Otherwise in the first line print one integer $$$k$$$ — the number of moves to transform $$$s$$$ to $$$t$$$. Note that $$$k$$$ must be an integer number between $$$0$$$ and $$$10^4$$$ inclusive. In the second line print $$$k$$$ integers $$$c_j$$$...
standard output
PASSED
759dc18303e9bc885d61cf107dfe2c19
train_003.jsonl
1533047700
You are given two strings $$$s$$$ and $$$t$$$. Both strings have length $$$n$$$ and consist of lowercase Latin letters. The characters in the strings are numbered from $$$1$$$ to $$$n$$$.You can successively perform the following move any number of times (possibly, zero): swap any two adjacent (neighboring) characters...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static List<Integer> list = new ArrayList<Integer>(); private static void swap(int a, int b) { if (a > b) { int tmp = a; a = b; b = tmp; } for (int i = a; i < b; ++i) { lis...
Java
["6\nabcdef\nabdfec", "4\nabcd\naccd"]
1 second
["4\n3 5 4 5", "-1"]
NoteIn the first example the string $$$s$$$ changes as follows: "abcdef" $$$\rightarrow$$$ "abdcef" $$$\rightarrow$$$ "abdcfe" $$$\rightarrow$$$ "abdfce" $$$\rightarrow$$$ "abdfec".In the second example there is no way to transform the string $$$s$$$ into the string $$$t$$$ through any allowed moves.
Java 8
standard input
[ "implementation" ]
48e323edc41086cae52cc0e6bdd84e35
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 50$$$) — the length of strings $$$s$$$ and $$$t$$$. The second line of the input contains the string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. The third line of the input contains the string $$$t$$$ consisting of $$$n$$$ lowercase Lat...
1,200
If it is impossible to obtain the string $$$t$$$ using moves, print "-1". Otherwise in the first line print one integer $$$k$$$ — the number of moves to transform $$$s$$$ to $$$t$$$. Note that $$$k$$$ must be an integer number between $$$0$$$ and $$$10^4$$$ inclusive. In the second line print $$$k$$$ integers $$$c_j$$$...
standard output
PASSED
b665dadb58dca918a9b467682c4ba5d4
train_003.jsonl
1533047700
You are given two strings $$$s$$$ and $$$t$$$. Both strings have length $$$n$$$ and consist of lowercase Latin letters. The characters in the strings are numbered from $$$1$$$ to $$$n$$$.You can successively perform the following move any number of times (possibly, zero): swap any two adjacent (neighboring) characters...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.u...
Java
["6\nabcdef\nabdfec", "4\nabcd\naccd"]
1 second
["4\n3 5 4 5", "-1"]
NoteIn the first example the string $$$s$$$ changes as follows: "abcdef" $$$\rightarrow$$$ "abdcef" $$$\rightarrow$$$ "abdcfe" $$$\rightarrow$$$ "abdfce" $$$\rightarrow$$$ "abdfec".In the second example there is no way to transform the string $$$s$$$ into the string $$$t$$$ through any allowed moves.
Java 8
standard input
[ "implementation" ]
48e323edc41086cae52cc0e6bdd84e35
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 50$$$) — the length of strings $$$s$$$ and $$$t$$$. The second line of the input contains the string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. The third line of the input contains the string $$$t$$$ consisting of $$$n$$$ lowercase Lat...
1,200
If it is impossible to obtain the string $$$t$$$ using moves, print "-1". Otherwise in the first line print one integer $$$k$$$ — the number of moves to transform $$$s$$$ to $$$t$$$. Note that $$$k$$$ must be an integer number between $$$0$$$ and $$$10^4$$$ inclusive. In the second line print $$$k$$$ integers $$$c_j$$$...
standard output
PASSED
33ea053a142304afdad41a88fb91850d
train_003.jsonl
1533047700
You are given two strings $$$s$$$ and $$$t$$$. Both strings have length $$$n$$$ and consist of lowercase Latin letters. The characters in the strings are numbered from $$$1$$$ to $$$n$$$.You can successively perform the following move any number of times (possibly, zero): swap any two adjacent (neighboring) characters...
256 megabytes
import java.util.*; import java.util.ArrayList; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char s[] = sc.next().toCharArray(); char t[] = sc.next().toCharArray(); List<Integer> l = new ArrayList<>(); for(int i=0;i<n;i++){ in...
Java
["6\nabcdef\nabdfec", "4\nabcd\naccd"]
1 second
["4\n3 5 4 5", "-1"]
NoteIn the first example the string $$$s$$$ changes as follows: "abcdef" $$$\rightarrow$$$ "abdcef" $$$\rightarrow$$$ "abdcfe" $$$\rightarrow$$$ "abdfce" $$$\rightarrow$$$ "abdfec".In the second example there is no way to transform the string $$$s$$$ into the string $$$t$$$ through any allowed moves.
Java 8
standard input
[ "implementation" ]
48e323edc41086cae52cc0e6bdd84e35
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 50$$$) — the length of strings $$$s$$$ and $$$t$$$. The second line of the input contains the string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. The third line of the input contains the string $$$t$$$ consisting of $$$n$$$ lowercase Lat...
1,200
If it is impossible to obtain the string $$$t$$$ using moves, print "-1". Otherwise in the first line print one integer $$$k$$$ — the number of moves to transform $$$s$$$ to $$$t$$$. Note that $$$k$$$ must be an integer number between $$$0$$$ and $$$10^4$$$ inclusive. In the second line print $$$k$$$ integers $$$c_j$$$...
standard output
PASSED
0d345c4a7a2b3137e53fa40556ea5b3b
train_003.jsonl
1533047700
You are given two strings $$$s$$$ and $$$t$$$. Both strings have length $$$n$$$ and consist of lowercase Latin letters. The characters in the strings are numbered from $$$1$$$ to $$$n$$$.You can successively perform the following move any number of times (possibly, zero): swap any two adjacent (neighboring) characters...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class Main { static int min; public static void main(S...
Java
["6\nabcdef\nabdfec", "4\nabcd\naccd"]
1 second
["4\n3 5 4 5", "-1"]
NoteIn the first example the string $$$s$$$ changes as follows: "abcdef" $$$\rightarrow$$$ "abdcef" $$$\rightarrow$$$ "abdcfe" $$$\rightarrow$$$ "abdfce" $$$\rightarrow$$$ "abdfec".In the second example there is no way to transform the string $$$s$$$ into the string $$$t$$$ through any allowed moves.
Java 8
standard input
[ "implementation" ]
48e323edc41086cae52cc0e6bdd84e35
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 50$$$) — the length of strings $$$s$$$ and $$$t$$$. The second line of the input contains the string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. The third line of the input contains the string $$$t$$$ consisting of $$$n$$$ lowercase Lat...
1,200
If it is impossible to obtain the string $$$t$$$ using moves, print "-1". Otherwise in the first line print one integer $$$k$$$ — the number of moves to transform $$$s$$$ to $$$t$$$. Note that $$$k$$$ must be an integer number between $$$0$$$ and $$$10^4$$$ inclusive. In the second line print $$$k$$$ integers $$$c_j$$$...
standard output
PASSED
c7888f6f55b43fcdb6edead22a0175a9
train_003.jsonl
1440261000
'In Boolean logic, a formula is in conjunctive normal form (CNF) or clausal normal form if it is a conjunction of clauses, where a clause is a disjunction of literals' (cited from https://en.wikipedia.org/wiki/Conjunctive_normal_form)In the other words, CNF is a formula of type , where &amp; represents a logical "AND" ...
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; /** * @author Pavel Mavrin */ public class C { private void solve() throws IOException { int n = nextInt(); int m = ...
Java
["2 2\n2 1 -2\n2 2 -1", "4 3\n1 1\n1 2\n3 -1 -2 3\n1 -3", "5 6\n2 1 2\n3 1 -2 3\n4 -3 5 4 6\n2 -6 -4\n1 5"]
2 seconds
["YES\n11", "NO", "YES\n100010"]
NoteIn the first sample test formula is . One of possible answer is x1 = TRUE, x2 = TRUE.
Java 7
standard input
[ "constructive algorithms", "dfs and similar", "greedy", "graphs" ]
a63af6feb5d35c5a1f8af5c85c51bfc4
The first line contains integers n and m (1 ≤ n, m ≤ 2·105) — the number of clauses and the number variables, correspondingly. Next n lines contain the descriptions of each clause. The i-th line first contains first number ki (ki ≥ 1) — the number of literals in the i-th clauses. Then follow space-separated literals vi...
2,500
If CNF is not satisfiable, print a single line "NO" (without the quotes), otherwise print two strings: string "YES" (without the quotes), and then a string of m numbers zero or one — the values of variables in satisfying assignment in the order from x1 to xm.
standard output
PASSED
4db2ddd45120419afaa477f0c89424b8
train_003.jsonl
1440261000
'In Boolean logic, a formula is in conjunctive normal form (CNF) or clausal normal form if it is a conjunction of clauses, where a clause is a disjunction of literals' (cited from https://en.wikipedia.org/wiki/Conjunctive_normal_form)In the other words, CNF is a formula of type , where &amp; represents a logical "AND" ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import java.io.BufferedReader; impo...
Java
["2 2\n2 1 -2\n2 2 -1", "4 3\n1 1\n1 2\n3 -1 -2 3\n1 -3", "5 6\n2 1 2\n3 1 -2 3\n4 -3 5 4 6\n2 -6 -4\n1 5"]
2 seconds
["YES\n11", "NO", "YES\n100010"]
NoteIn the first sample test formula is . One of possible answer is x1 = TRUE, x2 = TRUE.
Java 7
standard input
[ "constructive algorithms", "dfs and similar", "greedy", "graphs" ]
a63af6feb5d35c5a1f8af5c85c51bfc4
The first line contains integers n and m (1 ≤ n, m ≤ 2·105) — the number of clauses and the number variables, correspondingly. Next n lines contain the descriptions of each clause. The i-th line first contains first number ki (ki ≥ 1) — the number of literals in the i-th clauses. Then follow space-separated literals vi...
2,500
If CNF is not satisfiable, print a single line "NO" (without the quotes), otherwise print two strings: string "YES" (without the quotes), and then a string of m numbers zero or one — the values of variables in satisfying assignment in the order from x1 to xm.
standard output
PASSED
a1eca04ac30ea39e456222f7ca029179
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.util.*; import java.io.*; public class RPGProtaganist { public static void main(String[] args) { FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); for(int tt = 0; tt < t; tt++) { long space1 = in.ne...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
8f6e0af7402a10632dde54d4b83dda5f
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; public class B { public static v...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
427566d8603267854da2fd22a2702330
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.util.Scanner; public class Main4 { public static void main(String[] args) { // TODO Auto-generated method stub try (Scanner reader = new Scanner(System.in)) { int cases = reader.nextInt(); for (int i = 0; i < cases; i++) { long max1 = reader.nextLong(); long max2 = reader.nextLong()...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
11332b1e7f09e9199382132ea2bb71e4
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); while (t-- > 0) { int p=s.nextInt(); int f=s.nextInt(); int res=0; int c1=s.nextInt(); int c2=s.nextInt(); int w1=s.nextInt(); int w2=s.nextInt()...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
84a466933c6995eeb3e3f6249182f367
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
//JHope import java.util.*; import java.io.*; import java.math.*; public class B2 { public static void main(String dynamite[]) throws Exception { BufferedReader infile = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(infile.readLine())...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
92c3d3e40f0e22460acfa43a3d092606
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.util.*; import java.io.*; public final class RPG{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int numTests=sc.nextInt(); for(int j=1;j<=numTests;j++){ long p=sc.nextLong(),f=sc.nextLong(),cnts=sc.nextLong(),cntw=sc.nextLong(),weights=sc.n...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
274e61eddcf145b9e6d30868e79ed0dd
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while (t-- > 0) { int p = scan.nextInt(), f = scan.nextInt(); int cnts = scan.nextInt(), cntw = scan.nextInt();//件数 ...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
b1997468006de4156168f50772b9dc02
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.PrintWriter; import java.util.Scanner; public class B2 { public static void main(String[] args) throws Exception { new B2().go(); } static boolean LOCAL = System.getProperty("ONLINE_JUDGE") == null; Scanner in; String INPUT = "3\r\n" + "33 27\r\n" + ...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
46ab424ace224808cda5787f7e8acaeb
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
// package EducationalRound94; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class ProblemB { public static void main(String[] args)throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
c3ffe5ab544e5119097bdb6c24287067
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.*; public class solution{ public static void main(String[] args){ FastReader sc= new FastReader(); int t = sc.nextInt(); ...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
734685cd0adc1613cb8f04f15adec2bc
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class ProblemB { public static void main(String[] args) throws IOException { InputStream in = System.in; InputReader scan = new InputReader(in); int t...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
2cd7593aca019d3f00fba30d98dbb40b
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class B { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader file = new BufferedReader(new InputStreamReader(System.in)); int inputs...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
af7a2b517f5a790551f7e55bda671d32
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.io.*; import java.util.*; public class Main extends PrintWriter { private void solve() { int t = sc.nextInt(); for(int tc = 1; tc <= t; tc++) { int p = sc.nextInt(); int f = sc.nextInt(); int cnt_s = sc.nextInt(); int cnt_w = sc.nextI...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
8841ebef29b4d23e309c2674aed0e8f7
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args) { FastReader fs=new FastReader(); PrintWriter out=new PrintWriter(System.out); int t=1; t=fs.nextInt(); for(int i=1;i<=t;i++) { Main m=new Main(); m.solve(i,o...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
fcdb611f5cedfc98a7b421bd7630e186
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class q2 { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc = new Scanner(System.in); int t= Integer.pa...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
b51f4711352f03f4d37b1747dba54e26
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class q2 { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc = new Scanner(System.in); int t= Integer.pa...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
8fe93af587023e972f4f9e956e6ad892
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.util.*; import java.io.*; public class B { public static void main(String[] args) throws IOException{ BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); int t = Integer.parseInt(f.readLi...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
3a476d91c52a4b15ecf5ce48654f34cf
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class B { public static void main(String[] args) { FastScanner fs=new FastScanner(); int T=fs.nextInt(); for (int tt=0; tt<T; t...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
7bb41601fb20d58c9d8c0ebbd6694bda
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
//JDope import java.util.*; import java.io.*; import java.math.*; public class B{ public static void main(String[] omkar) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(in.readLine()); StringBuilder sb = new StringBuilder();...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
121a73a18df90bd6f11629e732a97445
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.io.*; import java.util.*; /* Shortcut Commands makeali : Make ArrayList of Integer makesti : Make Stack of Integer makeqi : Make Queue of Integer makepqi : Make PriorityQueue of Integer makestc : Make Stack of Character mapii : Make Map<Integer,Integer> mappi : Make Map<Pair,Integer> print println pri...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
22dc861f8cc5fc9e53ba0e667b283230
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.io.*; import java.util.*; /* Shortcut Commands makeali : Make ArrayList of Integer makesti : Make Stack of Integer makeqi : Make Queue of Integer makepqi : Make PriorityQueue of Integer makestc : Make Stack of Character mapii : Make Map<Integer,Integer> mappi : Make Map<Pair,Integer> print println pri...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
27bdacf6491572cfc8b1026f6481f43c
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.io.*; import java.util.*; public class Solution { private static boolean useInFile = false; private static boolean useOutFile = false; public static void main(String args[]) throws IOException { InOut inout = new InOut(); Resolver resolver = new Resolver(inout); resolv...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
2c576195793ba0aa6e6b79f3d8e73d66
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
c884318d13192b0381bacad31c22e4e3
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class Main{ public static void main(String[] args) { Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(new BufferedOutputStream(System.out)); int T = in.nextInt(); ...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
964946ec26b6bce40f88338dce8697da
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.util.*; import java.util.Map.Entry; import java.io.*; public class A { // static ArrayList<Integer>[] g; static pair[] g; static ArrayList<Integer>[] adj; public static void main(String[] args) throws NumberFormatException, IOException { // TODO Auto-generated method stub BufferedReader br = new ...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
a254739da8177fbce6bb102e63399181
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class B { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = n...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
c3cae0021292ad6ab8b2b062df953863
train_003.jsonl
1598366100
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower — at most $$$f$...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ static PrintWriter out=new PrintWriter(System.out); public static void main (String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String[] input=br.readLine().trim().split(" "); int numTest...
Java
["3\n33 27\n6 10\n5 6\n100 200\n10 10\n5 5\n1 19\n1 3\n19 5"]
2 seconds
["11\n20\n3"]
NoteIn the first test case: you should take $$$3$$$ swords and $$$3$$$ war axes: $$$3 \cdot 5 + 3 \cdot 6 = 33 \le 33$$$ and your follower — $$$3$$$ swords and $$$2$$$ war axes: $$$3 \cdot 5 + 2 \cdot 6 = 27 \le 27$$$. $$$3 + 3 + 3 + 2 = 11$$$ weapons in total.In the second test case, you can take all available wea...
Java 8
standard input
[ "greedy", "math", "brute force" ]
ee32db8e7cdd9561d9215651ff8a262e
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \le p, f \le 10^9$$$) — yours and your follower's capacities. The second line of each test case contains two integers $$$cnt_s$$$ and $$$...
1,700
For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.
standard output
PASSED
0c6b02b490cd5e500a5790c72b689ff0
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.*; import java.util.*; public class Taske{ public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); Task...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
e430d44affbe368ec3fb32ffc7f2bcf1
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.*; public class MissingNumbers { public static void main(String[] args) { FastScanner scanner = new FastScanner(); int N = scanner.nextInt(); long[] arr = scan...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
db95dd96d9fda1b81f15f6fec17bdafa
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Random; import jav...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
a1a79afa409d25688ca7cfd994753938
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHel...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
832bc825f620decae8a8e28c89a067a5
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; public class E { public static PrintWriter out; public static void quit() { out.println("No"); out.close(); System.exit(0); } public static void main(String[] args) throws Exception { BufferedReader bf = ne...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
6b1cf0f9e956b011e206c4ad05c6150f
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class E { public static void main(String[] args) throws IOException { /**/ Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in))); /*/ Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
633169eb2a48cd7ad0c728c300c46427
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import org.omg.CORBA.INTERNAL; import javax.swing.plaf.basic.BasicTreeUI; import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; public class Main { private static Scanner sc; private static Printer pr; static boolean []visited; static int []color; sta...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
c57728b829921a36572de673d4f5dcaf
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
a6e8df1c8f4b4fa295efd8e7d3ddb7e3
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class E { static MyScanner sc; static PrintWriter pw; public static void main(String[] args) throws Throwable { sc = new MyScanner(); pw = new PrintWriter(System.out); int n=sc.nextInt(); long [] a=ne...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
948fd124ce258af0c3a6160e52f87c1c
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
1cea900f5d183a4ce6e679547c350164
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class E { static int maxn = 200020; static long a[] = new long[maxn]; static long sum[] = new long[maxn]; static long ans[] = new long[maxn]; static long valid = 10000000000000L; public static void main(String[] aaaa) { Scanner...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
43b80de4da7ee3a3836b7faacd00cec2
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
public class Main { private static void solve() { int n = ni() / 2; long[] x = new long[n]; for (int i = 0; i < n; i ++) { x[i] = nl(); } long[] ret = new long[n * 2]; long y = 1; long z = 0; long lasty = 0; for (int i = 0; i < n; i ++) { for (;; z ++, y += z *...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
fd84023950fd0eed1a72949962d5543a
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.List; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is a...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
f390c4c3465820510beb750d46ec804f
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.List; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is a...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
7eff1608372ea75bfdc2ca11f31a38be
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.*; import java.util.*; public class E implements Runnable { FastReader scn; PrintWriter out; String INPUT = ""; void solve() { int n = scn.nextInt(); long[] arr = new long[n]; long prev = 0; for (int i = 1; i < n; i += 2) { int x = scn.nextInt(); long a = Long.MAX_VALUE, b = -1; fo...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
a68a5a7a0a970faf8e3ab157212b4fe5
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.*; import java.util.*; public class E implements Runnable { FastReader scn; PrintWriter out; String INPUT = ""; void solve() { int n = scn.nextInt(); long[] arr = new long[n]; long prev = 0; for (int i = 1; i < n; i += 2) { int x = scn.nextInt(); long a = Long.MAX_VALUE, b = -1; fo...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
062ec0fe0f1b9627ee282211abe5add1
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.*; import java.util.*; public class E implements Runnable { FastReader scn; PrintWriter out; String INPUT = ""; void solve() { int n = scn.nextInt(); long[] arr = new long[n]; long prev = 0; for(int i = 1; i < n; i += 2) { int x = scn.nextInt(); long a = Long.MAX_VALUE, b = -1; for...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
63d020db32644b70010809e4e2e556e7
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.*; import java.util.*; public class Main { static Scanner sc = new Scanner(); static PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) { int n = sc.nextInt(); long[] res = new long[n]; long curIdx = 2; long curSum = 0; ...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
13a2f2b979a6e995b3694c3450582b95
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.*; import java.util.*; public class D{ static long INF=(long)1e18; public static void main(String[] args) throws IOException { Scanner sc=new Scanner(); PrintWriter out=new PrintWriter(System.out); int n=sc.nextInt(); long []ans=new long [n]; long sum=0; for(int i=0;i<n;i+=2) { int...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
65ef3c15dae50cfa8ff843bcd90a9e3f
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { static final long MOD = 1_000_000_007, INF = 1_000_000_000_000_000_000L; static final int INf = 1_000_000_000; static FastReader reader; static PrintWriter writer; public static void main(String[] args) { ...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
cc8ea69ca1f447724558cdb7450d0eee
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.System.exit; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class E { static void solve() throw...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
779967a90880b8dcbe0ecc3a15056896
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.util.*; import java.io.*; //import javafx.util.Pair; public class Main implements Runnable { static class Pair implements Comparable <Pair> { int x,y,wt; Pair(int x,int y,int wt) { this.x=x; this.y=y; this.wt=wt; } ...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
eaa652cf2f2c1291c78bd6aa44c06170
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.util.HashMap; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
2d855f8b18b68745988477330683380f
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.stream.LongStream; import java.io.IOException; import java.util.stream.Collectors; import java.io.InputStreamReader; import java.util.TreeSet; import java.util.Objec...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
8f36f54292b6ddfbe04ba1a7d0906f7a
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; public class MissingNumbers { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
2610cf9fb15d68e2d3fe9eb6be79b732
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; public class MissingNumbers { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
8a653505b0ddf0c0fb0852ae4e6390a8
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
//package ; import java.io.*; import java.util.*; public class E { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(); PrintWriter pw = new PrintWriter(System.out); int n=sc.nextInt(); long a[]=new long[n]; for(int i=1;i<n;i+=2) a[i]=sc.nextLong(); long s=0;//cumlati...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
658520311f930d1d7c4de65d07713cbf
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
//package ; import java.io.*; import java.util.*; public class E { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(); PrintWriter pw = new PrintWriter(System.out); int n=sc.nextInt(); long a[]=new long[n]; for(int i=1;i<n;i+=2) a[i]=sc.nextLong(); long s=0;//cumlati...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
60351b1e7eb9db7816d2d8ef6de252f8
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public clas...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
142d7ab6d1ea6d382465082b0f8fe7de
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
//package codeforces.contests.avito2018; import java.io.*; import java.util.InputMismatchException; /** * @author tainic on Dec 16, 2018 */ public class E { private static boolean LOCAL; static { try { LOCAL = "aurel".equalsIgnoreCase(System.getenv().get("USER")); } catch (Exception e){} } ...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
896ca264c4b5cf2a7b42ff650e4bace2
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.Set; import java.util.InputMismatchException; import java.io.IOException; import java.util.TreeSet; import java.io.Writer; import ...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
a8bddedaa6e9f22c052b0c0420bb4786
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.util.*; import java.io.*; import java.text.*; public class Main { //SOLUTION BEGIN //Into the Hardware Mode void pre() throws Exception{} void solve(int TC) throws Exception { int N = ni(); long[] X = new long[N]; for(int i = 1; i< N; i+= 2)X[i] = nl(); long ...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
676b70e99a8eceaab2ff8f5fb68b1310
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public clas...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
389e5afdb3c9b9e265a09eb0ab482849
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
//package avito2018b; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class E { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(); i...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
e9e55e7e1acedbf0287971a117c1aeb8
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import sun.reflect.generics.tree.Tree; import java.io.*; import java.util.*; public class Task { public static void main(String[] args) throws IOException { new Task().go(); } PrintWriter out; Reader in; BufferedReader br; Task() throws IOException { try { //b...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
4fa91068a4dc60bff85470783ebf549a
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.io.Writer; impo...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
1982a4fe700b034f5507a21be79440be
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * @author khokharnikunj8 */ public class Main { public static void main(String[] args) { ...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
10fa60b583ca0262c4c345eb057dc961
train_003.jsonl
1544970900
Chouti is working on a strange math problem.There was a sequence of $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$, where $$$n$$$ is even. The sequence was very special, namely for every integer $$$t$$$ from $$$1$$$ to $$$n$$$, $$$x_1+x_2+...+x_t$$$ is a square of some integer number (that is, a perfect square)....
256 megabytes
/* Keep solving problems. */ import java.util.*; import java.io.*; public class CFA { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; private static long MOD = 1000L * 1000L * 1000L + 7; private static final int[] dx = {0, -1, 0, 1}; private static final int[] dy = {1,...
Java
["6\n5 11 44", "2\n9900", "6\n314 1592 6535"]
2 seconds
["Yes\n4 5 16 11 64 44", "Yes\n100 9900", "No"]
NoteIn the first example $$$x_1=4$$$ $$$x_1+x_2=9$$$ $$$x_1+x_2+x_3=25$$$ $$$x_1+x_2+x_3+x_4=36$$$ $$$x_1+x_2+x_3+x_4+x_5=100$$$ $$$x_1+x_2+x_3+x_4+x_5+x_6=144$$$ All these numbers are perfect squares.In the second example, $$$x_1=100$$$, $$$x_1+x_2=10000$$$. They are all perfect squares. There're other answers...
Java 8
standard input
[ "greedy", "constructive algorithms", "number theory", "math", "binary search" ]
d07730b7bbbfa5339ea24162df7a5cab
The first line contains an even number $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$\frac{n}{2}$$$ positive integers $$$x_2, x_4, \ldots, x_n$$$ ($$$1 \le x_i \le 2 \cdot 10^5$$$).
1,900
If there are no possible sequence, print "No". Otherwise, print "Yes" and then $$$n$$$ positive integers $$$x_1, x_2, \ldots, x_n$$$ ($$$1 \le x_i \le 10^{13}$$$), where $$$x_2, x_4, \ldots, x_n$$$ should be same as in input data. If there are multiple answers, print any. Note, that the limit for $$$x_i$$$ is larger th...
standard output
PASSED
1780724c8672b00ec88a6dab0de54367
train_003.jsonl
1597415700
You are given an array $$$a_1, a_2, \dots , a_n$$$, which is sorted in non-decreasing order ($$$a_i \le a_{i + 1})$$$. Find three indices $$$i$$$, $$$j$$$, $$$k$$$ such that $$$1 \le i &lt; j &lt; k \le n$$$ and it is impossible to construct a non-degenerate triangle (a triangle with nonzero area) having sides equal to...
256 megabytes
import java.util.*; import java.io.*; public class A{ public static boolean bs(int n,int arr[],int l,int r) { while(l<=r) { int mid=l+(r-l>>1); if(arr[mid]>n)r=mid-1; else if(arr[mid]<n)l=mid+1; else return true; } return false; } public static void main(String[] args) throws IOException { PrintW...
Java
["3\n7\n4 6 11 11 15 18 20\n4\n10 10 10 11\n3\n1 1 1000000000"]
1 second
["2 3 6\n-1\n1 2 3"]
NoteIn the first test case it is impossible with sides $$$6$$$, $$$11$$$ and $$$18$$$. Note, that this is not the only correct answer.In the second test case you always can construct a non-degenerate triangle.
Java 8
standard input
[ "geometry", "math" ]
341555349b0c1387334a0541730159ac
The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \le n \le 5 \cdot 10^4$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1...
800
For each test case print the answer to it in one line. If there is a triple of indices $$$i$$$, $$$j$$$, $$$k$$$ ($$$i &lt; j &lt; k$$$) such that it is impossible to construct a non-degenerate triangle having sides equal to $$$a_i$$$, $$$a_j$$$ and $$$a_k$$$, print that three indices in ascending order. If there are m...
standard output
PASSED
a00a7628e64a2a20ed0d102e4833fe18
train_003.jsonl
1597415700
You are given an array $$$a_1, a_2, \dots , a_n$$$, which is sorted in non-decreasing order ($$$a_i \le a_{i + 1})$$$. Find three indices $$$i$$$, $$$j$$$, $$$k$$$ such that $$$1 \le i &lt; j &lt; k \le n$$$ and it is impossible to construct a non-degenerate triangle (a triangle with nonzero area) having sides equal to...
256 megabytes
import java.lang.*; import java.util.*; public class Solution{ public static void main(String args[]) { int t, n, arr[]; Scanner sc = new Scanner(System.in); t = sc.nextInt(); while(t != 0) { n = sc.nextInt(); arr = new int[n]; for(int i = 0; i < n; i++) arr[i] = sc.nextInt(); if(arr[0] + arr[1] > arr[n-1]) System.out....
Java
["3\n7\n4 6 11 11 15 18 20\n4\n10 10 10 11\n3\n1 1 1000000000"]
1 second
["2 3 6\n-1\n1 2 3"]
NoteIn the first test case it is impossible with sides $$$6$$$, $$$11$$$ and $$$18$$$. Note, that this is not the only correct answer.In the second test case you always can construct a non-degenerate triangle.
Java 8
standard input
[ "geometry", "math" ]
341555349b0c1387334a0541730159ac
The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \le n \le 5 \cdot 10^4$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1...
800
For each test case print the answer to it in one line. If there is a triple of indices $$$i$$$, $$$j$$$, $$$k$$$ ($$$i &lt; j &lt; k$$$) such that it is impossible to construct a non-degenerate triangle having sides equal to $$$a_i$$$, $$$a_j$$$ and $$$a_k$$$, print that three indices in ascending order. If there are m...
standard output
PASSED
107487f136f09ae0364cf2b262b7d0a1
train_003.jsonl
1597415700
You are given an array $$$a_1, a_2, \dots , a_n$$$, which is sorted in non-decreasing order ($$$a_i \le a_{i + 1})$$$. Find three indices $$$i$$$, $$$j$$$, $$$k$$$ such that $$$1 \le i &lt; j &lt; k \le n$$$ and it is impossible to construct a non-degenerate triangle (a triangle with nonzero area) having sides equal to...
256 megabytes
/*input 3 7 4 6 11 11 15 18 20 4 10 10 10 11 3 1 1 1000000000 */ import java.util.*; import java.math.BigInteger; public class Easy{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int i,t = sc.nextInt(),n; long arr[]; boolean ans = false; while(t>0) { ...
Java
["3\n7\n4 6 11 11 15 18 20\n4\n10 10 10 11\n3\n1 1 1000000000"]
1 second
["2 3 6\n-1\n1 2 3"]
NoteIn the first test case it is impossible with sides $$$6$$$, $$$11$$$ and $$$18$$$. Note, that this is not the only correct answer.In the second test case you always can construct a non-degenerate triangle.
Java 8
standard input
[ "geometry", "math" ]
341555349b0c1387334a0541730159ac
The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \le n \le 5 \cdot 10^4$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1...
800
For each test case print the answer to it in one line. If there is a triple of indices $$$i$$$, $$$j$$$, $$$k$$$ ($$$i &lt; j &lt; k$$$) such that it is impossible to construct a non-degenerate triangle having sides equal to $$$a_i$$$, $$$a_j$$$ and $$$a_k$$$, print that three indices in ascending order. If there are m...
standard output
PASSED
160585b7e5916feedba25882fe9f9dc2
train_003.jsonl
1597415700
You are given an array $$$a_1, a_2, \dots , a_n$$$, which is sorted in non-decreasing order ($$$a_i \le a_{i + 1})$$$. Find three indices $$$i$$$, $$$j$$$, $$$k$$$ such that $$$1 \le i &lt; j &lt; k \le n$$$ and it is impossible to construct a non-degenerate triangle (a triangle with nonzero area) having sides equal to...
256 megabytes
/*input 3 7 4 6 11 11 15 18 20 4 10 10 10 11 3 1 1 1000000000 */ import java.util.*; import java.math.BigInteger; public class Easy{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int i,arr[],t = sc.nextInt(),n; boolean ans = false; while(t>0) { t--;...
Java
["3\n7\n4 6 11 11 15 18 20\n4\n10 10 10 11\n3\n1 1 1000000000"]
1 second
["2 3 6\n-1\n1 2 3"]
NoteIn the first test case it is impossible with sides $$$6$$$, $$$11$$$ and $$$18$$$. Note, that this is not the only correct answer.In the second test case you always can construct a non-degenerate triangle.
Java 8
standard input
[ "geometry", "math" ]
341555349b0c1387334a0541730159ac
The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \le n \le 5 \cdot 10^4$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1...
800
For each test case print the answer to it in one line. If there is a triple of indices $$$i$$$, $$$j$$$, $$$k$$$ ($$$i &lt; j &lt; k$$$) such that it is impossible to construct a non-degenerate triangle having sides equal to $$$a_i$$$, $$$a_j$$$ and $$$a_k$$$, print that three indices in ascending order. If there are m...
standard output
PASSED
4702b2f4826002b2f46508d36bee96ae
train_003.jsonl
1597415700
You are given an array $$$a_1, a_2, \dots , a_n$$$, which is sorted in non-decreasing order ($$$a_i \le a_{i + 1})$$$. Find three indices $$$i$$$, $$$j$$$, $$$k$$$ such that $$$1 \le i &lt; j &lt; k \le n$$$ and it is impossible to construct a non-degenerate triangle (a triangle with nonzero area) having sides equal to...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { PrintWriter out=new PrintWriter(System.out); InputReader in=new InputReader(System.in); //Write your logic here int t=in.nextInt(); while(t-->0) { int n=in.nextInt(); int[] a=in.readArray(...
Java
["3\n7\n4 6 11 11 15 18 20\n4\n10 10 10 11\n3\n1 1 1000000000"]
1 second
["2 3 6\n-1\n1 2 3"]
NoteIn the first test case it is impossible with sides $$$6$$$, $$$11$$$ and $$$18$$$. Note, that this is not the only correct answer.In the second test case you always can construct a non-degenerate triangle.
Java 8
standard input
[ "geometry", "math" ]
341555349b0c1387334a0541730159ac
The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \le n \le 5 \cdot 10^4$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1...
800
For each test case print the answer to it in one line. If there is a triple of indices $$$i$$$, $$$j$$$, $$$k$$$ ($$$i &lt; j &lt; k$$$) such that it is impossible to construct a non-degenerate triangle having sides equal to $$$a_i$$$, $$$a_j$$$ and $$$a_k$$$, print that three indices in ascending order. If there are m...
standard output
PASSED
aecfb4f27a044a797eaf3d3ae39b1135
train_003.jsonl
1597415700
You are given an array $$$a_1, a_2, \dots , a_n$$$, which is sorted in non-decreasing order ($$$a_i \le a_{i + 1})$$$. Find three indices $$$i$$$, $$$j$$$, $$$k$$$ such that $$$1 \le i &lt; j &lt; k \le n$$$ and it is impossible to construct a non-degenerate triangle (a triangle with nonzero area) having sides equal to...
256 megabytes
import java.io.*; import java.util.*; public class abc { public static void main(String agr[])throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(br.readLine()); StringBuilder sb=new StringBuilder(); while(...
Java
["3\n7\n4 6 11 11 15 18 20\n4\n10 10 10 11\n3\n1 1 1000000000"]
1 second
["2 3 6\n-1\n1 2 3"]
NoteIn the first test case it is impossible with sides $$$6$$$, $$$11$$$ and $$$18$$$. Note, that this is not the only correct answer.In the second test case you always can construct a non-degenerate triangle.
Java 8
standard input
[ "geometry", "math" ]
341555349b0c1387334a0541730159ac
The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \le n \le 5 \cdot 10^4$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1...
800
For each test case print the answer to it in one line. If there is a triple of indices $$$i$$$, $$$j$$$, $$$k$$$ ($$$i &lt; j &lt; k$$$) such that it is impossible to construct a non-degenerate triangle having sides equal to $$$a_i$$$, $$$a_j$$$ and $$$a_k$$$, print that three indices in ascending order. If there are m...
standard output
PASSED
638672b1677168b8079ac7a68fd31229
train_003.jsonl
1597415700
You are given an array $$$a_1, a_2, \dots , a_n$$$, which is sorted in non-decreasing order ($$$a_i \le a_{i + 1})$$$. Find three indices $$$i$$$, $$$j$$$, $$$k$$$ such that $$$1 \le i &lt; j &lt; k \le n$$$ and it is impossible to construct a non-degenerate triangle (a triangle with nonzero area) having sides equal to...
256 megabytes
import java.util.*; import java.io.*; public class vivek{ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { ...
Java
["3\n7\n4 6 11 11 15 18 20\n4\n10 10 10 11\n3\n1 1 1000000000"]
1 second
["2 3 6\n-1\n1 2 3"]
NoteIn the first test case it is impossible with sides $$$6$$$, $$$11$$$ and $$$18$$$. Note, that this is not the only correct answer.In the second test case you always can construct a non-degenerate triangle.
Java 8
standard input
[ "geometry", "math" ]
341555349b0c1387334a0541730159ac
The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \le n \le 5 \cdot 10^4$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1...
800
For each test case print the answer to it in one line. If there is a triple of indices $$$i$$$, $$$j$$$, $$$k$$$ ($$$i &lt; j &lt; k$$$) such that it is impossible to construct a non-degenerate triangle having sides equal to $$$a_i$$$, $$$a_j$$$ and $$$a_k$$$, print that three indices in ascending order. If there are m...
standard output