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
5dce424e2763c3d7f8d2308a406f918d
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) throws IOException { FastScanner f = new FastScanner(); PrintWriter w = new PrintWriter(System.out); int T = f.nextInt(); ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
ccf6d1f2028bee2e54d218b3d3d53dd1
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; public class D { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
4954366057861dee5e0d90e3b05cc7f2
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java....
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
f4282606bf6da403fb2bd314e2e56db6
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; public class Main { static boolean isfile = false; static final String FileName = "input"; static PrintWriter out = new PrintWriter(System.out); static FastReader fr = new FastReader(); static int OO = (int) 1e9; public static void main(String[] args) throws Fil...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
1af8b9dd4b888c7555e56beaaaf18170
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { FastScanner sc = new FastScanner(); int t = sc.nextInt(); while(t-- > 0){ int n = sc.nextInt(); long[] a = new long[n]; long[] b = new long[n]; for(int i ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
2596ce3cb4ebd0fdde4ab10830838d94
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.PriorityQueue; import java.util.StringTokenizer; public class D_Friends_and_the_Restaurant { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new In...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
1c67aed9fbe721cd293706ab7b5701ed
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; import java.util.StringTokenizer; public class Friends_and_the_Restaurant { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; pub...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
c50c49bda84cb140e14f8859cc10cfef
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; import java.io.*; public class FriendsAndTheRestaurant { public static void main(String[] args)throws Exception{ FastReader f=new FastReader(System.in); int t=f.nextInt(); while (t-->0){ int n=f.nextInt(); int[] x=new int[n]; node[] arr...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
2a7e936f86e19a117a9113a76bb18049
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) { FastScanner input = new FastScanner(); int tc = input.nextInt(); work: while (t...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
02c11a8f13c5ea87b2f71f22d547c6e1
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; import java.io.*; public class codechef { public static void main(String args[]) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); PrintWriter out=new PrintWriter(System.out); Scanner sc=new Scanner(System.in); int t=sc.next...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
6e1c7b3d7ff3ec4cc89426efb13a71f9
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.util.HashSet; import java.util.TreeSet; import java.util.HashMap; import java.util.Queue; import java.util.ArrayList; import java.util.List;...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
292ec4cd76146ebaa1c0974a1873d33b
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; public class code { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int t= sc.nextInt(); while(t-->0){ solve(); } } static void solve() { int n=sc.nextInt(); int[] a=new ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
f5d02fe2aa8366c4997cb140cf7f57e8
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedReader; import java.io.PrintWriter; import java.lang.*; import java.io.IOException; import java.io.InputStreamReader; import java.net.SocketOption; import java.security.spec.RSAOtherPrimeInfo; import java.util.*; public class SEC { static long mod = (long) (1e9 + 7); static cl...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
940e7dbadd38b57e183f5ecd44c48bc2
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; import javax.print.attribute.IntegerSyntax; public class ProblemA { // Fast Reader Class public static class FastReader { // Reader object BufferedReader reader; // Constructor public FastReader(){ // Initialize the reader reader = new BufferedRe...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
5511fa0e246dbc3a16f6569ca36a863a
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class friends_rest { public static void main(String [] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t != 0) { int n=sc.nextInt(); int []arrx=new int[n]; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
82d3ab68748ca9aa58445152f74875a2
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.List; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
d7d1506824ed65707e43c68f707ff626
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; public class FriendsandtheRestaurant { static class Pair implements Comparable<Pair> { int a,b; double c; Pair(int a,int b,double c) { this.a=a; this.b=b; this.c=c; } public int compareTo(Pair o) { double ans=this.c-o.c; if(ans<0) { return -1; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
40d2a05f9d9263c11f3db6383db9f893
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class D { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while (t-- > 0) { int n = in.nextInt(); in.nextLine(); ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
0ea8c12ce06417c5e4a833f388f1e022
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import javax.print.attribute.IntegerSyntax; import java.io.*; import java.util.*; public class Main { private static final int VOID = 0; private static void solve(int n, int[] a, int[] b){ PriorityQueue<Integer> pos = new PriorityQueue<>((x,y)->(y-x)); PriorityQueue<Integer> neg = n...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
58222351f1021ee441c8f5a5e7bcb6be
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.TreeMap; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
3778eea2d12b222210f3717f89932b5e
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class class1 { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scan...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
88d442ca2b741243db6475390ce8e0f7
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
//package Codeforces; import java.io.*; import java.util.*; public class D { public static void main (String[] Z) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder op = new StringBuilder(); StringTokenizer stz; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
e225518030545067429018dc4e5f312a
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; import java.io.*; public class codeforces1729D { public static void main(String[] args) throws Exception { FastScanner in = new FastScanner(); PrintWriter pw = new PrintWriter(System.out); int numCases = in.nextInt(); while (numCases-->0) { ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
a48c1b7aa536e8100a982843c953449a
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.*; import javax.swing.plaf.basic.BasicInternalFrameTitlePane.RestoreAction; /* */ public class Codeforces {...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
0786b68fd515ca1194b81f5132e48a35
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.Arrays; public class MainA { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); while (t-- > 0) { int n = Intege...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
589477dd0a4a55d8f9e1fec4cc8e9579
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; import java.util.Map.Entry; import javax.swing.text.StyledEditorKit.BoldAction; import java.io.*; import java.lang.*; public class main1{ FastScanner in; PrintWriter out; public static void main(String[] arg) { new main1().run(); } ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
a09351df5fffffc21e92df238ab784fb
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; /* */ public class D{ static FastReader sc=null; public static void main(String[] args) { sc=new FastReader(); int t=sc.nextInt(); for(int tt=0;tt<t;tt++) { int n=sc.nextInt(); Pair p[]=new Pair[n]; int a[]=sc.readArray(n),b[]=sc....
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
e20ee5afe471d4228306bcf6ed4a0945
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
// 48 to 57 import java.util.*; public class D1729 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int tt=0;tt<t;tt++) { int n = sc.nextInt(); long x[] = new long[n]; long y[] = new long[n]; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
2bed9bcfe85355f37235191156282736
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.Scanner; import java.util.List; import java.util.ArrayList; import java.util.Collections; public class MyClass { static Scanner in = new Scanner(System.in); static int testCases, n; static char s[]; static long a, b, c, mod = 998244353L; static long x...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
ab46f2f56d8fa5279b5c1fb6b42cc74b
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; import java.io.*; public class friends_and_restaurants { public static void main(String[]args){ Kattio io = new Kattio(); int t = io.nextInt(); for(int i = 0; i < t; i++) { int n = io.nextInt(); int[]arr1 = new int[n]; for(int j = 0; j < n; j++) { arr1[j] = io.nextInt(); } ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
a5c6966931464671f54906e6465eca49
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; /** * @author Nervose.Wu * @date 2022/10/3 12:27 */ public final class S820D { ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
1fbf64d37e6a12795ff7e41c8b0ed5eb
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
//created by Toufique on 19/09/2022 import java.io.*; import java.util.*; public class Div3_820D { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int t = in.nextInt(); for (int tt = 0; tt < t; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
3e5704055cde87b4f33fe24a82cb675a
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Sol { static Scanner rd = new Scanner(System.in); public static void main(String[] args) { int tt = rd.nextInt(); while (tt-- > 0) { new Solution().solve(); } } static class Solution { ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
c8548090c031c5de7c36737193904f8b
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int testCases=sc.nextInt(); for(int i=1;i<=testCases;i++){ int n=sc.nextInt(); int []cost= new int[n]; int []budget= new int[...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
2792be81de1bd8dc3350ae5a3c3bd312
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.Arrays; public class Main{ public static void main(String[] args) throws IOException { //输入 StreamTokenizer re = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); re.nextToken(); int t = (int)re.nval; while(t-- >...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
748fc5412c9671033144ea96794dcc27
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class C1729 { public static void main(String args[]){ Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while(t-->0){ int n = scanner.nextInt(); int arr[] = new int[n]; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
433b0f2de5693855485b9aeae7e93ca5
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class Main { static FastScanner fs; public static void main(String[] args) { fs=new FastScanner(); int t=fs.nextInt(); for( int i =0;i<t;i++){ solve(); } } public stat...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
2c36e46a420995a81593421f07634536
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
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.StringTokenizer; public class Main { public static void main(String[] args) throws NumberFormatException, IOException ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
1de6ca9be9ad9428d1c16815d089eb3f
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
//package codeforces; import java.util.*; import java.io.*; public class Restaurant { public static void main(String[] args) { try { FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); int testcases = in.nextInt(); while (testcases-- > 0) { int n = in.nextIn...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
70fbc8e7d6a3c810ff54778d3bcd6748
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; public class Test { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); int t = in.nextInt(); for(int ii = 0; ii < t; ii++) { int n = in.nextInt(); int[] a = new int[n]; for(int i =...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
f9c81d93e263912338836a64ded23b83
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedInputStream; import java.io.BufferedWriter; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class D { static PrintWriter out=new PrintWriter(new BufferedW...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
2f53cda21ae0d6def96890b92a09fd0b
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; public class c1729 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t,j,i,n,l,r,c; long a[],b[]; t=sc.nextInt(); for(j=1;j<=t;j++){ n=sc.nextInt(); a=new long[n]; b=new long[n];...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
86d62b389e438ac40d4c22aa819a81e3
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { static int getMaxDays(int[] spends, int[] budgets) { int[] remainings = new int[spends.length]; for(int i = 0; i < spends.length; i++) { remainings[i] = budgets[i] - spends[i]; } Arrays.sort(remainings); int ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
ed4d7c2943111f08fb7685ed43750db4
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Codechef { public static void main (String[] args) throws java.lang.Exception { try{ FastReader read=new FastReader(); StringBuilder sb = new StringBuilder(); int t=read.nextInt(); for(int k=1;k<=t;k+...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
36122d8809900fd88ded0db04535b45f
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class a { public static void main(String[] args) { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
3651f5adddd7204c8ea881441d9fe612
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; public class D { static class Friend implements Comparable<Friend> { long moneyNeeded; long moneyHas; long difference; public Friend(long moneyNeeded, long moneyHas) { this.moneyNeeded = moneyNeeded; this.moneyHas = moneyHas; this.difference = m...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
a4cd64ae3816c6fa8f6b40f57286b843
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0) { int n = sc.nextInt(); int[] x = new int[n]; for(int i = 0...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
72ad4f0d3b07430d36a8fb3aa32e0c08
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class Main { public static void main(String[] args) throws IOException { //Scanner in = new Scanner(new File("input.txt")); //PrintWriter out = new PrintWriter("output.txt"); ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
85a06d870a7ff10a3f7339d79f5d9198
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; public class Solution { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while(t-->0) { int n = scan.nextInt(); int x[] = new int[n]; for(int i=0; i<n; i++) { x[i] = scan.nextInt(); } for(int i=0; i<n; i++)...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
4e7ced6503995a702847ed1340b9722f
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class D1729 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); for (int t=0; t<T; t++) { int N = in.nextInt(); Integer[] diff = new Integer[N]; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
4f52f88be263b56b94566cfa72f012ca
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
// package faltu; import java.util.*; import java.util.Map.Entry; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWrit...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
4019589e3092d9d0f73a97e37ac322ad
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Prior...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
2663ba0f0139fef5116c07b46b1fceaf
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.Scanner; public class D_Friends_and_the_Restaurant { static Scanner in = new Scanner(System.in); static int testCases, n; static long x[], y[]; static void solve() { Solve a[] = new Solve[n]; for(int i = 0; i < n; ++i) { a[i] = new Solve(x[i], y[i]); ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
c1507aa5ddc4453143fb74e19375a460
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class Solution { static PrintWriter pw; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
371b5156251c4b1e046e5147cbbf7f82
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
/* Author:-crazy_coder- */ import java.io.*; import java.util.*; public class cp{ static int ans=0; static BufferedReader br=new BufferedReader (new InputStreamReader(System.in)); static PrintWriter pw=new PrintWriter(System.out); public static v...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
16458a893d871ee4d6dbb6016611c458
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Sp...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
65a7820b806b55df66243c22d089e134
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static Scanner sc = new Scanner(System.in); static StringBuilder out = new StringBuilder(); static String testCase = "Case #"; static long mod = 998244353; public static void main(String[] args) throws IOException { // TODO Auto-gene...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
d653b6bd4725a5c7b2c4a09991fe5c66
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; import java.io.*; public class practice { public static void solve() { Reader sc = new Reader(); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); while(t-- > 0) { int n = sc.nextInt(); int[] x = new int[n]; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
62dc70c6d644455f383b60fdef90ac82
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
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.Random; import java.util.StringTokenizer; public class D { public static void mai...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
be816af405c6bdcd3d5ee188d06c9754
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; import java.io.*; public class Solution { public static void solve(InputReader in, PrintWriter out) { int t = in.nextInt(); while (t-- > 0) { int n = in.nextInt(); int x[] = new int[n]; int y[] = new int[n]; for (int i = ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
aed272c886b920e21264089c48d5e32d
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class FriendsAndTheRestaurant { public static void main(String[] args) { InputReader ir = new InputReader(System.in); StringBuilder sb = new S...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
339dc0c058a79c022a98eb2c5abaa873
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; public class div_3_815_a { public static void main(String args[]){ FScanner in = new FScanner(); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); while(t-->0) { int n=in.nextInt(); int a[]=in.readArray(n); int b...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
1cbdf7a9df83095c091cf4ea5a17f039
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new Pri...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
8d45b1a05c859fd6746eec49712eba14
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class D_1729 { public static void main(String[] args) { FastReader sc = new FastReader(); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int[] a=new int[n]; int[] b=new int[n]; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
00dbe04fca738a229d06c59053ebb2cb
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; import javax.print.attribute.standard.NumberUpSupported; /* ********* 1e9 ********* */ public class Solution { int mod = (int) 1e9; static int mod7 = ((in...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
353f38599742cd53a3c3791facce2d30
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import static java.lang.System.out; import java.util.*; import java.io.*; import java.lang.Math; public class cp{ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); }...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
7db6b819bed49b4e4cfcbd356fe0f61f
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; public class Mridul6 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int y = 0; while(y != t) { y = y + 1; int n = sc.nextInt(); int[] arr1 = new int[n]; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
098d1bd0f10a053df9e24abd692daaf7
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.util.concurrent.ConcurrentHashMap; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { static final int INF=Integer.MAX_VALUE; static final long LINF=Long.MAX_VALUE; static FastReader...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
5654325c1d033997bdba35007a66bcc6
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Scanner sc = new Scanner(System.in); int t = sc.nextInt() ; while(t-->0) { int n = sc.nextInt() ; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
0ff8f95ba801fec2f406e6d99c55e764
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Solution { private FastReader reader; private StringBuilder sb; private static final int TEN_POW_FIVE = (int)1e5; private static final int MOD = (int)1e9+7; public Solution() { this.reader ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
bec5cf91733cfa81490e4e491c255c12
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.lang.*; import java.time.*; import java.io.InputStreamReader; import static java.lang.Math.*; import static java.lang.System.out; import java.util.*; import java.io.File; import java.io.PrintStream; import java.io.PrintWriter; import java...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
66e0af43b14481e24da826acc2a2abfb
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; public class Main { static PrintWriter out = new PrintWriter(System.out); static Scanner in = new Scanner(System.in); static BufferedReader re = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter wr = new BufferedWriter(new Out...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
98d618909bace458727e83c8bbb2a6fd
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(Syst...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
c94477256dd4875744d4905c54c839a5
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; import java.io.PrintWriter; public class D { public static void solve(Scanner sc) { PrintWriter writer = new PrintWriter(System.out); int n = sc.nextInt(); int[] arr = new int[n]; int[] arr1 = new int[n]; int[] diff = new int[n]; for(int i = 0; i < n; i++) { arr[i] = sc.nextInt(); ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
a5da62dd867c5ccea1dbf7273adfa4ba
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; public class cp { static PrintWriter w = new PrintWriter(System.out); static FastScanner s = new FastScanner(); static int mod = 1000000007; static class Edge { int src; int wt; int nbr; Edge(int src, int nbr, in...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
3d11f683c4856022ae45e0f12d2b3a73
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.PriorityQueue; import java.util.Stri...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
e5d096cd311484ad5ee15fff0f61792b
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; public class Main{ static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int t = sc.nextInt(); while (t -- > 0){ int n = sc.nextInt(); long[] a = new long[n]; for (int i = 0; i < n; i++) { ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
e4bce108f08226ec417493ecc38f2ad1
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Problem4 { static class Reader { static BufferedReader reader; static StringTokenizer tokenizer; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
72da9990d6f7ae4b798e66d3505d5354
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; public class Abai { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); int[] x = new int[n]; for (int i = 0; i < n; i++) { ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
87a2279804f751a98075c7dbd1a0c591
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); for(int t = 0; t < k; t++){ int n = sc.nextInt(); int[][] arr = new int[n][2]; int[] money = new int[n]; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
d228afc2966e15d9944d4f767d66ce1f
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.* ; public class Main { public static void reverse(int[] arr){ int i = 0 ; int j= arr.length-1 ; while(i < j){ int temp = arr[i] ; arr[i] = arr[j] ; arr[j] = temp ; i++ ; j-- ; } } publi...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
8627957d32b539f85a45b3d07e20eff7
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; public class text1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int cs = sc.nextInt(); for(int dz = 0;dz < cs;dz ++){ int length = sc.nextInt(); long[] want = new long[length]; int zero = 0; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
16d8b859141c9fe423856ea96b41b23d
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader br; static long cnt=0; static int mod=998244353; //static ArrayList<ArrayList<Integer>> arr=new ArrayList<>(); static StringBuilder ans=new StringBuilder(""); public static void main(String args[]) throws IOException { // ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
b79e32644a8b479bbd87b85b4a1abe5b
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.Scanner; import java.util.*; public class MyClass { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); while(tc-- > 0){ int n = sc.nextInt(); long[] a = new long[n]; long[...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
7333a81768c6ed4286ae0dcafae65d65
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.text.*; public class Main{ public static void main(String args[]) throws IOException{ Read sc=new Read(); int n=sc.nextInt(); for(int i=0;i<n;i++){ int t=sc.nextInt(); long a[]=new long[t]...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
8155357b39344a5bdb31a005bbb44641
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.PriorityQueue; import java.util.StringTokenizer; public class D { private static Scan sc = new Scan(); public static void main(String[] args) { int n = sc.nextInt(); for (int i = 0; i <...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
9336195cd199b2e3c1700f54f24d4ae9
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; public class Main { static Scanner in = new Scanner(System.in); static int numOfGroups(int arr[]){ int pair = 0; int l=0; int r=arr.length-1; while (true){ while(l<r && arr[l]+arr[r]<0){ l++; } ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
1ee9bbdd1b68d9d732725a20163d0cb8
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; import java.io.*; public class Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static int tcs, n; static StringTokenizer st; static int[] xs = new int[100005]; static int[] ys = new int[100005]; static int[] arr = new int[100005]; stati...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
9dbb49824c24a8b0713410e6e6f5554f
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { // static int[] prime = new int[100001]; final static long mod = 1000000007; public static void main...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
15f360d6c8c399c91d08fe6e6be8219a
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Rextester { public static void main(String args[]) { Scanner in = new Scanner(System.in); int t = in.nextInt(); ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
236f455d0580a583b751f2f76f6ee022
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; public class test { static class Obj{ int bud; int exp; int diff; Obj(int bud, int exp, int diff){ this.bud = bud; this.exp = exp; this.diff = diff; } } public static void main(String[] args) { ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
20596f5481faadd6a231beecd98df64c
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.PriorityQueue; import java.util.Set; i...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
2da4e9630cdc48ccedb68442ab035162
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; import java.io.*; public class FriendsAndTheRestaurant { static FastReader in = new FastReader(); static int npos; //number of nonnegative yi-xis; static int nneg; //number of negative yi-xis static int[] pos; //array for nonnegative yi-xis; static int[] neg; //array for negat...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
751a848371f616ffc6bdad3291afc563
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
bd660faa89d280d0653f275a899a64f0
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; import java.util.spi.AbstractResourceBundleProvider; public class codeforces { class Pair<I extends Number, I1 extends Number> { int x; int y; public Pair(int x, int y) { this.x = x; this.y = y; } } public st...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
894c908b7dfc8ca6a5da25621831bdd5
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.Arrays; import java.util.HashMap; import java.util.Scanner; public class PermutationOperation { public static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int cases = sc.nextInt(); for(int i = 0; i<cases;i++){ int n = sc.nex...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
5c39934944f0c42bf5b84d2a6cb4a1d7
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; import java.util.concurrent.atomic.LongAdder; import java.lang.*; import java.math.BigInteger; import java.io.*; public class Solution { static int sieve[]; public static void sieve_initilize(int n) { sieve = new int[n+1]; sieve[2] = 1; for(int i = 0;i<sieve.length;i++)...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
97a7ad4d43a815e85164a06d8a53671c
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class A1{ static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out)); static StringTokenizer st; static final long mod=1000000007; ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
00a6ed74fc2e9ce80a87d645f775d23e
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int t = sc.nextInt(); while(t-->0){ int i,n = sc.nextInt(); ...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output
PASSED
83127f9d7ebdee3ba73ae7324f5c625b
train_110.jsonl
1662993300
A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaura...
256 megabytes
// package cf1729.d; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class D { static class Friend implements Comparable<Friend> { int x, y; @Override public int compareTo(Friend o) { return (this.y - this.x) - (o.y - o.x); } public String toStrin...
Java
["6\n\n6\n\n8 3 9 2 4 5\n\n5 3 1 4 5 10\n\n4\n\n1 2 3 4\n\n1 1 2 2\n\n3\n\n2 3 7\n\n1 3 10\n\n6\n\n2 3 6 9 5 7\n\n3 2 7 10 6 10\n\n6\n\n5 4 2 1 8 100\n\n1 1 1 1 1 200\n\n6\n\n1 4 1 2 4 2\n\n1 3 3 2 3 4"]
2 seconds
["2\n0\n1\n3\n1\n3"]
NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option ...
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
7c8884b72dcc3c51e0696eec8d6aa8ef
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case conta...
1,200
For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.
standard output