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
57fa51221bf988d60366288ff3f38ef3
train_003.jsonl
1584018300
You are given a tree consisting of $$$n$$$ vertices. A tree is a connected undirected graph with $$$n-1$$$ edges. Each vertex $$$v$$$ of this tree has a color assigned to it ($$$a_v = 1$$$ if the vertex $$$v$$$ is white and $$$0$$$ if the vertex $$$v$$$ is black).You have to solve the following problem for each vertex ...
256 megabytes
import java.util.*; public class HelloWorld { static TreeNode arr[]; static int ansarr[]; public static void main(String []args) { Scanner s=new Scanner(System.in); int v=s.nextInt(); arr=new TreeNode[v+1]; for(int i=1...
Java
["9\n0 1 1 1 0 0 0 0 1\n1 2\n1 3\n3 4\n3 5\n2 6\n4 7\n6 8\n5 9", "4\n0 0 1 0\n1 2\n1 3\n1 4"]
2 seconds
["2 2 2 2 2 1 1 0 2", "0 -1 1 -1"]
NoteThe first example is shown below:The black vertices have bold borders.In the second example, the best subtree for vertices $$$2, 3$$$ and $$$4$$$ are vertices $$$2, 3$$$ and $$$4$$$ correspondingly. And the best subtree for the vertex $$$1$$$ is the subtree consisting of vertices $$$1$$$ and $$$3$$$.
Java 8
standard input
[ "dp", "dfs and similar", "trees", "graphs" ]
cb8895ddd54ffbd898b1bf5e169feb63
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) β€” the number of vertices in the tree. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i$$$ is the color of the $$$i$$$-th vertex. Each of the next $$$n-1$$$ lin...
1,800
Print $$$n$$$ integers $$$res_1, res_2, \dots, res_n$$$, where $$$res_i$$$ is the maximum possible difference between the number of white and black vertices in some subtree that contains the vertex $$$i$$$.
standard output
PASSED
21b18322707898634fd352a97325b99a
train_003.jsonl
1584018300
You are given a tree consisting of $$$n$$$ vertices. A tree is a connected undirected graph with $$$n-1$$$ edges. Each vertex $$$v$$$ of this tree has a color assigned to it ($$$a_v = 1$$$ if the vertex $$$v$$$ is white and $$$0$$$ if the vertex $$$v$$$ is black).You have to solve the following problem for each vertex ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static LinkedList<Integer>[] adj; static boolean[] vis; static int[] a,count,ans; public static void main(String[] args) throws Exception { FastReader sc = new FastReader(); StringBuilder sb=new StringBuilder(); int n=sc....
Java
["9\n0 1 1 1 0 0 0 0 1\n1 2\n1 3\n3 4\n3 5\n2 6\n4 7\n6 8\n5 9", "4\n0 0 1 0\n1 2\n1 3\n1 4"]
2 seconds
["2 2 2 2 2 1 1 0 2", "0 -1 1 -1"]
NoteThe first example is shown below:The black vertices have bold borders.In the second example, the best subtree for vertices $$$2, 3$$$ and $$$4$$$ are vertices $$$2, 3$$$ and $$$4$$$ correspondingly. And the best subtree for the vertex $$$1$$$ is the subtree consisting of vertices $$$1$$$ and $$$3$$$.
Java 8
standard input
[ "dp", "dfs and similar", "trees", "graphs" ]
cb8895ddd54ffbd898b1bf5e169feb63
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) β€” the number of vertices in the tree. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i$$$ is the color of the $$$i$$$-th vertex. Each of the next $$$n-1$$$ lin...
1,800
Print $$$n$$$ integers $$$res_1, res_2, \dots, res_n$$$, where $$$res_i$$$ is the maximum possible difference between the number of white and black vertices in some subtree that contains the vertex $$$i$$$.
standard output
PASSED
d0301509e6d8ae0d16683a00aa85f8ac
train_003.jsonl
1584018300
You are given a tree consisting of $$$n$$$ vertices. A tree is a connected undirected graph with $$$n-1$$$ edges. Each vertex $$$v$$$ of this tree has a color assigned to it ($$$a_v = 1$$$ if the vertex $$$v$$$ is white and $$$0$$$ if the vertex $$$v$$$ is black).You have to solve the following problem for each vertex ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.StringTokenizer; public class F { static PrintWriter out = new PrintWriter(System.out); static int N; static ArrayList<Integer...
Java
["9\n0 1 1 1 0 0 0 0 1\n1 2\n1 3\n3 4\n3 5\n2 6\n4 7\n6 8\n5 9", "4\n0 0 1 0\n1 2\n1 3\n1 4"]
2 seconds
["2 2 2 2 2 1 1 0 2", "0 -1 1 -1"]
NoteThe first example is shown below:The black vertices have bold borders.In the second example, the best subtree for vertices $$$2, 3$$$ and $$$4$$$ are vertices $$$2, 3$$$ and $$$4$$$ correspondingly. And the best subtree for the vertex $$$1$$$ is the subtree consisting of vertices $$$1$$$ and $$$3$$$.
Java 8
standard input
[ "dp", "dfs and similar", "trees", "graphs" ]
cb8895ddd54ffbd898b1bf5e169feb63
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) β€” the number of vertices in the tree. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i$$$ is the color of the $$$i$$$-th vertex. Each of the next $$$n-1$$$ lin...
1,800
Print $$$n$$$ integers $$$res_1, res_2, \dots, res_n$$$, where $$$res_i$$$ is the maximum possible difference between the number of white and black vertices in some subtree that contains the vertex $$$i$$$.
standard output
PASSED
c875ee7fc4ea3ea046b6ad2e8dd49a1e
train_003.jsonl
1584018300
You are given a tree consisting of $$$n$$$ vertices. A tree is a connected undirected graph with $$$n-1$$$ edges. Each vertex $$$v$$$ of this tree has a color assigned to it ($$$a_v = 1$$$ if the vertex $$$v$$$ is white and $$$0$$$ if the vertex $$$v$$$ is black).You have to solve the following problem for each vertex ...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main { static LinkedList<Integer> adj[]; static void DFS(int s,int b[],int w[],int parent,int a[]){ Iterator<Integer> itr=adj[s].listIterator(); while(itr.hasNext()) { int n=itr.next(); if(n!=p...
Java
["9\n0 1 1 1 0 0 0 0 1\n1 2\n1 3\n3 4\n3 5\n2 6\n4 7\n6 8\n5 9", "4\n0 0 1 0\n1 2\n1 3\n1 4"]
2 seconds
["2 2 2 2 2 1 1 0 2", "0 -1 1 -1"]
NoteThe first example is shown below:The black vertices have bold borders.In the second example, the best subtree for vertices $$$2, 3$$$ and $$$4$$$ are vertices $$$2, 3$$$ and $$$4$$$ correspondingly. And the best subtree for the vertex $$$1$$$ is the subtree consisting of vertices $$$1$$$ and $$$3$$$.
Java 8
standard input
[ "dp", "dfs and similar", "trees", "graphs" ]
cb8895ddd54ffbd898b1bf5e169feb63
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) β€” the number of vertices in the tree. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i$$$ is the color of the $$$i$$$-th vertex. Each of the next $$$n-1$$$ lin...
1,800
Print $$$n$$$ integers $$$res_1, res_2, \dots, res_n$$$, where $$$res_i$$$ is the maximum possible difference between the number of white and black vertices in some subtree that contains the vertex $$$i$$$.
standard output
PASSED
0d15e23349aec57a20a2400f1bbee48f
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class spoj { InputStream is; PrintWriter out; void solve() { int t=ni(); while(t-->0) { int n=ni(); HashSet<Integer> hs=new HashSet<Integer>(); int lt=(int)(Math.sqrt(n)); hs.add(0); hs.add(1); hs.add(n);...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
cc764ea79bed04bd00649b5a41f16b8e
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
/** * @author derrick20 * Solved 1:12 */ import java.io.*; import java.util.*; public class EveryoneWinner { public static void main(String args[]) throws Exception { FastScanner sc = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int T = sc.nextInt(); while (...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
97f5eb6d14ce176d878f81cffb8cca7a
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.util.*; import java.io.*; public class C { static final boolean stdin = true; static final String filename = ""; static FastScanner br; static PrintWriter pw; public static void main(String[] args) throws IOException { if (stdin) { br = new FastScanner(); pw = new PrintWriter(new OutputStr...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
375943173e9b8c0421b7a579633ab3e9
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ static class pair implements Comparable<pair>{ int a,b; pair(int x,int y){ a=x;b=y; } public int compareTo(pair t){ if(t.a==this.a) return this.b-t.b; return this.a-t.a; ...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
52b35cd79a23a21aba6b05c8919c9e47
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; import java.util.TreeSet; public class C { static PrintWriter out = new PrintWriter(System.out); public static void main(String[]...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
ca582dfed87a49f5cb011679743653a2
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchException; import java.util.Linked...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
d425f18d09085bef95c1cc268ebcba01
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.*; import java.util.*; import java.util.regex.*; public class vk18 { public static void main(String[]stp) throws Exception { Scanner scan=new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); //BufferedReader br = new BufferedReader(new InputStreamReader(System.i...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
8d27d7492ae0745aa3a9cf6e8112f57a
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class a{ static int max=200001; public static void main( String [] args) throws IOException{ FastScanner sc=new FastScanner(); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); int sq=(int)Math.sqrt(n); TreeSet<Integer> tset=new Tree...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
1452ea0e17ab0effd116eb906bfab594
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); PrintWriter pw=new PrintWriter(System.out); while(t-->0) { int n=sc.nextInt(); ArrayList<Integer> list=new ArrayList(); list.add(0); T...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
52777efdcd48249b88265619894073eb
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
/* Rajkin Hossain */ import java.io.*; import java.util.*; import static java.lang.Math.*; public class C { FastInput k = new FastInput(System.in); //FastInput k = new FastInput("/home/rajkin/Desktop/input.txt"); FastOutput z = new FastOutput(); TreeSet<Integer> set; void startProgram(...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
e15fefe8c7b3c3f446a24e578a365c30
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class Solver { public static void main(String[] args) throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); int q = nextInt(); for ...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
37211d0f0148aae4c6c9a108464c3533
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
/** * BaZ :D */ import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { static MyScanner scan; static PrintWriter pw; static long MOD = 1_000_000_007; static long INF = 1_000_000_000_000_000_000L; static long inf = 2_000_000_000; public static void main(Stri...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
153a3e72d37b3b7e0569d56678cc924a
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.util.*; import java.io.*; public class MyClass { public static void main(String args[]) { FastReader sc = new FastReader(); int t = sc.nextInt(); StringBuilder sb = new StringBuilder(); while(t-->0){ long n = sc.nextLong(); TreeSet<Long> ts = new TreeSet<>(); ...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
313d2e5d3c741c26cacfaf5623606b92
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.util.*; import java.io.*; public class winner { int T, N; winner() throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); T = Integer.parseInt(in.readLine()); ...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
66a162422143fd4e1e5815e483868216
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.File; import java.io.FileNotFoundException; import java.util.*; public class C { private static List<Integer> test(int a){ HashSet<Integer> set= new HashSet<>(); set.add(0); for(int i=1;i<1000000;i++){ set.add(a/i); } List<Integer> l = new ArrayLis...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
a08012c6e97f641b7f741db786f89263
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int q = scan.nextInt(); scan.nextLine(); for (int i = 0; i < q; i++) { handleQ(scan); } } private static void handleQ(Scanner scan)...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
afc41a336456566a5c901fb809969132
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.TreeSet; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author P...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
0d958ce211ade7d8fc027cc9278a4919
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void solve(InputReader in , OutputWriter out) { int n = in.readInt(); TreeSet<Integer> set = new TreeSet<Integer>(); set.add(0); for(int i = 1; i<n; i++) { int x = n/i; int y = n/x; if(set.contains(y)) break; set.add(x); ...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
af8fe4124ed189481bff8d9ba67b5ee1
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void solve(InputReader in , OutputWriter out) { long n = in.readLong(); TreeSet<Long> set = new TreeSet<>(); set.add(0l); for(long i = 1; i*i <=n; i++) { set.add(n/i); set.add(n / (n/i)); } out.println(set.size()); for(L...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
22cdd5cee6c2952ccee29784490aa8c8
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
// @uthor -: puneet // TimeStamp -: 9:03 PM - 29/11/19 import javax.swing.*; import java.io.*; import java.math.BigInteger; import java.util.*; public class Q33 implements Runnable { public void solve() { int t=in.ni(); while(t-->0){ int n=in.ni(); TreeMap<Integer,Intege...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
6f7f9ce2ebf2f614c9378ae4580ad3af
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Objects; import java.util.PriorityQueue; import java.util.TreeSet; publi...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
45c0b6afbf86f9c20e305ea199349282
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.util.*; import java.io.*; public class R603C2 { public static void main(String[] args) { JS scan = new JS(); PrintWriter out = new PrintWriter(System.out); int t = scan.nextInt(); int max = 10_000_001; while(t-->0) { int n = scan.nextInt(); TreeSet<Integer> ans = new TreeSet<>(); for(in...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
ed6358260253fb31fb229d673b43e285
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.*; import java.util.*; public class codeforces { static class pair{ int x; int y; public pair(int x,int y){ this.x=x; this.y=y; } } public static long sqrt(long x){ long s=0,e=x,root=0; while(s<=e){ long mid...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
91e2e1aec107e53316e048a7b06744c7
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.*; import java.util.*; public class codeforces { static class pair{ int x; int y; public pair(int x,int y){ this.x=x; this.y=y; } } public static long power(int a,int b){ if(a==0 || b==0) return 1; long ans=powe...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
e6a240f79d5a98c8001ee686d36341a1
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.*; import java.util.*; public class codeforces { static class pair{ int x; int y; public pair(int x,int y){ this.x=x; this.y=y; } } public static long power(int a,int b){ if(a==0 || b==0) return 1; long ans=powe...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
9c8e2e901e8739d3087e12ea7b7f9fd6
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class Rextester{ public static void main(String[] args)throws IOException{ int max=100000; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = new Integer(br.readLine()); StringBuffer sb =...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
d9452583a4522642615fa3caf29addd5
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.*; import java.util.*; @SuppressWarnings("unused") public class Main { FastScanner in; PrintWriter out; int MOD = (int)1e9+7; long ceil(long a, long b){return (a + b - 1) / b;} long gcd(long a, long b){return b == 0 ? a : gcd(b, a % b);} long lcm(long a, long b){return a / gcd(a,...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
e0de90ca8413d7f3ce2e9fb18d2d8511
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.*; import java.util.LinkedList; public class EveryoneIsAWinner2 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int wheel = Integer.parseInt(...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
fb7daea2902ac4066cf3f9d6c350d4e0
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.*; import java.io.BufferedReader; import java.io.InputStreamReader; //import java.math.*; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { static int MD= 1000000007 ; ...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
c4851e9f620b49b982c2fd35e7ce086f
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.StringTokenizer; ...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
3aa45a43a40ce871083dccc055d98097
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.Stream; public class Contest { static ArrayList<Integer> prime=new ArrayList(); /*public static void PrimeArray(int n) { for(int i=2;i<=n;i++) { bo...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
e2317ea2147bf79ebc77cf4939679f04
train_003.jsonl
1575038100
On the well-known testing system MathForces, a draw of $$$n$$$ rating units is arranged. The rating will be distributed according to the following algorithm: if $$$k$$$ participants take part in this event, then the $$$n$$$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end o...
256 megabytes
//package codeforces.div2;//package codeforces.div3; import java.io.*; import java.util.*; public class EveryoneisaWinner { static PrintWriter pw = new PrintWriter(System.out); static public void print(Integer n) { ArrayList<Integer> list = new ArrayList<>(); list.add(0); //HashM...
Java
["4\n5\n11\n1\n3"]
1 second
["4\n0 1 2 5 \n6\n0 1 2 3 5 11 \n2\n0 1 \n3\n0 1 3"]
null
Java 8
standard input
[ "binary search", "meet-in-the-middle", "number theory", "math" ]
1fea14a5c21bf301981656cbe015864d
The first line contains integer number $$$t$$$ ($$$1 \le t \le 10$$$)Β β€” the number of test cases in the input. Then $$$t$$$ test cases follow. Each line contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$)Β β€” the total number of the rating units being drawn.
1,400
Output the answers for each of $$$t$$$ test cases. Each answer should be contained in two lines. In the first line print a single integer $$$m$$$Β β€” the number of different rating increment values that Vasya can get. In the following line print $$$m$$$ integers in ascending orderΒ β€” the values of possible rating incremen...
standard output
PASSED
7b542c305bad5053de6a93e197090625
train_003.jsonl
1504702500
Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time table that shows again and again that his plane is delayed. So he took out a sheet of paper and decided to solve some problems.First Ilya has drawn a grid of size n × n and marked n squares on it, such that no two marked squares sha...
512 megabytes
import java.io.*; import java.math.*; import java.util.*; public class CODEFORCES { private InputStream is; private PrintWriter out; class q implements Comparable<q> { int l, d, t; long ans; q(int a, int b, int ti) { l = a; this.d = b; ans = 0; t = ti; } @Override public int compareTo(...
Java
["2 3\n1 2\n1 1 1 1\n1 1 1 2\n1 1 2 2", "4 2\n1 3 2 4\n4 1 4 4\n1 1 2 3"]
2 seconds
["1\n1\n1", "3\n5"]
NoteThe first sample test has one beautiful rectangle that occupies the whole grid, therefore the answer to any query is 1.In the second sample test the first query rectangle intersects 3 beautiful rectangles, as shown on the picture below: There are 5 beautiful rectangles that intersect the second query rectangle, as...
Java 8
standard input
[ "data structures" ]
bc834c0aa602a8ba789b676affb0b33a
The first line of input contains two integers n and q (2 ≀ n ≀ 200 000, 1 ≀ q ≀ 200 000)Β β€” the size of the grid and the number of query rectangles. The second line contains n integers p1, p2, ..., pn, separated by spaces (1 ≀ pi ≀ n, all pi are different), they specify grid squares marked by Ilya: in column i he has ma...
2,100
For each query rectangle output its beauty degree on a separate line.
standard output
PASSED
6b82df7f85ded0dc9f2ff1bda7f98d7e
train_003.jsonl
1504702500
Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time table that shows again and again that his plane is delayed. So he took out a sheet of paper and decided to solve some problems.First Ilya has drawn a grid of size n × n and marked n squares on it, such that no two marked squares sha...
512 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.lang.*; public class Main { private static FastReader sc = new FastReader(System.in); private static OutputWriter out = new OutputWriter(System.out); private static HashMap<Integer, ArrayList<Integer>> leftIdx, rightIdx; public stat...
Java
["2 3\n1 2\n1 1 1 1\n1 1 1 2\n1 1 2 2", "4 2\n1 3 2 4\n4 1 4 4\n1 1 2 3"]
2 seconds
["1\n1\n1", "3\n5"]
NoteThe first sample test has one beautiful rectangle that occupies the whole grid, therefore the answer to any query is 1.In the second sample test the first query rectangle intersects 3 beautiful rectangles, as shown on the picture below: There are 5 beautiful rectangles that intersect the second query rectangle, as...
Java 8
standard input
[ "data structures" ]
bc834c0aa602a8ba789b676affb0b33a
The first line of input contains two integers n and q (2 ≀ n ≀ 200 000, 1 ≀ q ≀ 200 000)Β β€” the size of the grid and the number of query rectangles. The second line contains n integers p1, p2, ..., pn, separated by spaces (1 ≀ pi ≀ n, all pi are different), they specify grid squares marked by Ilya: in column i he has ma...
2,100
For each query rectangle output its beauty degree on a separate line.
standard output
PASSED
ca34c6d51ac3826c0590a7ad70fbb95b
train_003.jsonl
1273154400
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A.You are given three segments on the plane. They form the letter A if the following conditions hold: Two segments have common endpoint (le...
64 megabytes
import java.util.*; public class B { public static void main(String[] args) { new B(new Scanner(System.in)); } double EPS = 1e-15; line[] rs; void swap(int i, int j) { line tmp = rs[i]; rs[i] = rs[j]; rs[j] = tmp; } boolean resolve() { for (int i=0; i<3;...
Java
["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 5 2 -1\n1 2 0 1"]
1 second
["YES\nNO\nYES"]
null
Java 6
standard input
[ "implementation", "geometry" ]
254a61b06acd3f25e7287ab90be614f1
The first line contains one integer t (1 ≀ t ≀ 10000) β€” the number of test cases to solve. Each case consists of three lines. Each of these three lines contains four space-separated integers β€” coordinates of the endpoints of one of the segments. All coordinates do not exceed 108 by absolute value. All segments have pos...
2,000
Output one line for each test case. Print Β«YESΒ» (without quotes), if the segments form the letter A and Β«NOΒ» otherwise.
standard output
PASSED
c6bd79ae1909336a8e36412eeb8b50f2
train_003.jsonl
1273154400
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A.You are given three segments on the plane. They form the letter A if the following conditions hold: Two segments have common endpoint (le...
64 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class B { public static boolean intersect(int x, int y, long[][] L) { boolean can = false; long v1X = 0, v1Y = 0, v2X = 0, v2Y = 0; for (int i = 0; i < 4; i += 2) for (int j = 0;...
Java
["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 5 2 -1\n1 2 0 1"]
1 second
["YES\nNO\nYES"]
null
Java 6
standard input
[ "implementation", "geometry" ]
254a61b06acd3f25e7287ab90be614f1
The first line contains one integer t (1 ≀ t ≀ 10000) β€” the number of test cases to solve. Each case consists of three lines. Each of these three lines contains four space-separated integers β€” coordinates of the endpoints of one of the segments. All coordinates do not exceed 108 by absolute value. All segments have pos...
2,000
Output one line for each test case. Print Β«YESΒ» (without quotes), if the segments form the letter A and Β«NOΒ» otherwise.
standard output
PASSED
90f8b5bae2c21f0102325fd3719e145b
train_003.jsonl
1273154400
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A.You are given three segments on the plane. They form the letter A if the following conditions hold: Two segments have common endpoint (le...
64 megabytes
import java.io.*; import java.text.*; import java.util.*; public class LetterA { static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static String LINE() throws Exception { return stdin.readLine(); } static String TOKEN() throws Exception { while (st =...
Java
["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 5 2 -1\n1 2 0 1"]
1 second
["YES\nNO\nYES"]
null
Java 6
standard input
[ "implementation", "geometry" ]
254a61b06acd3f25e7287ab90be614f1
The first line contains one integer t (1 ≀ t ≀ 10000) β€” the number of test cases to solve. Each case consists of three lines. Each of these three lines contains four space-separated integers β€” coordinates of the endpoints of one of the segments. All coordinates do not exceed 108 by absolute value. All segments have pos...
2,000
Output one line for each test case. Print Β«YESΒ» (without quotes), if the segments form the letter A and Β«NOΒ» otherwise.
standard output
PASSED
b8709f3daac674ea1da121bb6e64268b
train_003.jsonl
1273154400
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A.You are given three segments on the plane. They form the letter A if the following conditions hold: Two segments have common endpoint (le...
64 megabytes
import java.io.*; import java.text.*; import java.util.*; public class LetterA { static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static String LINE() throws Exception { return stdin.readLine(); } static String TOKEN() throws Exception { while (st =...
Java
["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 5 2 -1\n1 2 0 1"]
1 second
["YES\nNO\nYES"]
null
Java 6
standard input
[ "implementation", "geometry" ]
254a61b06acd3f25e7287ab90be614f1
The first line contains one integer t (1 ≀ t ≀ 10000) β€” the number of test cases to solve. Each case consists of three lines. Each of these three lines contains four space-separated integers β€” coordinates of the endpoints of one of the segments. All coordinates do not exceed 108 by absolute value. All segments have pos...
2,000
Output one line for each test case. Print Β«YESΒ» (without quotes), if the segments form the letter A and Β«NOΒ» otherwise.
standard output
PASSED
56eb39c29b340c2fcd85689edae87ac0
train_003.jsonl
1273154400
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A.You are given three segments on the plane. They form the letter A if the following conditions hold: Two segments have common endpoint (le...
64 megabytes
import java.util.Scanner; public class ProblemB { private class Segment{ public long x1; public long y1; public long x2; public long y2; public int common; // какая Π²Π΅Ρ€ΡˆΠΈΠ½Π° 1 ΠΈΠ»ΠΈ 2 public boolean isBinding=false; public Segment() { } public Se...
Java
["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 5 2 -1\n1 2 0 1"]
1 second
["YES\nNO\nYES"]
null
Java 6
standard input
[ "implementation", "geometry" ]
254a61b06acd3f25e7287ab90be614f1
The first line contains one integer t (1 ≀ t ≀ 10000) β€” the number of test cases to solve. Each case consists of three lines. Each of these three lines contains four space-separated integers β€” coordinates of the endpoints of one of the segments. All coordinates do not exceed 108 by absolute value. All segments have pos...
2,000
Output one line for each test case. Print Β«YESΒ» (without quotes), if the segments form the letter A and Β«NOΒ» otherwise.
standard output
PASSED
7cbc9d368f314c16ec627a5683cc919f
train_003.jsonl
1273154400
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A.You are given three segments on the plane. They form the letter A if the following conditions hold: Two segments have common endpoint (le...
64 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; public class ProblemB { public static void main(String[] args) throws IOException { BufferedReader s = new BufferedReader(new InputStreamRe...
Java
["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 5 2 -1\n1 2 0 1"]
1 second
["YES\nNO\nYES"]
null
Java 6
standard input
[ "implementation", "geometry" ]
254a61b06acd3f25e7287ab90be614f1
The first line contains one integer t (1 ≀ t ≀ 10000) β€” the number of test cases to solve. Each case consists of three lines. Each of these three lines contains four space-separated integers β€” coordinates of the endpoints of one of the segments. All coordinates do not exceed 108 by absolute value. All segments have pos...
2,000
Output one line for each test case. Print Β«YESΒ» (without quotes), if the segments form the letter A and Β«NOΒ» otherwise.
standard output
PASSED
d54bdf339456b9ed79bb13e75ac1ec2d
train_003.jsonl
1273154400
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A.You are given three segments on the plane. They form the letter A if the following conditions hold: Two segments have common endpoint (le...
64 megabytes
//package round13; import java.io.BufferedOutputStream; import java.io.PrintStream; import java.io.PrintWriter; import java.io.StringReader; import java.util.Arrays; import java.util.Scanner; public class B { private Scanner in; private PrintWriter out; public void solve() { double[][] p = new double[3][4]; ...
Java
["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 5 2 -1\n1 2 0 1"]
1 second
["YES\nNO\nYES"]
null
Java 6
standard input
[ "implementation", "geometry" ]
254a61b06acd3f25e7287ab90be614f1
The first line contains one integer t (1 ≀ t ≀ 10000) β€” the number of test cases to solve. Each case consists of three lines. Each of these three lines contains four space-separated integers β€” coordinates of the endpoints of one of the segments. All coordinates do not exceed 108 by absolute value. All segments have pos...
2,000
Output one line for each test case. Print Β«YESΒ» (without quotes), if the segments form the letter A and Β«NOΒ» otherwise.
standard output
PASSED
ea4e64cce1b909bd7aa228f56eb352ad
train_003.jsonl
1273154400
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A.You are given three segments on the plane. They form the letter A if the following conditions hold: Two segments have common endpoint (le...
64 megabytes
import java.util.Scanner; public class B { static class Line { long x1, y1, x2, y2; public Line(int x1, int y1, int x2, int y2) { this.x1 = x1; this.x2 = x2; this.y1 = y1; this.y2 = y2; } public boolean sharePoint(Line l) { ...
Java
["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 5 2 -1\n1 2 0 1"]
1 second
["YES\nNO\nYES"]
null
Java 6
standard input
[ "implementation", "geometry" ]
254a61b06acd3f25e7287ab90be614f1
The first line contains one integer t (1 ≀ t ≀ 10000) β€” the number of test cases to solve. Each case consists of three lines. Each of these three lines contains four space-separated integers β€” coordinates of the endpoints of one of the segments. All coordinates do not exceed 108 by absolute value. All segments have pos...
2,000
Output one line for each test case. Print Β«YESΒ» (without quotes), if the segments form the letter A and Β«NOΒ» otherwise.
standard output
PASSED
ebcbe7ab576b6c356675dff1ee1f4865
train_003.jsonl
1273154400
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A.You are given three segments on the plane. They form the letter A if the following conditions hold: Two segments have common endpoint (le...
64 megabytes
import java.util.*; public class A { static double EPS = 1e-9; public static void main(String[] args){ Scanner reader = new Scanner(System.in); int n = reader.nextInt(); while(n --> 0){ Seg a = new Seg(reader); Seg b = new Seg(reader); Seg c = new Seg(reader); if(a.shares(b)){ eval(a,b,c); ...
Java
["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 5 2 -1\n1 2 0 1"]
1 second
["YES\nNO\nYES"]
null
Java 6
standard input
[ "implementation", "geometry" ]
254a61b06acd3f25e7287ab90be614f1
The first line contains one integer t (1 ≀ t ≀ 10000) β€” the number of test cases to solve. Each case consists of three lines. Each of these three lines contains four space-separated integers β€” coordinates of the endpoints of one of the segments. All coordinates do not exceed 108 by absolute value. All segments have pos...
2,000
Output one line for each test case. Print Β«YESΒ» (without quotes), if the segments form the letter A and Β«NOΒ» otherwise.
standard output
PASSED
1844a4566def2c4c7452b5ace25dfd00
train_003.jsonl
1273154400
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A.You are given three segments on the plane. They form the letter A if the following conditions hold: Two segments have common endpoint (le...
64 megabytes
//package round13; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; public class B { static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); static int nextInt(...
Java
["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 5 2 -1\n1 2 0 1"]
1 second
["YES\nNO\nYES"]
null
Java 6
standard input
[ "implementation", "geometry" ]
254a61b06acd3f25e7287ab90be614f1
The first line contains one integer t (1 ≀ t ≀ 10000) β€” the number of test cases to solve. Each case consists of three lines. Each of these three lines contains four space-separated integers β€” coordinates of the endpoints of one of the segments. All coordinates do not exceed 108 by absolute value. All segments have pos...
2,000
Output one line for each test case. Print Β«YESΒ» (without quotes), if the segments form the letter A and Β«NOΒ» otherwise.
standard output
PASSED
0ff325b4c352c63cfbb3688e1bf6e715
train_003.jsonl
1273154400
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A.You are given three segments on the plane. They form the letter A if the following conditions hold: Two segments have common endpoint (le...
64 megabytes
import java.util.*; import java.awt.Point; import java.awt.geom.Line2D; import java.awt.geom.Point2D; import java.io.*; import java.math.BigInteger; public class Main implements Runnable { class Point { long x; long y; public Point(long x, long y) { this.x = x; this.y = y; } @Override public boole...
Java
["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 5 2 -1\n1 2 0 1"]
1 second
["YES\nNO\nYES"]
null
Java 6
standard input
[ "implementation", "geometry" ]
254a61b06acd3f25e7287ab90be614f1
The first line contains one integer t (1 ≀ t ≀ 10000) β€” the number of test cases to solve. Each case consists of three lines. Each of these three lines contains four space-separated integers β€” coordinates of the endpoints of one of the segments. All coordinates do not exceed 108 by absolute value. All segments have pos...
2,000
Output one line for each test case. Print Β«YESΒ» (without quotes), if the segments form the letter A and Β«NOΒ» otherwise.
standard output
PASSED
9af96f2a2359562c151bd11ac30b4356
train_003.jsonl
1273154400
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A.You are given three segments on the plane. They form the letter A if the following conditions hold: Two segments have common endpoint (le...
64 megabytes
import java.util.*; import java.awt.geom.Line2D; import java.awt.geom.Point2D; import java.awt.geom.Point2D.Double; import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; public class Main implements Runnable { public void solution() throws IOException { // System.out.println(dist(new Point2...
Java
["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 5 2 -1\n1 2 0 1"]
1 second
["YES\nNO\nYES"]
null
Java 6
standard input
[ "implementation", "geometry" ]
254a61b06acd3f25e7287ab90be614f1
The first line contains one integer t (1 ≀ t ≀ 10000) β€” the number of test cases to solve. Each case consists of three lines. Each of these three lines contains four space-separated integers β€” coordinates of the endpoints of one of the segments. All coordinates do not exceed 108 by absolute value. All segments have pos...
2,000
Output one line for each test case. Print Β«YESΒ» (without quotes), if the segments form the letter A and Β«NOΒ» otherwise.
standard output
PASSED
49fc7c2babe77143b65459b9488f864d
train_003.jsonl
1273154400
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A.You are given three segments on the plane. They form the letter A if the following conditions hold: Two segments have common endpoint (le...
64 megabytes
import java.io.*; import java.util.*; public class LetterA { public Scanner in = new Scanner(System.in); public PrintStream out = System.out; public Pair[][] P; public Pair a, b, c; public void main() { int i; int TCase, cc; TCase = in.nextInt(); for(cc=1;cc<=TCase;++cc) { P = new Pair[3][2];...
Java
["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 5 2 -1\n1 2 0 1"]
1 second
["YES\nNO\nYES"]
null
Java 6
standard input
[ "implementation", "geometry" ]
254a61b06acd3f25e7287ab90be614f1
The first line contains one integer t (1 ≀ t ≀ 10000) β€” the number of test cases to solve. Each case consists of three lines. Each of these three lines contains four space-separated integers β€” coordinates of the endpoints of one of the segments. All coordinates do not exceed 108 by absolute value. All segments have pos...
2,000
Output one line for each test case. Print Β«YESΒ» (without quotes), if the segments form the letter A and Β«NOΒ» otherwise.
standard output
PASSED
cf70498cf9f142f19a2f5865113377cd
train_003.jsonl
1273154400
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A.You are given three segments on the plane. They form the letter A if the following conditions hold: Two segments have common endpoint (le...
64 megabytes
import java.util.*; import java.io.*; public class Solution { static class Segment { long x1, y1, x2, y2; public Segment(BufferedReader br) throws IOException { StringTokenizer st = new StringTokenizer(br.readLine()); x1 = Long.parseLong(st.nextToken()); y1 = Lo...
Java
["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 5 2 -1\n1 2 0 1"]
1 second
["YES\nNO\nYES"]
null
Java 6
standard input
[ "implementation", "geometry" ]
254a61b06acd3f25e7287ab90be614f1
The first line contains one integer t (1 ≀ t ≀ 10000) β€” the number of test cases to solve. Each case consists of three lines. Each of these three lines contains four space-separated integers β€” coordinates of the endpoints of one of the segments. All coordinates do not exceed 108 by absolute value. All segments have pos...
2,000
Output one line for each test case. Print Β«YESΒ» (without quotes), if the segments form the letter A and Β«NOΒ» otherwise.
standard output
PASSED
b80c2c219d52b6953849090ce3f780c9
train_003.jsonl
1273154400
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A.You are given three segments on the plane. They form the letter A if the following conditions hold: Two segments have common endpoint (le...
64 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.fill; import static java.util.Arrays.binarySearch; import static java.util.Arrays.sort; public class Main { public static void main(String[] args) throws IOException { try { if (new File("input.txt").exists()) { ...
Java
["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 5 2 -1\n1 2 0 1"]
1 second
["YES\nNO\nYES"]
null
Java 6
standard input
[ "implementation", "geometry" ]
254a61b06acd3f25e7287ab90be614f1
The first line contains one integer t (1 ≀ t ≀ 10000) β€” the number of test cases to solve. Each case consists of three lines. Each of these three lines contains four space-separated integers β€” coordinates of the endpoints of one of the segments. All coordinates do not exceed 108 by absolute value. All segments have pos...
2,000
Output one line for each test case. Print Β«YESΒ» (without quotes), if the segments form the letter A and Β«NOΒ» otherwise.
standard output
PASSED
0c513180f3a96fca630bf6dfc0d1c128
train_003.jsonl
1429286400
Polycarp invented a new way to encode strings. Let's assume that we have string T, consisting of lowercase English letters. Let's choose several pairs of letters of the English alphabet in such a way that each letter occurs in at most one pair. Then let's replace each letter in T with its pair letter if there is a pair...
256 megabytes
import java.util.Comparator; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Random; import java.util.Collection; import java.util.List; import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.util.ArrayList; import java...
Java
["11 5\nabacabadaba\nacaba", "21 13\nparaparallelogramgram\nqolorreraglom"]
3 seconds
["3\n1 3 7", "1\n5"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "strings" ]
faa26846744b7b7f90ba1b521fee0bc6
The first line of the input contains two integers, |S| and |T| (1 ≀ |T| ≀ |S| ≀ 2Β·105) β€” the lengths of string S and string T, respectively. The second and third line of the input contain strings S and T, respectively. Both strings consist only of lowercase English letters.
2,400
Print number k β€” the number of suitable positions in string S. In the next line print k integers m1, m2, ..., mk β€” the numbers of the suitable positions in the increasing order.
standard output
PASSED
c0cf870af499efef1711592009b76212
train_003.jsonl
1429286400
Polycarp invented a new way to encode strings. Let's assume that we have string T, consisting of lowercase English letters. Let's choose several pairs of letters of the English alphabet in such a way that each letter occurs in at most one pair. Then let's replace each letter in T with its pair letter if there is a pair...
256 megabytes
import java.util.*; import java.io.*; public class f { public static void main(String[] arg) throws IOException { new f(); } public f() throws IOException { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); int m = in.nextInt(); if(m == 1...
Java
["11 5\nabacabadaba\nacaba", "21 13\nparaparallelogramgram\nqolorreraglom"]
3 seconds
["3\n1 3 7", "1\n5"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "strings" ]
faa26846744b7b7f90ba1b521fee0bc6
The first line of the input contains two integers, |S| and |T| (1 ≀ |T| ≀ |S| ≀ 2Β·105) β€” the lengths of string S and string T, respectively. The second and third line of the input contain strings S and T, respectively. Both strings consist only of lowercase English letters.
2,400
Print number k β€” the number of suitable positions in string S. In the next line print k integers m1, m2, ..., mk β€” the numbers of the suitable positions in the increasing order.
standard output
PASSED
0820bdb0d2a7b512254c40d4d1a89fc7
train_003.jsonl
1429286400
Polycarp invented a new way to encode strings. Let's assume that we have string T, consisting of lowercase English letters. Let's choose several pairs of letters of the English alphabet in such a way that each letter occurs in at most one pair. Then let's replace each letter in T with its pair letter if there is a pair...
256 megabytes
import java.math.*; import java.util.*; public class Main { public static int mod=1000000007; public static int NN=200010; public static int n, m, f=1; public static int[][] ha=new int[NN][27]; public static int[] hb=new int[27]; public static int calc(int st, i...
Java
["11 5\nabacabadaba\nacaba", "21 13\nparaparallelogramgram\nqolorreraglom"]
3 seconds
["3\n1 3 7", "1\n5"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "strings" ]
faa26846744b7b7f90ba1b521fee0bc6
The first line of the input contains two integers, |S| and |T| (1 ≀ |T| ≀ |S| ≀ 2Β·105) β€” the lengths of string S and string T, respectively. The second and third line of the input contain strings S and T, respectively. Both strings consist only of lowercase English letters.
2,400
Print number k β€” the number of suitable positions in string S. In the next line print k integers m1, m2, ..., mk β€” the numbers of the suitable positions in the increasing order.
standard output
PASSED
16b42c9d0bc6737cc105b5b70fda0532
train_003.jsonl
1429286400
Polycarp invented a new way to encode strings. Let's assume that we have string T, consisting of lowercase English letters. Let's choose several pairs of letters of the English alphabet in such a way that each letter occurs in at most one pair. Then let's replace each letter in T with its pair letter if there is a pair...
256 megabytes
import java.io.BufferedWriter; import java.util.InputMismatchException; import java.util.ArrayList; import java.util.NoSuchElementException; import java.util.List; import java.math.BigInteger; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.IOException; import java.util.Ar...
Java
["11 5\nabacabadaba\nacaba", "21 13\nparaparallelogramgram\nqolorreraglom"]
3 seconds
["3\n1 3 7", "1\n5"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "strings" ]
faa26846744b7b7f90ba1b521fee0bc6
The first line of the input contains two integers, |S| and |T| (1 ≀ |T| ≀ |S| ≀ 2Β·105) β€” the lengths of string S and string T, respectively. The second and third line of the input contain strings S and T, respectively. Both strings consist only of lowercase English letters.
2,400
Print number k β€” the number of suitable positions in string S. In the next line print k integers m1, m2, ..., mk β€” the numbers of the suitable positions in the increasing order.
standard output
PASSED
e713e6d8e70e85b3a51019b65be6218f
train_003.jsonl
1429286400
Polycarp invented a new way to encode strings. Let's assume that we have string T, consisting of lowercase English letters. Let's choose several pairs of letters of the English alphabet in such a way that each letter occurs in at most one pair. Then let's replace each letter in T with its pair letter if there is a pair...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class F implements Runnable { private static BufferedReader in; private static PrintWriter out; private static StringTokenizer st; private static Random rnd; final int totalLetters = 26; private void solve() throws IOException { nextInt(); ne...
Java
["11 5\nabacabadaba\nacaba", "21 13\nparaparallelogramgram\nqolorreraglom"]
3 seconds
["3\n1 3 7", "1\n5"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "strings" ]
faa26846744b7b7f90ba1b521fee0bc6
The first line of the input contains two integers, |S| and |T| (1 ≀ |T| ≀ |S| ≀ 2Β·105) β€” the lengths of string S and string T, respectively. The second and third line of the input contain strings S and T, respectively. Both strings consist only of lowercase English letters.
2,400
Print number k β€” the number of suitable positions in string S. In the next line print k integers m1, m2, ..., mk β€” the numbers of the suitable positions in the increasing order.
standard output
PASSED
6558fc31f5199f138eb50a3f409d14c8
train_003.jsonl
1429286400
Polycarp invented a new way to encode strings. Let's assume that we have string T, consisting of lowercase English letters. Let's choose several pairs of letters of the English alphabet in such a way that each letter occurs in at most one pair. Then let's replace each letter in T with its pair letter if there is a pair...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; public class F { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); ...
Java
["11 5\nabacabadaba\nacaba", "21 13\nparaparallelogramgram\nqolorreraglom"]
3 seconds
["3\n1 3 7", "1\n5"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "strings" ]
faa26846744b7b7f90ba1b521fee0bc6
The first line of the input contains two integers, |S| and |T| (1 ≀ |T| ≀ |S| ≀ 2Β·105) β€” the lengths of string S and string T, respectively. The second and third line of the input contain strings S and T, respectively. Both strings consist only of lowercase English letters.
2,400
Print number k β€” the number of suitable positions in string S. In the next line print k integers m1, m2, ..., mk β€” the numbers of the suitable positions in the increasing order.
standard output
PASSED
c91018de09e44138ef7aef0783fa9015
train_003.jsonl
1462633500
Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class ProblemC { public static void main(String[] args) { InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out); new Prob...
Java
["4\n1 2 1 2", "3\n1 1 1"]
2 seconds
["7 3 0 0", "6 0 0"]
NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval...
Java 7
standard input
[]
f292c099e4eac9259a5bc9e42ff6d1b5
The first line of the input contains a single integer n (1 ≀ n ≀ 5000)Β β€” the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≀ ti ≀ n) where ti is the color of the i-th ball.
1,500
Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color.
standard output
PASSED
e555f0e39985c305dae5180579e615cd
train_003.jsonl
1462633500
Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; import java.text.DecimalFormat; import java.math.BigInteger; public class Main{ static int d=20,n; static int mod=1000000007 ; static ArrayList<ArrayList<Integer>> arr; static int[] a,b,c; public static void main(String[] args) throws IOE...
Java
["4\n1 2 1 2", "3\n1 1 1"]
2 seconds
["7 3 0 0", "6 0 0"]
NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval...
Java 7
standard input
[]
f292c099e4eac9259a5bc9e42ff6d1b5
The first line of the input contains a single integer n (1 ≀ n ≀ 5000)Β β€” the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≀ ti ≀ n) where ti is the color of the i-th ball.
1,500
Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color.
standard output
PASSED
a7efb6caae6df695096f20ceea62ce08
train_003.jsonl
1462633500
Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; import java.util.*; /** * Built using CHelper plug-...
Java
["4\n1 2 1 2", "3\n1 1 1"]
2 seconds
["7 3 0 0", "6 0 0"]
NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval...
Java 7
standard input
[]
f292c099e4eac9259a5bc9e42ff6d1b5
The first line of the input contains a single integer n (1 ≀ n ≀ 5000)Β β€” the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≀ ti ≀ n) where ti is the color of the i-th ball.
1,500
Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color.
standard output
PASSED
9d4e8bdd1011219731784c71382fcca5
train_003.jsonl
1455894000
Consider the decimal presentation of an integer. Let's call a number d-magic if digit d appears in decimal presentation of the number on even positions and nowhere else.For example, the numbers 1727374, 17, 1 are 7-magic but 77, 7, 123, 34, 71 are not 7-magic. On the other hand the number 7 is 0-magic, 123 is 2-magic, ...
256 megabytes
import java.io.*; import java.util.*; //import javafx.util.*; import java.math.*; //import java.lang.*; public class Main { // static int n; static HashSet<Integer> adj[]; static boolean vis[]; // static long ans[]; // static int arr[]; static long mod=1000000007; static final ...
Java
["2 6\n10\n99", "2 0\n1\n9", "19 7\n1000\n9999"]
2 seconds
["8", "4", "6"]
NoteThe numbers from the answer of the first example are 16, 26, 36, 46, 56, 76, 86 and 96.The numbers from the answer of the second example are 2, 4, 6 and 8.The numbers from the answer of the third example are 1767, 2717, 5757, 6707, 8797 and 9747.
Java 11
standard input
[ "dp" ]
19564d66e0de78780f4a61c69f2c8e27
The first line contains two integers m, d (1 ≀ m ≀ 2000, 0 ≀ d ≀ 9) β€” the parameters from the problem statement. The second line contains positive integer a in decimal presentation (without leading zeroes). The third line contains positive integer b in decimal presentation (without leading zeroes). It is guaranteed tha...
2,200
Print the only integer a β€” the remainder after dividing by 109 + 7 of the number of d-magic numbers in segment [a, b] that are multiple of m.
standard output
PASSED
bd75e0dcc93c041227e959478270b66a
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.io.*; import java.io.ObjectInputStream.GetField; import java.math.*; import java.text.*; import java.util.*; //Codeforces public class MainCodeforces1 { private static MyScanner in; private static PrintStream out; private static boolean LOCAL_TEST = false; private static void solve() throws IOExceptio...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
320ec98c7078a201d25e4a2f3445abca
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.io.*; import java.util.*; public class Solution { private static void solve(InputReader in, OutputWriter out) { int n = in.nextInt(); List<Integer> positive, negative; positive = new ArrayList<Integer>(); negative = new ArrayList<Integer>(); for (int i = 0; i ...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
7ae05ed8d2ee36700e1be46a1e24533a
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.util.*; /** * * @author greggy */ public class Array { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int group[] = new int[n]; for (int i = 0; i < n; i++) group[i] = in.nextInt(); ...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
d8cf1e040d7e0874b9e42211310c93da
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class A { public static void main(String[] args){ FastScanner sc...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
1395e11eb92ea9a2b60cf0cde970886d
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.util.*; public class Main { public static void main (String [] args){ int k=0; int m=0; int cnt1=0; int cnt2=0; int cnt3=0; Scanner in = new Scanner (System.in); int n= in.nextInt(); int array1 []=new int [n]; int array2 []=new int [n]; for(int i=1;i<=n;i++){ ...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
fc2edc1d89839007ebab1840c226fc91
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.io.*; import java.util.*; public class a { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int x = 0,y = 0,z = 0; int a[] = new int[n+1],b[] = new int[n+1]; boolean flag = false,find = false; for (in...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
dc336d38b9780dc8275bb1b74b08e8a3
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Smile { static Scanner in; static PrintWriter out; static void print(List<Integer> x) { out.print(x.size()); for (Integer y : x) { out.print(" " + y); } out.println(); } public stati...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
fbbd4e0fd8094257590e29045819f357
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class Smile { static Scanner in; static PrintWriter out; public static void main(String[] args) { in = new Scanner(System.in); out = new PrintWriter(System.out); int n = in.nextInt(); int[] a = new int[n]; for (int i ...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
7951040302d9c27ff1365d364811f66d
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) throws IOException { BufferedReader t = new BufferedReader(new InputStreamReader(System.in)); int no = Integer.parseInt(t.readLine(...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
8ffcc0b37e530ee938c5a70b2610cae6
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Array { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] a = br.readLine().split(" "); int...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
e92e9ceda26c7cc515a028238ce2a0ea
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Array { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] a = br.readLine().split(" "); int...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
06c5c18863578ef7fafdd2664b1aa070
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; /** * * @author V1029 */ public class A { public static void main(String args[])throws IOException { int n,mcount=0,pcount=0,pflag,mflag=1,zflag = 0; ArrayList alm=new ArrayList(); ...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
76b4e61f936e8d61755df8f9e3396964
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; public class Array { public static void main(String[]args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); LinkedList<Integer> negative= new LinkedList<Integer>(); LinkedList<Integer> positive= new LinkedList<Integer>...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
91aaf9aa76b82cf2e40558710147a509
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int x = in.nextInt(); StringBuilder out = new StringBuilder(); List<Integer> first = new ArrayList<>(); List<Integer> second = new ArrayList<>(); List...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
58a68ad2801dc8f217d7fd9b2df79095
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); StringBuilder out = new StringBuilder(); List<Integer> first = new ArrayList<>(); List<Integer> second = new ArrayList<>(); List...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
89fdbfda420ee6a6041037ff1f50ff6a
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.awt.Point; import java.io.*; import java.math.BigInteger; import java.util.*; import java.util.Map.Entry; import static java.lang.Math.*; public class Solve implements Runnable{ final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; ...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
efad22b866f9f0a5f96a4f90a46cfb58
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class TaskA { public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int c1=0; int[] a = new int[n]; for(int i=0; i<n; i++...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
2b75f80dead9aa2a33344e9fefaeb83e
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
/*import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class A_Div2_181 { public static void main(String[]arg) throws IOException { BufferedReader in = new BufferedRead...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
40e4de00f1c416d8cbd97e24bc04e1e9
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.util.*; //Scanner; import java.io.PrintWriter; //PrintWriter public class R181_Div2_A //Name: Array { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); solve(in, out); out.close(); in.close(); } public static vo...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
6f55d26e1ec4157d9e6e982be6ea7bb3
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.util.LinkedList; import java.io.*; public class sets { public static void grouping(String [] arr) { LinkedList<Integer> neg = new LinkedList<Integer>(); int first = 0; LinkedList<Integer> pos = new LinkedList<Integer>(); int second = 0; LinkedList<Integer> zero = ...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
c3fe48f4f0c7946560505ed7733a2df0
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; public class CF_181_C { public static void m...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
0d6e242847697c53282115af2880c99d
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.TreeSet; import java.util.Arrays; public class Array { public static void main(String[] args) throws Exception { BufferedReader br =new BufferedReader( new InputStreamReader(System.in)); int begin,end,size; int n=Integer.parseInt...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
403100a9b61bf9d98824719b57ef9a57
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; public class DoubleCola { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int inputs = scan.nextInt(); int[] values = new int[inputs]; boolean flag = false; for (int i = 0; i < inputs; i++) { v...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
54981041ad957e7b8a83a60bf7e90c24
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inpu...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
c053cf0cea1cdcf1e9732754758513bd
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; for(int i = 0; i < n; i++) a[i] = in.nextInt(); Arrays.sort(a); int id1 = 0; for(int i = 0; i < n; i+...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
1c9a4de4260f7ad9b576584ffb6de476
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; for(int i = 0; i < n; i++) a[i] = in.nextInt(); Arrays.sort(a); int id1 = 0; for(int i = 0; i < n; i+...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
e911ab32028a6268b63d62a91d37839c
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.io.BufferedWriter; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class A { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub PrintWriter out = new PrintWriter(new BufferedW...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
f9295a828ad36014ed5648f72d888933
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.io.*; import java.util.*; public class Cf300a { public static void main(String[] args) throws IOException { InputStreamReader fin = new InputStreamReader(System.in); Scanner scr = new Scanner(fin); int n = scr.nextInt(); int [] k = new int [n]; for (int i = 0; i <...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
b8068ff1b7844cd3ea2121becb9f4c59
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.io.*; import java.util.*; public class A181{ private BufferedReader in; private StringTokenizer st; private PrintWriter out; int getSign(int []x,int i,int j){ if(i>j) return 2; int sign = 1; for (int ...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
9fb4cf1fe28c3f58412624760efd0da8
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class P300A { public static void prt(ArrayList<Integer> a) { System.out.print(a.size() + " "); for (int i = 0; i < a.size() - 1; i++) { System.out.print(a.get(i) + " "); } System.out.print(a.get(a.size() - 1))...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
69559f28b584851fb3645efc554d45a5
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.util.Scanner; /** * Created by root on 28/5/16. */ public class a { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int size=sc.nextInt(); int[] num=new int[size]; // read the array for (int i = 0; i <size ; i++) { num[i]...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
fd7241a919a366fd27e0fe6a865961d1
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author yy */ public class Main { public static void main(String[] args) { InputStream inputStream = Syst...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
50301fd23e2ca69a9b64596fde1f6d1f
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); bf.readLine(); Str...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
1af5cfe69a1c9763598c72308ed33524
train_003.jsonl
1366903800
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero ( &lt; 0). The product of all numbers in the second set is greater than zero ( &gt; 0). The product of all number...
256 megabytes
import java.sql.Time; import java.util.Arrays; import java.util.Locale; import java.util.Scanner; public class MainTest { static void print(int a[]) { for(int i=0;i<a.length;i++) System.out.print(a[i]+" "); System.out.println(); } static void print(long a[]) { for(int i=0;i...
Java
["3\n-1 2 0", "4\n-1 -2 -3 0"]
2 seconds
["1 -1\n1 2\n1 0", "1 -1\n2 -3 -2\n1 0"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
03cf2cc26c84aab685ee78a1d6318b30
The first line of the input contains integer n (3 ≀ n ≀ 100). The second line contains n space-separated distinct integers a1, a2, ..., an (|ai| ≀ 103) β€” the array elements.
1,100
In the first line print integer n1 (n1 &gt; 0) β€” the number of elements in the first set. Then print n1 numbers β€” the elements that got to the first set. In the next line print integer n2 (n2 &gt; 0) β€” the number of elements in the second set. Then print n2 numbers β€” the elements that got to the second set. In the next...
standard output
PASSED
9685fa6e25e6dd808eadebbdef958920
train_003.jsonl
1340983800
A widely known among some people Belarusian sport programmer Yura possesses lots of information about cars. That is why he has been invited to participate in a game show called "Guess That Car!".The game show takes place on a giant parking lot, which is 4n meters long from north to south and 4m meters wide from west to...
256 megabytes
import java.io.*; import java.util.*; public class cf201b { static int n,m; static int[][] v; public static void main(String[] args) { FastIO in = new FastIO(), out = in; n = in.nextInt(); m = in.nextInt(); v = new int[n][m]; long[] xv = new long[n]; long[] yv = new long[m]; for(int i...
Java
["2 3\n3 4 5\n3 9 1", "3 4\n1 0 0 0\n0 0 3 0\n0 0 5 5"]
2 seconds
["392\n1 1", "240\n2 3"]
NoteIn the first test case the total time of guessing all cars is equal to 3Β·8 + 3Β·8 + 4Β·8 + 9Β·8 + 5Β·40 + 1Β·40 = 392.The coordinate system of the field:
Java 7
standard input
[ "dp", "math" ]
45ac482a6b95f44a26b7363e6756c8d1
The first line contains two integers n and m (1 ≀ n, m ≀ 1000) β€” the sizes of the parking lot. Each of the next n lines contains m integers: the j-th number in the i-th line describes the "rarity" cij (0 ≀ cij ≀ 100000) of the car that is located in the square with coordinates (i, j).
1,800
In the first line print the minimum total time Yura needs to guess all offered cars. In the second line print two numbers li and lj (0 ≀ li ≀ n, 0 ≀ lj ≀ m) β€” the numbers of dividing lines that form a junction that Yura should choose to stand on at the beginning of the game show. If there are multiple optimal starting ...
standard output
PASSED
0e9ba386cee915307e3b208f4fa359af
train_003.jsonl
1340983800
A widely known among some people Belarusian sport programmer Yura possesses lots of information about cars. That is why he has been invited to participate in a game show called "Guess That Car!".The game show takes place on a giant parking lot, which is 4n meters long from north to south and 4m meters wide from west to...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class B { public static void main(String[] args) { MScanner sc = new MScanner(); PrintWriter out = new PrintWriter(System.out); int H = sc.nextInt(); i...
Java
["2 3\n3 4 5\n3 9 1", "3 4\n1 0 0 0\n0 0 3 0\n0 0 5 5"]
2 seconds
["392\n1 1", "240\n2 3"]
NoteIn the first test case the total time of guessing all cars is equal to 3Β·8 + 3Β·8 + 4Β·8 + 9Β·8 + 5Β·40 + 1Β·40 = 392.The coordinate system of the field:
Java 7
standard input
[ "dp", "math" ]
45ac482a6b95f44a26b7363e6756c8d1
The first line contains two integers n and m (1 ≀ n, m ≀ 1000) β€” the sizes of the parking lot. Each of the next n lines contains m integers: the j-th number in the i-th line describes the "rarity" cij (0 ≀ cij ≀ 100000) of the car that is located in the square with coordinates (i, j).
1,800
In the first line print the minimum total time Yura needs to guess all offered cars. In the second line print two numbers li and lj (0 ≀ li ≀ n, 0 ≀ lj ≀ m) β€” the numbers of dividing lines that form a junction that Yura should choose to stand on at the beginning of the game show. If there are multiple optimal starting ...
standard output
PASSED
127edf279bc430013813a33919861c89
train_003.jsonl
1340983800
A widely known among some people Belarusian sport programmer Lesha decided to make some money to buy a one square meter larger flat. To do this, he wants to make and carry out a Super Rated Match (SRM) on the site Torcoder.com. But there's a problem β€” a severe torcoder coordinator Ivan does not accept any Lesha's probl...
256 megabytes
// practice with kaiboy import java.io.*; import java.util.*; public class CF202B extends PrintWriter { CF202B() { super(System.out, true); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF202B o = new CF202B(); o.main(); o.flush(); } String[] tt; int[] ii; int n; String[][] ss; ...
Java
["4\nfind the next palindrome\n1\n10 find the previous palindrome or print better luck next time", "3\nadd two numbers\n3\n1 add\n2 two two\n3 numbers numbers numbers", "4\nthese papers are formulas\n3\n6 what are these formulas and papers\n5 papers are driving me crazy\n4 crazy into the night", "3\nadd two decimals\n5...
5 seconds
["1\n[:||||||:]", "Brand new problem!", "1\n[:||||:]", "3\n[:|||:]"]
NoteLet us remind you that the number of inversions is the number of pairs of words that follow in the permutation not in their original order. Thus, for example, if the original problem is "add two numbers", then permutation "numbers add two" contains two inversions β€” pairs of words "numbers" and "add", "numbers" and ...
Java 11
standard input
[ "brute force" ]
18f44ab990ef841c947e2da831321845
The first line contains a single integer n (1 ≀ n ≀ 15) β€” the number of words in Lesha's problem. The second line contains n space-separated words β€” the short description of the problem. The third line contains a single integer m (1 ≀ m ≀ 10) β€” the number of problems in the Torcoder.com archive. Next m lines contain th...
1,700
If Lesha's problem is brand new, print string "Brand new problem!" (without quotes). Otherwise, on the first line print the index of the archive problem which resembles Lesha's problem most. If there are multiple such problems, print the one with the smallest index. On the second line print a string consisting of char...
standard output