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
e9d2f1d6415354918ff6a93a89ff7b9d
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; /** * @author pvasilyev * @since 30 Mar 2017 */ public class A277 { public static void main(String[] args) throws IOException { final Scanner reader = new Scanner(new InputStreamReader(System....
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
894dcafacd2d3b04abd7fd6f8a43205a
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; import java.util.TreeSet; public class Learning_Languages { static boolean vis[]; static ArrayList<Integer> [] adj; public static void dfs(int x) { vis[x]=true; for(int y:adj[x]) { if(!vis[y]) { dfs(y); } } } public static void main(Stri...
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
d5acf529b5001f1f8c15223548e7e987
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
a287b6a677d432c0c15196b61be740e5
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.File; import java.io.FileNotFoundException; import java.util.StringTokenizer; import java.io.Writer; ...
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
c7d6acda3741d588b88467e777e4de84
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.File; import java.io.FileNotFoundException; import java.util.StringTokenizer; import java.io.Writer; ...
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
c9da6b5e312cb2776c926931a9bcb645
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.StringTokeni...
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
455bb2366f0cb4985a16f4328fc0e3c0
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.File; import java.io.FileNotFoundException; import java.util.StringTokenizer; import java.io.Writer; ...
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
603ee0c711c6e92e23ef881d9ce785c7
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
import java.util.* ; import java.io.*; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter pr = new PrintWriter(System.out); int n = sc.nextInt(); int m = sc.nextInt(); HashSet<Integer> [] adjSet = new HashSet[n]; ...
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
b80d981c37d94b0340e5e984ff85492c
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
import java.util.* ; import java.io.*; /** * @author mostafa */ public class A { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pr = new PrintWriter(System.out); StringTokenizer st = new...
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
2623395150249a5b2b00b880f8400e2c
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; // public class LearningLanguages { int[] parents; public static void main(String[] args) { Scanner input = new Scanner(System.in); LearningLanguages obj = new LearningLanguages(); int n = input.nextInt(); int m = input.nextInt(); obj.parents = new int...
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
541565a8dd732c564315d5edc40ae95a
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class LearningLanguages { int[] parents; public static void main(String[] args) { Scanner input = new Scanner(System.in); LearningLanguages obj = new LearningLanguages(); int n = input.nextInt(); int m = input.nextInt(); obj.parents = new int[m ...
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
4f56ce8305c9f97b22a1505e0f3f4edc
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class LearningLanguages { int[] parents; public static void main(String[] args) { Scanner input = new Scanner(System.in); LearningLanguages obj = new LearningLanguages(); int n = input.nextInt(); int m = input.nextInt(); obj.parents = new int[m ...
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
b7119e92f19415b95b1d57e3224f63b7
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
import java.io.*; import java.util.*; public class LearningLanguages { static int n, m; static int[] parent; static int find(int x) { return (x == parent[x] ? (x) : (parent[x] = find(parent[x]))); } static void union(int a, int b) { int p1 = find(a); int p2 = find(b); if(p1 != p2) { parent[p1] = p2; }...
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
b7b4739be163fa30607c5e7d4770f42b
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.StringTokenizer; import java.util.TreeMap; public class Test1 { static ArrayList<Integer>[] adjList; ...
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
b82fb9e6c44cb67454425a15dc39dbea
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
import java.io.*; import java.util.*; public class test1 { static ArrayList<Integer>[] d; static int []M; static boolean[]vis; public static void main(String[] args) throws IOException, InterruptedException { Scanner sc=new Scanner (System.in); int n=sc.nextInt(); int m=sc.nextInt(); vis=new boolean[n]; M=new ...
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
a4e7eda69c900e8ab412e0d1b44eed91
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
import java.util.*; public final class Test1 { public static void dfs(int graph[][],int start,int n,boolean visited[]){ visited[start]=true; for(int i=0;i<n;i++){ if(graph[start][i]==1 && !visited[i]){ dfs(graph,i,n,visited); } } } public st...
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
e15b163be1c043809ed6ffefe18fba9e
train_000.jsonl
1362065400
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official language...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author dipankar12 */ import java.io.*; import java.util.*; public class r277a { public static void main(String args[])...
Java
["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0"]
2 seconds
["0", "2", "1"]
NoteIn the second sample the employee 1 can learn language 2, and employee 8 can learn language 4.In the third sample employee 2 must learn language 2.
Java 8
standard input
[ "dsu", "dfs and similar" ]
e2836276aee2459979b232e5b29e6d57
The first line contains two integers n and m (2 ≤ n, m ≤ 100) — the number of employees and the number of languages. Then n lines follow — each employee's language list. At the beginning of the i-th line is integer ki (0 ≤ ki ≤ m) — the number of languages the i-th employee knows. Next, the i-th line contains ki intege...
1,400
Print a single integer — the minimum amount of money to pay so that in the end every employee could write a letter to every other one (other employees can help out translating).
standard output
PASSED
af08f6067868eb5cdb6b5c646b154ed9
train_000.jsonl
1459182900
Limak is a big polar bear. He prepared n problems for an algorithmic contest. The i-th problem has initial score pi. Also, testers said that it takes ti minutes to solve the i-th problem. Problems aren't necessarily sorted by difficulty and maybe harder problems have smaller initial score but it's too late to change it...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; /** * @author Pavel Mavrin */ public class D { private static final double EPS = 1e-9; private voi...
Java
["3\n4 3 10\n1 1 8", "4\n7 20 15 10\n7 20 15 10", "2\n10 20\n10 1"]
3.5 seconds
["0.62500000000", "0.31901840491", "1.00000000000"]
NoteIn the first sample, there are 3 problems. The first is (4, 1) (initial score is 4 and required time is 1 minute), the second problem is (3, 1) and the third one is (10, 8). The total time is T = 1 + 1 + 8 = 10.Let's show that there is a paradox for c = 0.7. Solving problems in order 1, 2, 3 turns out to give the b...
Java 8
standard input
[ "binary search", "sortings", "math" ]
2dfeceace9a820a2e68ca2b8fe69b7cb
The first line contains one integer n (2 ≤ n ≤ 150 000) — the number of problems. The second line contains n integers p1, p2, ..., pn (1 ≤ pi ≤ 108) — initial scores. The third line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 108) where ti is the number of minutes needed to solve the i-th problem.
2,800
Print one real value on a single line — the maximum value of c that and there is no optimal order with a paradox. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consid...
standard output
PASSED
87aa99d17b01d3297c55638b655b3b9d
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); scanner.nextLine(); while (t-- > 0) { int n = scanner.nextInt(); int lMax = 0; int rMi...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
d9dbe026f5244ec6061d2bf1bbc17a60
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int tc = 0; tc < t; tc++) { int n = sc.nextInt(); int[] l = new int[n]; int[] r = new int[n]; for (int i = 0; i < n; i++) {...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
fdce72ed40c307d52ff5af9ef1bb74ca
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class c1 { public static MyScanner scan; public static PrintWriter out; public static void main(String[] args) { scan=new MyScanner(); out=new PrintWriter(new BufferedOutputStream(System.out)); // int t=1; int ...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
28a785ce2d36788b592f7fc0c1a82d8a
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; public class Kotlin { public static void main(String[] args) throws IOException { ...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
9eeef3f9050489a058093943a79363ac
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.util.Scanner; public class Main { final static int N=(int)(1e5+10); static int t; static String s; static int[] a=new int[N]; static int[] b=new int[N]; public static void main(String[] args) { Scanner sc=new Scanner(System.in); t=sc.nextInt(); for(int i =0;i<t;i++) { int n=sc.nextInt(); ...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
1f1ee857eb255bad859b74aec252d9a8
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.io.PrintWriter; import java.util.Scanner; public class MathProblem { static Scanner sc = new Scanner(System.in); static PrintWriter pw = new PrintWriter(System.out); public static void main(String args[]) { int t = sc.nextInt(); while (t-- > 0) { solve(); } ...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
2c52dded8b5d8d7995342954345c548c
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; /** * Created by Ринат on 26.09.2018. */ public class B { public static void main(String[] args) throws IOException { Scanner in = new Scanner(new BufferedInputSt...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
a29e6cc71d394d0ea6e1b5b01c74c05a
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.util.*; import java.io.*; public final class Codechef { 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 = 0; int y = Integer.MAX_VALUE; ...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
fe6e170d68617ac6cf786cc1df99e90a
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.util.Scanner; public class Jonny { static Scanner in=new Scanner(System.in); public static void main(String args[]){ int t=in.nextInt(); for(int i=0;i<t;i++) { int n=in.nextInt(); int[][] a=new int[n][2]; for(int j=0;j<n;j++) for(int k=0;k<2;k++)a[j][k]=in.nextInt(); //Arrays.sort(a, Comparat...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
66c9d4ad2947b5f4dab521996b500cd7
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.awt.event.MouseAdapter; 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 Exception { new Main().run(); } int p = 0,l; char a[]; long readLong(){ ...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
a11b2748328c517bfce0c37dd694336a
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.util.Scanner; /** * * @author Hp */ public class JavaApplication141 { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner in = new Scanner(System.in); int t= in.nextInt(); while(t-->...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
4a4580310411a0f14a39bd7513ae12a8
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.io.*; import java.util.*; public class __Solution { static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; public static void main(String[] args) { new __Solution().run(); } BufferedReader in; PrintWriter out; StringTokenizer tok; void init...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
dac89892505fe96424cb3bb039207a4b
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.util.*; import java.lang.*; import java.math.*; import java.text.*; import java.io.*; public final class Solution { static PrintWriter out = new PrintWriter(System.out); static void flush() { out.flush(); } static class FastReader { BufferedReader br; StringTokenizer st; publ...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
cd51e5836244c8a863fbf3f3654b6667
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.io.*; import java.util.*; public class Solver { static ArrayList<Integer> graph[]; static boolean used[]; static int mt[]; static boolean prime[]; public static void main(String[] args) throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); Prin...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
b30e6edd17a094749354d96b9f169d7c
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.io.*; import java.util.*; public class Main { String fileName = ""; public void solve() throws IOException { // code here int n = nextInt(); int ansA = Integer.MIN_VALUE; int ansB = Integer.MAX_VALUE; for (int i = 0; i < n; i++) { int a = nextInt...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
7d09d0b70ecd4410e6b4d3560902367d
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
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 { BufferedReader bf = new BufferedReader(...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
e72b48c63bc5ab816c03be663d6983f9
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.PriorityQueue; import java.util.Queue; import java.util.Scanner; ...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
a5534dc35b6f21a49378d494cd3cb3f5
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
//package code_; import java.io.*; import java.util.*; public class A_ { public static void main(String[] args) { Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); for (int i = 0; i <...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
a56ff2d5ba1635610dc2adf375c5f652
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
//package main; import java.io.*; import java.util.*; public final class Main { BufferedReader br; StringTokenizer stk; public static void main(String[] args) throws Exception { new Main().run(); } { stk = null; br = new BufferedReader(new InputStreamReader(System.in)...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
cf4543474703d0c2d8dc6ffe7ffc27bd
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for(int j = 0;j<t;j++) { int n = in.nextInt(); int l[] = new int[n]; int r[] = new int[n]; int minR ...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
8b87eb25bf204af2dbb7b11966491069
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args){ InputReader in = new InputReader(System.in); int t = in.nextInt(); while(t-- > 0){ int n = in.nextInt(); int min = Integer.MAX_VALUE; int max = Integer.MIN_VA...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
d29a726b2f5c6c46c0f00f9dfefc74ec
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputStreamWri...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
25bce082e8cb80542d7f399eeddd33ff
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
/* MOHD SADIQ */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; import java.util.ArrayList; public class Main { private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
0993d381ba07ac59be4f12d6d81806e3
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.StringTokenizer; public class TaskA { public static String doMain(Reader reader) throws IOException { MyReader in = new MyReader(reader); int i = in.nextInt(); ...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
ef501dde67f5e5c4f1e81c1184e9e888
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer; import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t-->0){ int n=s.nextInt(); int y=Integer.MAX_VALUE; ...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
d58aa358eb00a56e556e12a8e3601d90
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.util.*; import java.io.*; import java.text.DecimalFormat; public class Exam { public static long mod = (long)Math.pow(10, 9)+7 ; public static double epsilon=0.00000000008854;//value of epsilon public static InputReader sc = new InputReader(System.in); public static PrintWriter pw = new PrintWriter(Syst...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
09db85a18244c298fdd05340b27271ac
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.PrintWriter; import java.util.TreeSet; import java.util.Collections; import java.util.Scanner; import java.util.StringTokenizer; public class taskA { public static void main(String[] args) { Scanner in = new Scanner(ne...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
a91e6f3ce19dff3f0c07ae456c6ebd94
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.io.BufferedReader; // import java.io.FileInputStream; // import java.io.FileOutputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Random; import java.util.StringTokenizer; import stati...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
f8d720926ee3cde0a366590395c09622
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
956b1e55f83efd59e3418d8a459ca102
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.util.Scanner; import java.util.*; import java.io.*; public class CodeForcesFormat { public static void main(String args[]){ Scanner input = new Scanner(System.in); int t = input.nextInt(); while(t>0){ int n = input.nextInt(); int max = 0 ; int mi...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
0cd249ac2168a96d9d4c3f52afbe8c96
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.util.Scanner; public class A1227 { 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(); int minR = Integer.MAX_VALUE; int maxL = Integer.MIN_VALUE;...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
6629c7d76c24676c2e37ee9f04787b4c
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; public class Day9 { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(Syste...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
0ccc8fd8a92f87faab067c429d5d9e31
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
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 { BufferedReader bf = new BufferedReader(...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
bcd5a6dc9b865328891827300595a4ae
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.util.*; public class CodeForces1227A{ public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); for(int i = 0;i<t;i++){ int n = input.nextInt(); int x = 0; int y = Integer.MAX_VALUE; for(int j = 0;j<n;j++){ x = Math.max(x,input.nextInt(...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
66f19e1ebeb8badec0aeb343b5262cf7
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class A { public static void main(String[] args) throws Exception { // FileInputStream inputStream = new FileInputStream("input.txt"); // FileOutputStream outputStream = new FileOutputStream("output.txt"); InputStream i...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
9ef4109e7ec41535c64cce465a334ddc
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package Practice_1100; import java.io.*; /** * * @author Akhilesh */ public class A1227 { public static void main(String[] a...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
c478ed49c13d353343ee8f863b5bcc43
train_000.jsonl
1574582700
Your math teacher gave you the following problem:There are $$$n$$$ segments on the $$$x$$$-axis, $$$[l_1; r_1], [l_2; r_2], \ldots, [l_n; r_n]$$$. The segment $$$[l; r]$$$ includes the bounds, i.e. it is a set of such $$$x$$$ that $$$l \le x \le r$$$. The length of the segment $$$[l; r]$$$ is equal to $$$r - l$$$.Two s...
256 megabytes
import java.awt.*; import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; import java.lang.String; import static java.lang.Math.*; public class Main { long mod = (long) 1e9 + 7; void run() throws IOException { int q = nextInt(); while (q-- > 0) { ...
Java
["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1"]
2 seconds
["2\n4\n0\n0"]
NoteIn the first test case of the example, we can choose the segment $$$[5;7]$$$ as the answer. It is the shortest segment that has at least one common point with all given segments.
Java 8
standard input
[ "math" ]
f8a8bda80a75ed430465605deff249ca
The first line contains integer number $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of segments. The following $$$n$$$ lines contain segment descriptions: the...
1,100
For each test case, output one integer — the smallest possible length of the segment which has at least one common point with all given segments.
standard output
PASSED
6a2b721770b4a005b57ab101f9e38780
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.util.*; import java.io.*; public class Main{ BufferedReader in; StringTokenizer str = null; PrintWriter out; private String next() throws Exception{ while(str == null || !str.hasMoreElements()) str = new StringTokenizer(in.readLine()); return str.nextToken(); } private int next...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
919ebc469f95e4863586c546aea5bca3
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class E { static StringTokenizer st; static BufferedReader in; static int...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
4897db440ba8ff2748b965469f7efa65
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.awt.geom.*; import static java.lang.Math.*; public class Solution implements Runnable { static final int MAXBIT = 45; public void solve() throws Exception { int n = sc.nextInt(); long a [] = new long [n + 2]; long b [] = new long [n + 2...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
be0249086c5e6c0cd9ebd6a55fd4c92d
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual so...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
ebf694cb10fa99f48de4ce307eac9c65
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class CF282E { public static void main(String[] args) throws Exception { new CF282E().solve(); } private void solve() throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
d96f9dd2667896c2d153108b85f19fa0
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; public class E { /** * @param args */ public static void main(String[] args) { BitSausage bs = new BitSausage(); bs.solve(); bs.print(); } } class BitSausage { BitSausage() { Scanner...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
b0969a2b9ed2f804e30cdf28f274069f
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class SausageMaxRedo { public static void main(String[] args){ FastScanner sc = new FastSc...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
e10c1bf8528f72e1e097a2a9c8873268
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class Node{ Node t1; Node t0; public Node(){ } public static void add(Node tree,long val){ Node current = tree; for(int i = 40;i >= 0;i--){ if(((1L << i) & val) != 0){ if(current.t1 == null){ current.t1 = new Node(); } curre...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
9186761345da1730a4187096d00e3a37
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class Node{ Node t1; Node t0; public Node(){ } public static void add(Node tree,long val){ Node current = tree; for(int i = 40;i >= 0;i--){ if(((1L << i) & val) != 0){ if(current.t1 == null){ current.t1 = new Node(); } curre...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
34bd92dc6081a8ba5324b67692cb5a0b
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Round173_E { class Node { Node zero, one; public Node() { zero = null; one = null; } } Node root; public void a...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
3008e1ccb8be339a7d22c6cf9fb53a9b
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.*; import java.util.*; public class Main { long X; long[] pxor; long[] s; void run() throws Exception{ int N = nextInt(); s = new long[N + 1]; for (int i = 1; i <= N; i++){ s[i] = nextLong(); } pxor = new long[N + 1]; ...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
498665763dc3a2ea799369f8f194e4de
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Sausage { static class Trie{ Trie zero; Trie one; vo...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
70dfa8e5cc1129fe0e7d95b3884bc7e4
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.util.Scanner; public class Sausage { static class Trie{ Trie zero; Trie one; void add(long n, int bit){ if (bit<0)return; boolean isOne = (n&(1L<<bit))!=0; if (isOne){ if (one==null){ one = new Trie(); } one.add(n,bit-1); } else { if (zero==null){ ...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
8ce2acdb4c7361e64fb33b655a4d6015
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Sausage { static class Trie{ Trie zero; Trie one; vo...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
9c1eafe453fd5fb31267a20d4e15ee2e
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Round_173_E { static class FastScanner { BufferedReader br; ...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
e9411c8a866199ea6016a3c1c891935c
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.*; import java.util.*; public class E { final String filename = new String("E").toLowerCase(); void solve() throws Exception { int n = nextInt(); long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = nextLong(); } long[] pref = new long[n + 1]; long[] suf = new long[n + 1]; ...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
9df51d2b4f11bff6d93e55a090eb129f
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.InputMismatchException; public class E { public static void main(String[] args) { InputReader in = new InputReader(System.in); int n = in.readInt(); long[] A = new long[n]; long pre = 0; for (int i = 0...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
f2c72f8dae71671e91bd3313c4b0febf
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.*; public class Solver { public static void main(String[] Args) throws NumberFo...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
58b6578cdd1b0cbe5652551738e9185e
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import static java.lang.Math.*; import java.util.*; import java.io.*; public class sausage { public static void main(String [] argv) { Kattio io = new Kattio(System.in, System.out); int n =io.getInt(); long [] A = new long[n]; long [] xors = new long[n+1]; for (int i=0; i<n...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
e152f523cc3ea3b056654cdbf7709735
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.BitS...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
3480df17268a1da535e723cf9ecae1ac
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Iterator; import java.util.Random; import java.util.StringTokenizer; public class CF173D2E implements CodeforcesSolve...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
de45a6f98c5dbfd6e1bc54efdb8af497
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Iterator; import java.util.StringTokenizer; public class CF173D2E implements CodeforcesSolver { // public void ...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
7506c292c7c47814187a8369e65ecca9
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Iterator; import java.util.StringTokenizer; public class CF173D2E implements CodeforcesSolver { // public void ...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
7c56938be57524f61511f9810132fef4
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class E { public static void main(String[] args) throws Exception { int cnt = nextInt(); long[] leftXor = new long[cnt + 1]; leftXor[0] = 0; long[] ar = new long[cnt]; ...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
02b6aea7707aa73e4181313dffbc0397
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.util.Scanner; // http://codeforces.com/contest/282/problem/E public class SausageMaximization { static class PrefixTreeNode { PrefixTreeNode left; PrefixTreeNode right; } static PrefixTreeNode root = new PrefixTreeNode(); static final int HIGH = 40; public static vo...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
e135d1e856675ca0d2202131b51a4526
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class Main { private static final int bits = 40; private static int nodeCnt = 1; public static void insert(TrieNode[] trie, long...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
9153c8b3076a4cba4dc804339b148ab5
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ...
256 megabytes
import java.io.*; import java.util.*; public class E { public static void main(String[] args) { try { new E().solve(); } catch (Exception e) { e.printStackTrace(); } } void solve() throws IOException { // Scanner sc = new Scanner(System.in); ...
Java
["2\n1 2", "3\n1 2 3", "2\n1000 1000"]
2 seconds
["3", "3", "1000"]
null
Java 7
standard input
[ "data structures", "bitmasks", "trees" ]
02588d1e94595cb406d92bb6e170ded6
The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
2,200
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
standard output
PASSED
7b34e1052bfc5c666fe2e74ef87e6ff6
train_000.jsonl
1381838400
In Berland, there is the national holiday coming — the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions: overall, there must be m dances; exactly three people must take part in each dance; each dance must...
256 megabytes
import java.util.Scanner; public class FlagDay { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int m = input.nextInt(); int[] dancer = new int[3]; int[] res = new int[n]; for (int i = 0; i < n; ++i) { res[i] = -1; } boolean[] visited = ...
Java
["7 3\n1 2 3\n1 4 5\n4 6 7", "9 3\n3 6 9\n2 5 8\n1 4 7", "5 2\n4 1 5\n3 1 2"]
1 second
["1 2 3 3 2 2 1", "1 1 1 2 2 2 3 3 3", "2 3 1 1 3"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
ee523bb4da5cb794e05fb62b7da8bb89
The first line contains two space-separated integers n (3 ≤ n ≤ 105) and m (1 ≤ m ≤ 105) — the number of dancers and the number of dances, correspondingly. Then m lines follow, describing the dances in the order of dancing them. The i-th line contains three distinct integers — the numbers of the dancers that take part ...
1,400
Print n space-separated integers: the i-th number must represent the color of the i-th dancer's clothes (1 for white, 2 for red, 3 for blue). If there are multiple valid solutions, print any of them. It is guaranteed that at least one solution exists.
standard output
PASSED
57e2088444918fd02aed59d10b19b68f
train_000.jsonl
1381838400
In Berland, there is the national holiday coming — the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions: overall, there must be m dances; exactly three people must take part in each dance; each dance must...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Hashtable; import java.util.LinkedList; import java.util.List; import j...
Java
["7 3\n1 2 3\n1 4 5\n4 6 7", "9 3\n3 6 9\n2 5 8\n1 4 7", "5 2\n4 1 5\n3 1 2"]
1 second
["1 2 3 3 2 2 1", "1 1 1 2 2 2 3 3 3", "2 3 1 1 3"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
ee523bb4da5cb794e05fb62b7da8bb89
The first line contains two space-separated integers n (3 ≤ n ≤ 105) and m (1 ≤ m ≤ 105) — the number of dancers and the number of dances, correspondingly. Then m lines follow, describing the dances in the order of dancing them. The i-th line contains three distinct integers — the numbers of the dancers that take part ...
1,400
Print n space-separated integers: the i-th number must represent the color of the i-th dancer's clothes (1 for white, 2 for red, 3 for blue). If there are multiple valid solutions, print any of them. It is guaranteed that at least one solution exists.
standard output
PASSED
c5dc069b242b0ee2866bbd2c3ad00c56
train_000.jsonl
1381838400
In Berland, there is the national holiday coming — the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions: overall, there must be m dances; exactly three people must take part in each dance; each dance must...
256 megabytes
import java.io.*; public class B { public static void main(String[] args) throws IOException { Parser in = new Parser(System.in); PrintStream out = new PrintStream(System.out); int n = in.nextInt(); int[] d = new int[n+1]; int m = in.nextInt(); for (int i = 0; i < m; i++) { int a = in.nextInt(); int...
Java
["7 3\n1 2 3\n1 4 5\n4 6 7", "9 3\n3 6 9\n2 5 8\n1 4 7", "5 2\n4 1 5\n3 1 2"]
1 second
["1 2 3 3 2 2 1", "1 1 1 2 2 2 3 3 3", "2 3 1 1 3"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
ee523bb4da5cb794e05fb62b7da8bb89
The first line contains two space-separated integers n (3 ≤ n ≤ 105) and m (1 ≤ m ≤ 105) — the number of dancers and the number of dances, correspondingly. Then m lines follow, describing the dances in the order of dancing them. The i-th line contains three distinct integers — the numbers of the dancers that take part ...
1,400
Print n space-separated integers: the i-th number must represent the color of the i-th dancer's clothes (1 for white, 2 for red, 3 for blue). If there are multiple valid solutions, print any of them. It is guaranteed that at least one solution exists.
standard output
PASSED
9b576d94ff43df21007893c8ef4adf93
train_000.jsonl
1381838400
In Berland, there is the national holiday coming — the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions: overall, there must be m dances; exactly three people must take part in each dance; each dance must...
256 megabytes
import static java.lang.Math.*; import static java.lang.System.currentTimeMillis; import static java.lang.System.exit; import static java.lang.System.arraycopy; import static java.util.Arrays.sort; import static java.util.Arrays.binarySearch; import static java.util.Arrays.fill; import java.util.*; import java.io.*; p...
Java
["7 3\n1 2 3\n1 4 5\n4 6 7", "9 3\n3 6 9\n2 5 8\n1 4 7", "5 2\n4 1 5\n3 1 2"]
1 second
["1 2 3 3 2 2 1", "1 1 1 2 2 2 3 3 3", "2 3 1 1 3"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
ee523bb4da5cb794e05fb62b7da8bb89
The first line contains two space-separated integers n (3 ≤ n ≤ 105) and m (1 ≤ m ≤ 105) — the number of dancers and the number of dances, correspondingly. Then m lines follow, describing the dances in the order of dancing them. The i-th line contains three distinct integers — the numbers of the dancers that take part ...
1,400
Print n space-separated integers: the i-th number must represent the color of the i-th dancer's clothes (1 for white, 2 for red, 3 for blue). If there are multiple valid solutions, print any of them. It is guaranteed that at least one solution exists.
standard output
PASSED
21199a123290e57da57e377d1e7715c7
train_000.jsonl
1381838400
In Berland, there is the national holiday coming — the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions: overall, there must be m dances; exactly three people must take part in each dance; each dance must...
256 megabytes
import java.util.Scanner; public class B { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int m = s.nextInt(); int[] c = new int[n+1]; for(int i = 0; i < m; i++) { int d1 = s.nextInt(); int d2 = s.nextInt(); int d3 = s.nextInt(); if(c[d1] != 0) { ...
Java
["7 3\n1 2 3\n1 4 5\n4 6 7", "9 3\n3 6 9\n2 5 8\n1 4 7", "5 2\n4 1 5\n3 1 2"]
1 second
["1 2 3 3 2 2 1", "1 1 1 2 2 2 3 3 3", "2 3 1 1 3"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
ee523bb4da5cb794e05fb62b7da8bb89
The first line contains two space-separated integers n (3 ≤ n ≤ 105) and m (1 ≤ m ≤ 105) — the number of dancers and the number of dances, correspondingly. Then m lines follow, describing the dances in the order of dancing them. The i-th line contains three distinct integers — the numbers of the dancers that take part ...
1,400
Print n space-separated integers: the i-th number must represent the color of the i-th dancer's clothes (1 for white, 2 for red, 3 for blue). If there are multiple valid solutions, print any of them. It is guaranteed that at least one solution exists.
standard output
PASSED
285f28bbf455afce6c7d08d8b1efce39
train_000.jsonl
1381838400
In Berland, there is the national holiday coming — the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions: overall, there must be m dances; exactly three people must take part in each dance; each dance must...
256 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ //package programminginjava; import java.io.*; import java.util.*; /** * * @author vijit */ public class jeff2 { static String[] lines; static boolean debug; public static void assignColor(...
Java
["7 3\n1 2 3\n1 4 5\n4 6 7", "9 3\n3 6 9\n2 5 8\n1 4 7", "5 2\n4 1 5\n3 1 2"]
1 second
["1 2 3 3 2 2 1", "1 1 1 2 2 2 3 3 3", "2 3 1 1 3"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
ee523bb4da5cb794e05fb62b7da8bb89
The first line contains two space-separated integers n (3 ≤ n ≤ 105) and m (1 ≤ m ≤ 105) — the number of dancers and the number of dances, correspondingly. Then m lines follow, describing the dances in the order of dancing them. The i-th line contains three distinct integers — the numbers of the dancers that take part ...
1,400
Print n space-separated integers: the i-th number must represent the color of the i-th dancer's clothes (1 for white, 2 for red, 3 for blue). If there are multiple valid solutions, print any of them. It is guaranteed that at least one solution exists.
standard output
PASSED
d83f915f13938a46ed2f472c1e5dc9f3
train_000.jsonl
1381838400
In Berland, there is the national holiday coming — the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions: overall, there must be m dances; exactly three people must take part in each dance; each dance must...
256 megabytes
//package hash13; import java.io.IOException; import java.util.Arrays; import java.util.Scanner; public class cf207b { public static void main(String args[]) throws IOException { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextInt(); int dance[]...
Java
["7 3\n1 2 3\n1 4 5\n4 6 7", "9 3\n3 6 9\n2 5 8\n1 4 7", "5 2\n4 1 5\n3 1 2"]
1 second
["1 2 3 3 2 2 1", "1 1 1 2 2 2 3 3 3", "2 3 1 1 3"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
ee523bb4da5cb794e05fb62b7da8bb89
The first line contains two space-separated integers n (3 ≤ n ≤ 105) and m (1 ≤ m ≤ 105) — the number of dancers and the number of dances, correspondingly. Then m lines follow, describing the dances in the order of dancing them. The i-th line contains three distinct integers — the numbers of the dancers that take part ...
1,400
Print n space-separated integers: the i-th number must represent the color of the i-th dancer's clothes (1 for white, 2 for red, 3 for blue). If there are multiple valid solutions, print any of them. It is guaranteed that at least one solution exists.
standard output
PASSED
ae3269524badb324853fc1a209b08e2e
train_000.jsonl
1381838400
In Berland, there is the national holiday coming — the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions: overall, there must be m dances; exactly three people must take part in each dance; each dance must...
256 megabytes
import java.io.PrintWriter; import java.util.ArrayList; import java.util.Scanner; import java.lang.*; import java.nio.charset.Charset; public class B { public static void main(String[] args) { B a = new B(); a.run(); } void run(){ Scanner sc = new Scanner(System.in); ...
Java
["7 3\n1 2 3\n1 4 5\n4 6 7", "9 3\n3 6 9\n2 5 8\n1 4 7", "5 2\n4 1 5\n3 1 2"]
1 second
["1 2 3 3 2 2 1", "1 1 1 2 2 2 3 3 3", "2 3 1 1 3"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
ee523bb4da5cb794e05fb62b7da8bb89
The first line contains two space-separated integers n (3 ≤ n ≤ 105) and m (1 ≤ m ≤ 105) — the number of dancers and the number of dances, correspondingly. Then m lines follow, describing the dances in the order of dancing them. The i-th line contains three distinct integers — the numbers of the dancers that take part ...
1,400
Print n space-separated integers: the i-th number must represent the color of the i-th dancer's clothes (1 for white, 2 for red, 3 for blue). If there are multiple valid solutions, print any of them. It is guaranteed that at least one solution exists.
standard output
PASSED
8b1f9905a2f5cdd1598e2d4894eaadbb
train_000.jsonl
1381838400
In Berland, there is the national holiday coming — the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions: overall, there must be m dances; exactly three people must take part in each dance; each dance must...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.HashMap; impor...
Java
["7 3\n1 2 3\n1 4 5\n4 6 7", "9 3\n3 6 9\n2 5 8\n1 4 7", "5 2\n4 1 5\n3 1 2"]
1 second
["1 2 3 3 2 2 1", "1 1 1 2 2 2 3 3 3", "2 3 1 1 3"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
ee523bb4da5cb794e05fb62b7da8bb89
The first line contains two space-separated integers n (3 ≤ n ≤ 105) and m (1 ≤ m ≤ 105) — the number of dancers and the number of dances, correspondingly. Then m lines follow, describing the dances in the order of dancing them. The i-th line contains three distinct integers — the numbers of the dancers that take part ...
1,400
Print n space-separated integers: the i-th number must represent the color of the i-th dancer's clothes (1 for white, 2 for red, 3 for blue). If there are multiple valid solutions, print any of them. It is guaranteed that at least one solution exists.
standard output
PASSED
6b3d50706f050e4cfa7caa6eae308a6d
train_000.jsonl
1381838400
In Berland, there is the national holiday coming — the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions: overall, there must be m dances; exactly three people must take part in each dance; each dance must...
256 megabytes
import java.util.Scanner; public class Codeforces357B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] colors = new int[n+1]; for(int i = 0; i < m; i++){ int a = sc.nextInt(); int c = sc.nextInt(); int b = sc.nextInt()...
Java
["7 3\n1 2 3\n1 4 5\n4 6 7", "9 3\n3 6 9\n2 5 8\n1 4 7", "5 2\n4 1 5\n3 1 2"]
1 second
["1 2 3 3 2 2 1", "1 1 1 2 2 2 3 3 3", "2 3 1 1 3"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
ee523bb4da5cb794e05fb62b7da8bb89
The first line contains two space-separated integers n (3 ≤ n ≤ 105) and m (1 ≤ m ≤ 105) — the number of dancers and the number of dances, correspondingly. Then m lines follow, describing the dances in the order of dancing them. The i-th line contains three distinct integers — the numbers of the dancers that take part ...
1,400
Print n space-separated integers: the i-th number must represent the color of the i-th dancer's clothes (1 for white, 2 for red, 3 for blue). If there are multiple valid solutions, print any of them. It is guaranteed that at least one solution exists.
standard output
PASSED
40ec7c940728a46ab98162b28a21868d
train_000.jsonl
1381838400
In Berland, there is the national holiday coming — the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions: overall, there must be m dances; exactly three people must take part in each dance; each dance must...
256 megabytes
import java.util.*; import java.io.*; public class solution { public static int tonumb(String a) { return Integer.parseInt(a); } public static void toint(int arr[],String a) { String s[] = a.split(" "); int i; for(i=0;i<s.length;i++) { arr[i] = tonumb(s[i]); } return;...
Java
["7 3\n1 2 3\n1 4 5\n4 6 7", "9 3\n3 6 9\n2 5 8\n1 4 7", "5 2\n4 1 5\n3 1 2"]
1 second
["1 2 3 3 2 2 1", "1 1 1 2 2 2 3 3 3", "2 3 1 1 3"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
ee523bb4da5cb794e05fb62b7da8bb89
The first line contains two space-separated integers n (3 ≤ n ≤ 105) and m (1 ≤ m ≤ 105) — the number of dancers and the number of dances, correspondingly. Then m lines follow, describing the dances in the order of dancing them. The i-th line contains three distinct integers — the numbers of the dancers that take part ...
1,400
Print n space-separated integers: the i-th number must represent the color of the i-th dancer's clothes (1 for white, 2 for red, 3 for blue). If there are multiple valid solutions, print any of them. It is guaranteed that at least one solution exists.
standard output
PASSED
4dd407e3d62e4408fc195ed60a527c18
train_000.jsonl
1381838400
In Berland, there is the national holiday coming — the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions: overall, there must be m dances; exactly three people must take part in each dance; each dance must...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws IOException { B solver = new B(); solver.solve(); } private Set<Integer>[] g; private int[] colors; private void solve() throws IOException { FastScanner sc = new FastScan...
Java
["7 3\n1 2 3\n1 4 5\n4 6 7", "9 3\n3 6 9\n2 5 8\n1 4 7", "5 2\n4 1 5\n3 1 2"]
1 second
["1 2 3 3 2 2 1", "1 1 1 2 2 2 3 3 3", "2 3 1 1 3"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
ee523bb4da5cb794e05fb62b7da8bb89
The first line contains two space-separated integers n (3 ≤ n ≤ 105) and m (1 ≤ m ≤ 105) — the number of dancers and the number of dances, correspondingly. Then m lines follow, describing the dances in the order of dancing them. The i-th line contains three distinct integers — the numbers of the dancers that take part ...
1,400
Print n space-separated integers: the i-th number must represent the color of the i-th dancer's clothes (1 for white, 2 for red, 3 for blue). If there are multiple valid solutions, print any of them. It is guaranteed that at least one solution exists.
standard output
PASSED
d36bd5ea6aa945ff0d8dfdc1f328a07a
train_000.jsonl
1381838400
In Berland, there is the national holiday coming — the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions: overall, there must be m dances; exactly three people must take part in each dance; each dance must...
256 megabytes
import java.util.*; public class FlagDay357B { public static void main(String[] args) { // Set up scanner Scanner sc = new Scanner(System.in); // System.out.println("Enter n"); int n = sc.nextInt(); // System.out.println("Enter m"); int m = sc.nextInt(); ...
Java
["7 3\n1 2 3\n1 4 5\n4 6 7", "9 3\n3 6 9\n2 5 8\n1 4 7", "5 2\n4 1 5\n3 1 2"]
1 second
["1 2 3 3 2 2 1", "1 1 1 2 2 2 3 3 3", "2 3 1 1 3"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
ee523bb4da5cb794e05fb62b7da8bb89
The first line contains two space-separated integers n (3 ≤ n ≤ 105) and m (1 ≤ m ≤ 105) — the number of dancers and the number of dances, correspondingly. Then m lines follow, describing the dances in the order of dancing them. The i-th line contains three distinct integers — the numbers of the dancers that take part ...
1,400
Print n space-separated integers: the i-th number must represent the color of the i-th dancer's clothes (1 for white, 2 for red, 3 for blue). If there are multiple valid solutions, print any of them. It is guaranteed that at least one solution exists.
standard output
PASSED
3f3c505fe6ddd83656013ea364d9c2b8
train_000.jsonl
1448636400
You are given two arrays of integers a and b. For each element of the second array bj you should find the number of elements in array a that are less than or equal to the value bj.
256 megabytes
import java.util.*; import java.io.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { ...
Java
["5 4\n1 3 5 7 9\n6 4 2 8", "5 5\n1 2 1 2 5\n3 1 4 1 5"]
2 seconds
["3 2 1 4", "4 2 4 2 5"]
null
Java 11
standard input
[ "data structures", "two pointers", "binary search", "sortings" ]
e9a519be33f25c828bae787330c18dd4
The first line contains two integers n, m (1 ≤ n, m ≤ 2·105) — the sizes of arrays a and b. The second line contains n integers — the elements of array a ( - 109 ≤ ai ≤ 109). The third line contains m integers — the elements of array b ( - 109 ≤ bj ≤ 109).
1,300
Print m integers, separated by spaces: the j-th of which is equal to the number of such elements in array a that are less than or equal to the value bj.
standard output
PASSED
a7bf1fed28775762bacce0f5c2c79218
train_000.jsonl
1448636400
You are given two arrays of integers a and b. For each element of the second array bj you should find the number of elements in array a that are less than or equal to the value bj.
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args) { Scanner s=new Scanner(System.in); // int a=s.nextInt(); int b=s.nextInt(); Integer arr1[]=new Integer[a]; int i,j; for(i=0;i<a;i++){ arr1[i]=s.nextInt(); } Arrays.sort(arr1); for(i=0;i<b;i++){ System.out.print(b...
Java
["5 4\n1 3 5 7 9\n6 4 2 8", "5 5\n1 2 1 2 5\n3 1 4 1 5"]
2 seconds
["3 2 1 4", "4 2 4 2 5"]
null
Java 11
standard input
[ "data structures", "two pointers", "binary search", "sortings" ]
e9a519be33f25c828bae787330c18dd4
The first line contains two integers n, m (1 ≤ n, m ≤ 2·105) — the sizes of arrays a and b. The second line contains n integers — the elements of array a ( - 109 ≤ ai ≤ 109). The third line contains m integers — the elements of array b ( - 109 ≤ bj ≤ 109).
1,300
Print m integers, separated by spaces: the j-th of which is equal to the number of such elements in array a that are less than or equal to the value bj.
standard output
PASSED
564e554075d4c684aeff32be35aeb792
train_000.jsonl
1448636400
You are given two arrays of integers a and b. For each element of the second array bj you should find the number of elements in array a that are less than or equal to the value bj.
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); }...
Java
["5 4\n1 3 5 7 9\n6 4 2 8", "5 5\n1 2 1 2 5\n3 1 4 1 5"]
2 seconds
["3 2 1 4", "4 2 4 2 5"]
null
Java 11
standard input
[ "data structures", "two pointers", "binary search", "sortings" ]
e9a519be33f25c828bae787330c18dd4
The first line contains two integers n, m (1 ≤ n, m ≤ 2·105) — the sizes of arrays a and b. The second line contains n integers — the elements of array a ( - 109 ≤ ai ≤ 109). The third line contains m integers — the elements of array b ( - 109 ≤ bj ≤ 109).
1,300
Print m integers, separated by spaces: the j-th of which is equal to the number of such elements in array a that are less than or equal to the value bj.
standard output
PASSED
bed180b1a0acadb6b510f3c3b0083396
train_000.jsonl
1448636400
You are given two arrays of integers a and b. For each element of the second array bj you should find the number of elements in array a that are less than or equal to the value bj.
256 megabytes
import java.util.*; public class queries{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); long n = scan.nextLong(); long m = scan.nextLong(); long[] arrA = new long[(int)n]; for(int i = 0;i<n;i++){ arrA[i] = scan.nextLong(); } merge(arrA,0,n-1); for(int i = 0;i<m;i++)...
Java
["5 4\n1 3 5 7 9\n6 4 2 8", "5 5\n1 2 1 2 5\n3 1 4 1 5"]
2 seconds
["3 2 1 4", "4 2 4 2 5"]
null
Java 11
standard input
[ "data structures", "two pointers", "binary search", "sortings" ]
e9a519be33f25c828bae787330c18dd4
The first line contains two integers n, m (1 ≤ n, m ≤ 2·105) — the sizes of arrays a and b. The second line contains n integers — the elements of array a ( - 109 ≤ ai ≤ 109). The third line contains m integers — the elements of array b ( - 109 ≤ bj ≤ 109).
1,300
Print m integers, separated by spaces: the j-th of which is equal to the number of such elements in array a that are less than or equal to the value bj.
standard output
PASSED
40056a87f796e307df3951c1bf03423e
train_000.jsonl
1448636400
You are given two arrays of integers a and b. For each element of the second array bj you should find the number of elements in array a that are less than or equal to the value bj.
256 megabytes
import java.util.Scanner; public class queries { public static void main(String[] args) { int max = Integer.MIN_VALUE; Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int ar[] = new int[n]; for (int i = 0; i < n; i++) { ar[...
Java
["5 4\n1 3 5 7 9\n6 4 2 8", "5 5\n1 2 1 2 5\n3 1 4 1 5"]
2 seconds
["3 2 1 4", "4 2 4 2 5"]
null
Java 11
standard input
[ "data structures", "two pointers", "binary search", "sortings" ]
e9a519be33f25c828bae787330c18dd4
The first line contains two integers n, m (1 ≤ n, m ≤ 2·105) — the sizes of arrays a and b. The second line contains n integers — the elements of array a ( - 109 ≤ ai ≤ 109). The third line contains m integers — the elements of array b ( - 109 ≤ bj ≤ 109).
1,300
Print m integers, separated by spaces: the j-th of which is equal to the number of such elements in array a that are less than or equal to the value bj.
standard output