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
b56243ec71c1742472e05981dc5b1b75
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Apple { public static void main(String args[]) { try { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); System.out.println(); while (T > 0) { int n = sc.nextInt(); long x[] = new long[n]; ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
c32d1d1258d5db322af13e637f6a467a
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.util.*; public class Codeforces { public void solve() { FastScanner fs = new FastScanner(); StringBuilder print = new StringBuilder(); int t = fs.nextInt(); while (t-- > 0 ) { int n = fs.nextInt(); int[]x = new int[n];...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
edae821808effd68d66d86f6256a6736
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; public class p1486B { public static void main(String[] args) { Scanner sc=new Scanner(System.in); for(int t=sc.nextInt();t-->0;) { int n=sc.nextInt(),x[]=new int[n],y[]=new int[n]; for(int i=0;i<n;i++) {x[i]=sc.nextInt();y[i]=sc.nextInt();} ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
6eacf05931e22bbaeef6638979e7f569
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; public class p1486B { public static void main(String[] args) { Scanner sc=new Scanner(System.in); for(int t=sc.nextInt();t-->0;) { int n=sc.nextInt(),x[]=new int[n],y[]=new int[n]; for(int i=0;i<n;i++) {x[i]=sc.nextInt();y[i]=sc.nextInt();} ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
88a936d13a274090f7097463c266c43b
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; public class temp { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int q = sc.nextInt(); while(q-->0){ int n = sc.nextInt(); long[] x = new long[n]; long[] y = new long[...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
40be46ed1752b140503ce5552084e363
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class EasternExhibition implements Closeable { private InputRe...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
2ae91bb642f5cb7a39c8c08f14be674d
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
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.Random; import java.util.concurrent.ThreadLocalRandom; public class EasternExhibition { public static void main(String[] args) throws IOExc...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
11355f2be3142776427f3b8504bf265f
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; public class code { // static class pair implements Comparable<pair>{ // int x;int y; // // public pair(int x,int y){ // this.x=x; // this.y=y; // } // // // @Override // public int compar...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
9faf6a4c18fae4e3f1b25003b43c9dc1
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t--!=0){ int n=sc.nextInt(); int[] a=new int[n],b=new int[n]; for(int i=0;i<n;i++){ a[i]=s...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
2feeec9d242ee884a3cdf31439bc3691
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
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(); while (t-->0){ int n=sc.nextInt(); int[] x=new int[n+1]; int[] y=new int[n+1];...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
deeca06416ba09d1c43d525c36e1a0e6
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.util.*; public class Exibition{ static long mod = 1000000007L; static MyScanner sc = new MyScanner(); static long sol(ArrayList<Integer> ar){ int n = ar.size(); Collections.sort(ar); return ar.get(n/2)-ar.get((n-1)/2)+1; } static void...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
52b775551354fd6e1a946e35b272c313
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
/*package whatever //do not write package name here */ import java.io.*; import java.util.*; public class GFG { public static void main (String[] args) { Scanner a= new Scanner(System.in); int t=a.nextInt(); for(int k=0;k<t;k++){ int n=a.nextInt(); int x[]=new int[n]; int y[]=n...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
7df114b93aaed0c89d60221ce0eec0d7
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static int INF = 0x3f3f3f3f; public static int mod = 1000000007; public static void main(String args[]){ try { PrintWriter o = new PrintWriter(System.out); FastScanner sc = new FastScanner(); ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
a4843aab6422a4e9a8050bc00320527e
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class CFp7 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); main: while (t-- > 0) { int n = in.nextInt(); long[] xs = new long[n]; ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
9c7d469ce1a358d39615baca1bd7e095
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
// package PracticeSessionNTSCC; import java.io.*; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class EasternExhibition { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
66feaa26a4789fb1b55266e4b4659ca9
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.util.*; public class _1486b { FastScanner scn; PrintWriter w; PrintStream fs; long MOD = 1000000007; int N=100000+10; long mul(long x, long y) {long res = x * y; return (res >= MOD ? res % MOD : res);} long power(long x, long y) {if (y < 0) return ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
1d816c9016018e2a5bd8389a3bf1e730
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; import java.io.*; // import java.lang.*; // import java.math.*; public class Codeforces { static FastReader sc=new FastReader(); static PrintWriter out=new PrintWriter(System.out); static long mod=1000000007; static long mod1=998244353; static int MAX=Integer.MAX_VALUE; static i...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
545355a3939de842d9385d00380aa6ae
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static String readLine() throws IOException { return br.readLine(); } static PrintWriter pr = new PrintWriter(new OutputStreamWriter(Syst...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
2e53aa33e578e89a6232550bde6038b7
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Solution { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
69b17429dc5ce84d83b015ecfc3715cd
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ static PrintWriter out = new PrintWriter(System.out); public static void main (String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] input = br.readLine().trim().split(" "); ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
e0ee962fe5b98b51adb16d8a4854dbfe
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; import java.io.IOException; import java.util.Scanner; public class solve { static Scanner sc=new Scanner(System.in); public static void solve() { int n=sc.nextInt(),x[]=new int[n],y[]=new int[n]; for(int i=0;i<n;i++) {x[i]=sc.nextInt(); y[i]=sc.nextInt();} Arrays.sort(x); Ar...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
faff837ced017f4a780bfbcc721f02e5
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static PrintWriter out; public static void main(String[] args) { MyScanner scan = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int testCases = scan.nextInt(); for(i...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
7476ddb59fb619622f0cbf65e74abc11
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.math.BigInteger; import static java.lang.Math.max; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.PriorityQueue; import java.util.Queue; ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
8cd5fcfa352a75f92ce53118e67f7ffd
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { private static FastScanner sc = new FastScanner(); private static long mod = 1000000000; private static HashMap<Long, Long> h = new HashMap<>(); public static ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
2b006f09037fc391a982b7557027db6b
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Random; import java.util.StringTokenizer; public cl...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
61c2606916d2a82d2ca449bc237cb3f1
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int t=s.nextInt(); for(int i=0;i<t;i++) { int n=s.nextInt(); int[] x=new int[n]; int[] y=new int[n]; for(int j=0;j<n;j++) { x[j]...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
d0fafb6a6890f719f83deb70f0c666fd
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; public class EasternExhibition { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); long a[]=new long[n]; long b[]=new long[n]; for(int i=0;i<n;i++) { ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
def2aba3e9cb9a07e79977e35e08aca4
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.InputMismatchException; import java.util.*; import java.io.*; import java.lang.*; public class Main{ public static class InputReader { private InputStream strea...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
afc6163f14575039c19bf84ea70bceac
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.File; import java.io.FileNotFoundException; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; public class Main { static Scanner in = new Scanner(System.in); // static Scanner in = new Scanner( new File("javain.txt")); public s...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
bea030941b6731c762987f2704a6b347
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
// Don't place your source in a package import java.util.*; import java.lang.*; import java.io.*; import java.math.*; // Please name your class Main public class Main { static Scanner in = new Scanner(System.in); public static void main (String[] args) throws java.lang.Exception { P...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
0d832013c304e881d6b381f4cc5f09d8
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; public class B { public long calc(long [] a) { return Math.abs(a[(a.length + 1) / 2 -1 ] - a[(a.length + 2) / 2 - 1]) + 1; } public void solve() { ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
5ed5d5dac6781e5c3cef7b365965b3b5
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.lang.*; import java.util.*; public class Arpit { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0) { int n = sc.nextInt(); long[] x = new long[n]; l...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
86b96877b1d12c3f1c6b28a818643134
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); PrintWriter w = new PrintWriter(System.out); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
68730afceb74707bb24bde2f9dc31192
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
60833b1c45fd15279f4aa0e5a49b00b7
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class B { static InputReader ir; static OutputPrinter op...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
e9fe2793a42f71bd5e553e60b08b81fd
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.util.*; public class Codeforces2 { public static void main(String[] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); while(t-->0){ int n = Integer.par...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
cf44941982219d6fa192187821f50fdb
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.util.*; import java.util.Scanner; import java.lang.*; public class exhibition { public static void main(String args[]) throws IOException { Scanner sc=new Scanner (System.in); int t; t=sc.nextInt(); sc.nextLine(); int i; ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
1de715edbdc8f142944c63c1234f70a0
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; public class Main { static void sort(long a[]) { Random ran = new Random(); for (int i = 0; i < a.length; i++) { int r = ran....
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
3e60f7e0123c4fa6b50d3ad7f2175351
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class Solution { private static boolean TESTS = true; private final Input in; private final PrintStream out; public Solution(final Input in, final PrintStream out) { this.in = in; this....
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
406ae324e7731dc9de447b9b5d6d6c7b
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class B { public static void main(String[] args) { FastScanner fs = new FastScanner(); int t = fs.nextInt(); while (t-- > ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
eb9e4f97012dbb08e83a8c0c9b2aaba1
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
/* ⠀⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀⢠⠞⠉⠙⠲⡀⠀ ⠀⠀⠀⣴⠿⠏⠀⠀⠀⠀⠀⠀⢳⡀⠀⡏⠀⠀Y⠀⠀⢷ ⠀⠀⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀⢸⠀⠀A⠀⠀ ⡇ ⠀⠀⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿⠀⣸⠀⠀S⠀ ⡇ ⠀⠀⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀⣿⠀⢹⠀⠀H⠀⠀ ⡇ ⠀⠀⠙⢿⣯⠄⠀⠀⠀⢀⡀⠀⠀⡿⠀⠀⡇⠀⠀⠀⠀⡼ ⠀⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀⠀⠘⠤⣄⣠⠞⠀ ⠀⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀ ⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀ ⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀⠀⣄⢸⠀⠀⠀⠀⠀⠀ ⣿⣿⣧⣀⣿………⣀⣰⣏⣘⣆⣀⠀⠀ */ import java.io.BufferedReader; impo...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
fa9b31fe99b72477c67893ae04d63b69
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class easternexhibition { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); for (int tt = 0; tt < t; tt++) { int n = scn.nextInt(); long[] x = new long[n]; long[] y = new long[n...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
6570e46ea00c8df9a16e68416473260e
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class B{ public static void main(String args[]) throws Exception { FastScanner fs=new FastScanner(); int t = fs.nextInt(); while(t-- > 0){ int n = fs.nextInt(); long x[] = new long[n]; long y[] = new long[n]; for(int i=0...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
9d95871b303ba3b1b06aa2592f9b2c71
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; import java.math.*; public class Main { public static void main(String args[]) { Scanner input = new Scanner(System.in); int T = input.nextInt(); while(T-->0) { int n = input.nextInt(); long x[] = new long[n]; long y[]...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
deb25c50577b4e76381aa246e94382b8
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.util.*; public class B { static FastReader reader = new FastReader(); static OutputWriter out = new OutputWriter(System.out); //1 2 3 static int[] calc(List<Integer> arr) { if(arr.size() == 1) { return new int[] {arr...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
e5742c99b40f306235de80c7350a8931
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; import java.io.*; public class Main2 { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
56f74651139120567e8dc973fe5f1c00
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
// Main Code at the Bottom import java.util.*; import java.io.*; public class Main{ //Fast IO class static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { boolean env=System.getProperty("ONLINE_JUDGE") != null; //env=...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
66f6c9f6e56edcc06ea6248f5135483e
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; import java.io.*; public class A { static FastReader in=new FastReader(); static final Random random=new Random(); static long mod=1000000007L; static HashMap<Integer,Integer>map=new HashMap<>(); public static void main(String args[]) throws IOException { int t...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
d6549bacc8dd1a3f3ad0242fd7028978
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.math.BigInteger; import java.util.*; import java.io.*; import java.util.LinkedList; public class Main { static long startTime = System.currentTimeMillis(); static void run(){ boolean tc = true; AdityaFastIO r = new AdityaFastIO(); //FastReader r = new FastReade...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
d5732495a931e915d9af5b44069a8463
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.Scanner; public class T1486B { static int homeXs[]; static long distanceToHomeByX[]; static int homeYs[]; static long distanceToHomeByY[]; public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for (int i = 0;...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
ecdf6156838be44938243887c4ff41ac
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.ArrayList; import java.util.Collections; import java.util.Arrays; import java.util.Comparator; public class B { public long cnt(int[] a, int b) { ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
99cc415c571df2d1bcfa9554d3f675f1
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; import java.io.*; public class Solution { public static void main (String[] args) throws java.lang.Exception { // Scanner sc = new Scanner(System.in); // final int MOD = 998244353; // int t = sc.nextInt(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
bf4452a6975386be30af55ac77b4ad40
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; import java.text.*; public class Main { static long mod = 1000_000_007; static long mod1 = 998244353; static boolean fileIO = true; static boolean memory = true; static FastScanner f; static PrintWriter pw; static ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
81f399c1e45eabb60631dcdae8cf2e86
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; import java.io.*; public class B { public static void main(String[] args) { FastScanner sc = new FastScanner(); int T = sc.nextInt(); while(T-- > 0) { int n = sc.nextInt(); long[] x = new long[n]; long[] y = new long[n]; for(int i = 0; i < n; i++){ x[i] = sc.nextI...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
9ac619d51ee6343406320a4ed6cb93bf
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import java.util.concurrent.TimeUnit; public class b1486 implements Runnable{ public static void main(String[] args) { try{ new Thread(null, new b1486(), "process", 1<<26).start(); } catch(Exception e){ ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
3fd5c79dce01a9bffceaf5404a009017
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.math.BigInteger; //import javafx.util.*; public final class B { static StringBuilder ans=new StringBuilder(); static FastReader in=new FastReader(); static ArrayList<ArrayList<Integer>> g; static long mod=1000000007; static int...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
f29afb2261278cc6e479e2dd8c566ec7
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Solution1486B { public static void main(String[] args) { InputReader in = new InputReader(Sy...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
fffa9987ce6303b1fd94e267913c6b33
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); Integer[]x=new Integer[n]; Integer[]y=new Integer[n]; for(int i=0;i<n;i++) { x[i]=sc.nextInt(); y[i]=...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
b6549b8890576c08917c823f605dba83
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class A implements Runnable { public void run() { long startTime = System.nanoTime(); int ts = nextInt(); while (ts-- > 0) { int n = nextInt(); int[] x = new int[n]; int[]...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
efbae8afdc35a7a3c5e8ad6fb7a48fca
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.util.*; public class A { static FastScanner fs; public static void main(String[] args) { fs=new FastScanner(); int t = fs.nextInt(); while (t-->0) solve(); } public static void solve() { int n = fs.nextInt(); i...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
faa939863e1d09764cbcd4c3d79234f0
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); main: while (t-- > 0) { int n = in.nextInt(); long[] xs = new long[n]; ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
b7c1628ddbdd9cf46303be65b30b25cf
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; import java.io.*; // cd C:\Users\Lenovo\Desktop\New //ArrayList<Integer> a=new ArrayList<>(); //List<Integer> lis=new ArrayList<>(); //StringBuilder ans = new StringBuilder(); //HashMap<Integer,Integer> map=new HashMap<>(); ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
0d06ca29da472b013a6d9c91140d5760
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Comparator; import java.util.StringTokenizer; public class B1486 { static FastScanner sc = new FastScanner(System.in); static FastPrintStream out = new FastPrintStream(System.out); public static void main(String[] args) { ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
69b3dd813db59d0b1813a718c3938d23
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.util.*; import static java.lang.Math.*; import java.io.*; public class S { public static int surv = 0; public static void main(String args[])throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int test = Integer.parseIn...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
7e39e15ca5a43c3c3f9ab02fdec62b34
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
//package practices.level1500.speedtraining; import java.io.*; import java.util.*; import static java.lang.Math.*; public class B1486 { static InputReader in; static PrintWriter out; public static void main(String[] args) { //initReaderPrinter(true); initReaderPrinter(false); sol...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
4d9d6efda05f9100f55b4e2f0c1ea492
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class easternexhibition { static long[] ans; static int ind; static long[] x; static long[] y; static int n; public static void main ...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 8
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
9af83514585c5b8306f70f8baf30035a
train_110.jsonl
1613658900
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
256 megabytes
/****************************************************************************** Online Java Compiler. Code, Compile, Run and Debug java program online. Write your code in this editor and press "Run" button to execute it. ***********************************************...
Java
["6\n3\n0 0\n2 0\n1 2\n4\n1 0\n0 2\n2 3\n3 1\n4\n0 0\n0 1\n1 0\n1 1\n2\n0 0\n1 1\n2\n0 0\n2 0\n2\n0 0\n0 0"]
1 second
["1\n4\n4\n4\n3\n1"]
NoteHere are the images for the example test cases. Blue dots stand for the houses, green — possible positions for the exhibition.First test case.Second test case. Third test case. Fourth test case. Fifth test case. Sixth test case. Here both houses are located at $$$(0, 0)$$$.
Java 17
standard input
[ "binary search", "geometry", "shortest paths", "sortings" ]
e0a1dc397838852957d0e15ec98d5efe
First line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 1000)$$$. Next $$$n$$$ lines describe the positions of the houses $$$(x_i, y_i)$$$ $$$(0 \leq x_i, y_i \leq 10^9)$$$. It's guaranteed t...
1,500
For each test case output a single integer - the number of different positions for the exhibition. The exhibition can be built in the same point as some house.
standard output
PASSED
3b9004389e2a51c39510c1d789699d57
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.InputMismatchException; import java.util.*; import java.io.*; import java.lang.*; public class Main{ public static class InputReader { private InputStream strea...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
7e5274845514580765c36cba98191fed
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.InputMismatchException; import java.util.*; import java.io.*; import java.lang.*; public class Main{ public static class InputReader { private InputStream strea...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
5c29bc5f1f47e5dd87a8789d0532e16a
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.util.*; import javax.sound.midi.Track; import java.io.*; public class tr0 { static PrintWriter out; static StringBuilder sb; static long mod = (long) 1e9 + 7; static long inf = (long) 1e16; static int n, m; static ArrayList<Integer>[] ad; static int[][] remove, add; static int[][] m...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
d1f3169d5ae881a3a65ec2cccc1a8b55
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.util.*; import javax.sound.midi.Track; import java.io.*; public class tr0 { static PrintWriter out; static StringBuilder sb; static long mod = (long) 1e9 + 7; static long inf = (long) 1e16; static int n, m; static ArrayList<Integer>[] ad; static int[][] remove, add; static int[][] m...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
75e6db39688f9e6e1f958036f7a11f5a
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
//stan hu tao import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; public class x1486D2 { public static void main(String hi[]) throws Exception { BufferedReader infile = new BufferedRe...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
58152293fc6b0295305917e0a4844059
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.util.*; import java.math.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; //--------------->>>>IF YOU ARE HERE FOR QUICKSORT HACK THEN SORRY NO HACK FOR YOU<<<------------------- public class a{ static long[] count...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
5ed451aa7bf0325e792abbf705261cd0
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.util.*; import java.math.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; //--------------->>>>IF YOU ARE HERE FOR QUICKSORT HACK THEN SORRY NO HACK FOR YOU<<<------------------- public class a{ static long[] count...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
926358b19b0a4974a6b2d95c9a2e8d48
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.util.*; import java.math.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; //--------------->>>>IF YOU ARE HERE FOR QUICKSORT HACK THEN SORRY NO HACK FOR YOU<<<------------------- public class a{ static long[] count...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
ad6815fee9008fb9ecfccf9696739cea
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.util.*; import java.math.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; //--------------->>>>IF YOU ARE HERE FOR QUICKSORT HACK THEN SORRY NO HACK FOR YOU<<<------------------- public class a{ static long[] count...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
5f068e954b6956fdc06d169de51e2dcf
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode; import java.util.*; import java.util.concurrent.LinkedBlockingDeque; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; // graph, dfs,bfs, get connected components,iscycle, isbi...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
8e59ad4b587fc2afbb2edf33b4b1083c
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import org.omg.PortableInterceptor.INACTIVE; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; im...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
c8db969fe1708dc871304bbb33f10270
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import org.omg.PortableInterceptor.INACTIVE; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; im...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
a2f928be34f461712fa63eff9c2cf506
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.*; import java.util.*; public class TaskA { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); Task solver = new Task(); solver.solve(in, out); out.close(); } ...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
f4a8082230225e791b3d2fe9484d59ef
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } ...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
7db18313605528e3fb0566dd4372efd8
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.util.Arrays; //Max Median of subarray of length at least k //https://codeforces.com/contest/1486/problem/D import java.util.Scanner; //import codeforces.CF_1486d.Mode; public class CF_1486d{ private static final boolean DEBUG= true; enum Mode{ BIN_SEARCH_SUBARRAY_LEN_AT_LEAST_K...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
769007591afdd4ad6052d4694908c254
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
//import static lib.Utils.*; //import static lib.StringUtils.*; import java.util.Arrays; //Max Median of subarray of length at least k //https://codeforces.com/contest/1486/problem/D import java.util.Scanner; public class CF_1486d{ private static final boolean DEBUG= false; enum Mode{ BIN...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
e99a9b685aab7cd7cd4cb99198a32c08
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Random; import java.util.Stack; impor...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
ee84a198dcad025c4d9822c8b56e0879
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.*; import java.util.*; /* */ public class D{ static FastReader sc=null; static int nax=(int)1e9; public static void main(String[] args) { sc=new FastReader(); int n=sc.nextInt(),k=sc.nextInt(); int a[]=sc.readArray(n); int l=0,r=nax; while(l+1<r) { int ...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
210072e93cbea774c8c3c3196a4211ef
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.*; import java.util.*; /* */ public class D{ static FastReader sc=null; static int nax=(int)1e9; public static void main(String[] args) { sc=new FastReader(); int n=sc.nextInt(),k=sc.nextInt(); int a[]=sc.readArray(n); int l=0,r=nax; while(l+1<r) { int ...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
d9ef2c39a2972c8721f29f7783192193
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.*; import java.util.*; /* */ public class D{ static FastReader sc=null; static int nax=(int)1e9; public static void main(String[] args) { sc=new FastReader(); int n=sc.nextInt(),k=sc.nextInt(); int a[]=sc.readArray(n); int l=0,r=nax; while(l+1<r) { int ...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
5d90f71eef52c07c7cff899b542583a7
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.math.BigInteger; public final class A { static PrintWriter out = new PrintWriter(System.out); static StringBuilder ans=new StringBuilder(); static FastReader in=new FastReader(); static ArrayList<Integer> g[]; static lon...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
ace2c4454d04721dd81bae0fbe87b109
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.*; import java.util.*; public class G { static class MinCostMaxFlow { // Stores the found edges boolean found[]; // Stores the number of nodes int N; // Stores the capacity // of each edge int cap[][]; int flow[][]; // Stores the cost per // unit flow of ea...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
ea5107cd21b9fe5a62abd92eed1a25f5
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
// Don't place your source in a package import java.util.*; import java.lang.*; import java.io.*; import java.math.*; // Please name your class Main public class Main { static Scanner in = new Scanner(System.in); public static void main (String[] args) throws java.lang.Exception { P...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
c3bbef9d18f7a423768d3c4e9a80ddd2
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Random; import java.util.Stack; impor...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
5f764db31e5c3b7040dfcafb1cb5ad7f
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class Round703_D { public static boolean check(int val, int[] a, int k){ int[] b = new int[a.length]; int[] sum = new int[a.length + 1]; for(int i = 0; i ...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
f7dd036c714521cc740d7d06a636fbb7
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Round703_D { public static boolean check(int val, int[] a, int k){ int[] b = new int[a.length]; int[] sum = new int[a.length + 1]; for(int i = 0; i < a.length; i++){ ...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
edb9fe8d76169677a5ec72b5283602c6
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Round703_D { public static boolean check(int val, int[] a, int k){ int[] b = new int[a.length]; int[] sum = new int[a.length + 1]; for(int i = 0; i < a.length; i++){ ...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
0e9396f3fe25685d84335b7444be8efd
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.util.*; import java.io.*; public class D { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String next() { ...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
805cc5de5a8672420aec2b3ed481ea00
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.*; import java.util.*; public class MaxMedian_703D { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n ...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
370271bbd7b92ffbdd25784ec932c0bf
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.util.*; public class Test { static boolean check(int[] nums, int[] dif, int mid, int k) { int n = nums.length; for (int i = 0; i < n; i++) dif[i+1] = dif[i] + (nums[i] >= mid ? 1 : -1); int minPre = 0, ans = dif[k]; for (int i = k + 1; i <= n; i++) { ...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
b78b30c5c0d4cfe94f018ab414472f0d
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.util.*; import java.io.*; public class Solution { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { ...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
ce2138f61d1d833505ee8b543304cf4b
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.*; import java.util.*; public final class Solution { static PrintWriter out = new PrintWriter(System.out); static FastReader in = new FastReader(); static long mod = (long) 1e9 + 7; static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(1, 0), new Pair(0, -1), new Pair(0, ...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output
PASSED
d044c9594b7c83430c64984a97542c57
train_110.jsonl
1613658900
You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main{ public static void main(String[] args) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = System.out; PrintWriter out = new PrintWriter(outputStream); InputReader in = new InputRe...
Java
["5 3\n1 2 3 2 1", "4 2\n1 2 3 4"]
2 seconds
["2", "3"]
NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.
Java 8
standard input
[ "binary search", "data structures", "dp" ]
dddeb7663c948515def967374f2b8812
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).
2,100
Output one integer $$$m$$$ — the maximum median you can get.
standard output