prompt string | response string |
|---|---|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
int main() {
vector<int> v, c;
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
n *= 2;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
cout << a[n / 2] - a[n / 2 - 1] << '\n';
}
}
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | test=int(input())
for t in range(test):
n = int(input())
l=[int(x) for x in input().split(" ")]
l.sort()
diff=l[n]-l[n-1]
print(diff) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | t=int(input())
for i in range(t):
n=int(input())
stu=[int(i) for i in input().split()]
stu.sort()
print(stu[2*n//2]-stu[2*n//2-1])
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | from builtins import int
till=int(input())
for i in range(till):
x=int(input())
arr=[int(num) for num in input().split()]
arr.sort()
print(abs(arr[x-1]-arr[x]))
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class AssigningToClasses {
public static void main(String[] args) throws NumberFormatException, IOException {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = n... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | __author__ = 'tanunia'
t = int(input())
for _ in range(t):
n = int(input())
a = sorted(list(map(int, input().split())))
x, y = len(a)//2, len(a)//2 - 1
print(abs(a[x] - a[y])) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #Pye
from sys import stdin, stdout
from os import path
if path.exists('inp.txt'):
stdin = open("inp.txt", "r")
q = int(stdin.readline())
for _ in range(q):
n = int(stdin.readline())
a = sorted(list(map(int, stdin.readline().split())))
cnt = 0; b = [0]; c = [0]
for i in a:
cnt += 1
... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
print(a[n]-a[n-1]) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
using pii = pair<long long, long long>;
using vi = vector<long long>;
using mii = map<long long, long long>;
using ADJ = map<long long, vector<long long>>;
using vpii = vector<pii>;
const long long MOD = 1000000007;
const long long N = 100000;
template <typename first, type... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | from __future__ import division, print_function
def main():
# Template 1.0
import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, floor
from heapq import heappush, heappop, heapify, nlargest, nsmal... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | t = int(input())
for _ in range(t):
n = int(input())
arr = [int(i) for i in input().split(' ')]
arr.sort()
print(arr[n] - arr[n-1]) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for i in range(int(input())):
n = int(input())
a = list(sorted(map(int, input().split())))
print(abs(a[n] - list(reversed(a))[n]))
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | /*
Hack karke code mera, tu intakam dekhega.
*/
import javax.print.DocFlavor;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class TaskB {
public static void main(String[] args) throws Exception {
... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | t=int(input())
for i in range(t):
n=int(input())
a=input().split()
for j in range(2*n):
a[j]=int(a[j])
a.sort();
print(a[n]-a[n-1]) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | import java.io.*;
import java.util.Arrays;
import java.util.InputMismatchException;
/* * */
public class _618_B implements Runnable{
public static void main(String[] args) {
new Thread(null, new _618_B(),"Main",1<<27).start();
}
@Override
public void run() {
FastReader fd = new FastReader(... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | t=int(input())
for i in range(t):
n=int(input())
a=list(map(int,input().split()))
a.sort()
print(a[n]-a[(n)-1]) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.InputStream;
... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long t;
cin >> t;
while (t--) {
long long n;
cin >> n;
long long arr[n * 2];
for (long long i = 0; i < n * 2; ++i) {
cin >> arr[i];
}
sort(arr, arr + 2 * n, greater<int>());
long long one = (2 * n) / 2;
long long... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | import java.util.*;
import java.math.*;
import java.io.*;
public class input2 {
public static void merge(int arr[], int l, int m, int r)
{
// Find sizes of two subarrays to be merged
int n1 = m - l + 1;
int n2 = r - m;
/* Create temp arrays */
int L[] = new int [n1];
... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | import sys
input = sys.stdin.readline
t=int(input())
for tests in range(t):
n=int(input())
A=sorted(map(int,input().split()))
print(A[n]-A[n-1])
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000000 + 7;
const long long int N = 1000000 + 6;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long int t;
cin >> t;
while (t--) {
long long int n;
cin >> n;
n = 2 * n;
long long int a[n];
... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2 * 1e5 + 10;
int main() {
int T;
cin >> T;
int n;
int a[maxn];
while (T--) {
cin >> n;
for (int i = 0; i < 2 * n; i++) cin >> a[i];
sort(a, a + 2 * n);
cout << a[n] - a[n - 1] << endl;
}
}
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | import sys
from math import *
input=sys.stdin.readline
t=int(input())
while t>0:
t-=1
n=int(input())
a=[int(x) for x in input().split()]
a.sort()
print(a[n]-a[n-1]) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | # May the Speedforce be with us...
'''
for _ in range(int(input())):
arr=list(map(int,input().split()))
n,k=map(int,input().split())
n=int(input())
s=input()
from collections import defaultdict
d=defaultdict()
d=dict()
s=set()
s.intersection()
s.union()
s.difference()
problem statement achhe se padhna hai
age se bh... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | t = int(input())
for _ in range(t):
n = int(input())
lol=[int(n) for n in input().split()]
lol.sort()
print(lol[n]-lol[n-1]) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | import sys
input = lambda: sys.stdin.readline().rstrip()
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
a.sort()
print(abs(a[n]-a[n-1])) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for _ in range(int(input())):
n = int(input())
arr = sorted(list(map(int, input().split())))
print(abs(arr[n]-arr[n-1]))
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | import java.io.*;
import java.util.*;
public class B {
public static void main(String[] args) {
FastReader scan = new FastReader();
PrintWriter out = new PrintWriter(System.out);
Task solver = new Task();
int t = scan.nextInt();
while (t --> 0) solver.solve(1, scan, out);
... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | import java.util.*;
import java.io.*;
public class Solution{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
int n = sc.nextInt();
int[] arr = new int[2*n];
for(int i = 0; i < 2*n; i++){
... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
int T;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T;
cin >> T;
while (T--) {
int n;
cin >> n;
int m = n * 2;
vector<int> v(m + 1);
for (long long i = 1; i <= (m); i++) cin >> v[i];
sort(v.begin(), v.end());
... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | def solve():
n = int(input())
arr = sorted(map(int, input().split()))
print(arr[n] - arr[n-1])
for _ in range(int(input())):
solve()
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | t = int(input())
for _ in range(t):
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
print (abs(a[n]-a[n-1])) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
int main() {
int t, i, n, p, j;
scanf("%d", &t);
for (i = 1; i <= t; i = i + 1) {
scanf("%d", &n);
p = 2 * n;
int a[p];
for (j = 0; j < p; j = j + 1) {
scanf("%d", &a[j]);
}
sort(a, a + p);
printf("%d\n", a[n] - a[n - 1]);
}
}
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
std::vector<int> arr;
for (int i = 0; i < 2 * n; i++) {
int a;
cin >> a;
arr.push_back(a);
}
sort(arr.begin(), arr.end());
cout << abs(arr[n] - arr[n - 1]) << "\... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for _ in range(int(input())):
n=int(input())
arr=list(map(int,input().split()))
arr.sort()
print(abs(arr[n-1]-arr[n]))
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long t;
cin >> t;
while (t--) {
long long n;
cin >> n;
vector<long long> a(2 * n);
for (int i = 0; i < 2 * n; i++) {
cin >> a[i];
}
sort(a.begin(), a.end(... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | # bisect(arr, key, lambda x, y: x > y)
def bisect(arr, val, cmp):
l = -1
r = len(arr)
while r - l > 1:
e = (l + r) >> 1 # divide by 2
if cmp(arr[e], val):
l = e
else:
r = e
return r
t = int(input())
answers = []
for ti in range(t):
n = int(input())... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | '''input
3
1
1 1
3
6 5 4 1 2 3
5
13 4 20 13 2 5 8 3 17 16
'''
import sys
# import numpy as np
# from math import ceil
read = lambda: list(map(int,sys.stdin.readline().strip().split()))
# def day_of_week(day, month, year):
# t = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]
# year -= month < 3
# return (year + int(... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for i in range(int(input())):
n = int(input())
a = [int(s) for s in input().split()]
a.sort()
print(abs(a[n]-a[n-1])) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | def solve():
n = int(input())
lst = list(map(int,input().split()))
lst.sort()
ans = []
for i in range(0 , n + 1):
ans.append(abs(lst[i] - lst[(2 * n) - i - 1]))
#print(lst[i])
#print(lst[n - i - 1])
#print(lst)
print(min(ans))
t = int(input())
for i in range(t):
solv... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | t = int(input())
for i in range(t):
n = int(input())
a = list(map(int, input().split()))
a.sort()
print(abs(a[n] - a[n-1]))
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | t=int(input())
while(t):
t-=1
n=int(input())
arr=list(map(int,input().split()))[:2*n]
arr.sort()
print(arr[n]-arr[n-1]) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for _ in range(int(input())):
v=int(input())
a=list(map(int,input().split()))
a.sort()
print(a[v]-a[v-1]) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
long long t;
cin >> t;
while (t--) {
long long n;
cin >> n;
long long a[2 * n];
for (long long i = 0; i < 2 * n; i++) cin >> a[i];
sort(a, a + 2 * n);
cout << abs(a[n - 1] - a[n]) << endl;
}... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
int arr[200010];
int main() {
ios_base ::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (--t > -1) {
int n;
cin >> n;
for (int i = 1; i <= n * 2; ++i) {
cin >> arr[i];
}
sort(arr + 1, arr + 1 + n * 2);
cout << abs(arr[n] - arr... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int a[200010];
int b[100010], c[100010];
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
for (int i = 0; i < 2 * n; i++) cin >> a[i];
sort(a, a + 2 * n);
int ib = 0, ic = 0;
bool f = 0;
if (n % 2 == 0) f =... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... |
import java.util.*;
public class C618_PB {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while(t-->0)
{
int n = in.nextInt();
int[] a = new int[2*n];
for(int i = 0;i<2*n;i++)
{
a[i] = in.nextInt();
... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | n=int(input())
for i in range(n):
m=int(input())
a=[int(i) for i in input().split()]
a=sorted(a)
d=(len(a))
print(a[d//2]-a[(d//2)-1]) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | t = int(input())
for _ in range(t):
n = int(input()) * 2
arr = list(map(int, input().split()))
arr.sort()
print(arr[n//2] - arr[n//2 - 1])
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
scanf("%d", &n);
vector<int> vec(2 * n);
for (int i = 0; i < 2 * n; i++) {
scanf("%d", &vec[i]);
}
sort((vec).begin(), (vec).end());
cout << vec[n] - vec[n - 1] << endl;
}
int main() {
int nt = 1;
scanf("%d", &nt);
while (nt--) ... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | import java.util.*;
public class Main{
public static void main(String []args){
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while(t-->0){
int n = s.nextInt();
int arr[] = new int[2*n];
for(int i=0; i<2*n; i++){
arr[i] = s.nextIn... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | n = int(raw_input())
for i in range(n):
k = int(raw_input())
s = raw_input()
s = map(int , s.split())
s.sort()
print s[len(s) / 2] - s[len(s) / 2 - 1] |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
void SlayMe() {
int n;
scanf("%d", &n);
int arr[n * 2 + 1];
for (int i = 0; i < n * 2; i++) {
scanf("%d", &arr[i]);
}
sort(arr, arr + n * 2);
printf("%d\n", arr[n] - arr[n - 1]);
}
int main() {
int ttt;
scanf("%d", &ttt);
for (int i = 0; i < ttt; i++... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for t in range(int(input())):
n = int(input())
l = [int(i) for i in input().split()]
l.sort()
print(abs(l[n] - l[n - 1]))
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | # def solve(a, n):
# a.sort(reverse=True)
# return a
t = int(input())
for i in range(t):
n = int(input())
a = list(map(int, input().split(" ")))
a.sort()
# y = solve(a, n)
print(a[n] - a[n - 1])
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | t = int(input())
while t:
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
print(abs(arr[n - 1] - arr[n]))
t -= 1 |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for _ in range(int(input())):
n = int(input())
array = sorted(list(map(int, input().split())))
print(abs(array[n] - array[n - 1]))
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int a[2 * n];
for (int i = 0; i < 2 * n; i++) cin >> a[i];
sort(a, a + 2 * n);
cout << a[n] - a[n - 1] << endl;
}
}
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for i in range(int(input())):
a=int(input())
b=list(map(int,input().split()))
b.sort()
print(b[a]-b[a-1]) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int arr[2 * n + 1];
for (int i = 1; i < 2 * n + 1; i++) {
cin >> arr[i];
}
sort(arr + 1, arr + 2 * n + 1);
cout << abs(a... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for _ in range(int(input())):
n = int(input())
a = sorted(list(map(int, input().split())))
print(a[n] - a[n-1]) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for z in range(int(input())):
n=int(input())
arr=[int(i) for i in input().split()]
# arr1,arr2=[],[]
arr.sort()
# if n%2==1:
# for i in range(len(arr)):
# if i%2==0:
# arr1.append(arr[i])
# else:
# arr2.append(arr[i])
# mid=n//2
# print(abs(arr2[mid]-arr1[mid]))
# else:
# for i in range(len(... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for case in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
x=n//2
x=x-1
a.sort()
diff=a[n]-a[n-1]
print(abs(diff))
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for t in range(int(input())):
n= int(input())
arr= list(map(int, input().split()))
arr.sort()
print(arr[n]- arr[n- 1]) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | t = int(input())
for i in range(t):
n = int(input())
arr = list(map(int, input().strip().split(' ')))
arr.sort()
mid = len(arr)//2
print(abs(arr[mid-1] - arr[mid])) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | t = int(input())
for k in range(t):
n = int(input())
a = list(map(int, input().split()))
a.sort()
print(abs(a[n] - a[n - 1])) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | t=int(input())
for _ in range(t):
n=2*(int(input()))
a=list(map(int,input().split()))
a.sort()
print(abs(a[int(n/2)]-a[int(n/2)-1]))
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
a.sort()
print(abs(a[n-1]-a[n])) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int,input().split()))
a.sort()
k2 = (n-1)//2
m2 = n - k2 - 1
k = 2*k2 + 1
m = 2*m2 + 1
m1 = []
k1 = []
for i in range(max(k,m)):
if i*2 < len(a):
m1.append(a[2*i])
for i in range(min(k,m)):
if 2*i + 1 < len(a):
k1.append(a[2*i+1])
... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | def solve():
n = int(input())
a = input().split()
for i in range(2 * n):
a[i] = int(a[i])
a.sort()
print(a[n] - a[n - 1])
t = int(input())
while t != 0:
t -= 1
solve()
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
void call() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
void solve() {
long long n;
cin >> n;
long long x = 2 * n;
long long a[x];
for (long long i = 0; i < x; i++) cin >> a[i];
sort(a, a + 2 * n);
cout << abs(a[n] - a[n - 1]) << "\n";
}
i... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for _ in range(int(input())):
n = int(input())
a = list(map(int,input().split()))
a.sort()
A = a[0:n]
B = a[n:]
print(B[0]-A[-1]) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
int t, n, a[200000];
int main() {
scanf("%d", &t);
while (t--) {
scanf("%d", &n);
for (int i = 0; i < 2 * n; i++) scanf("%d", a + i);
sort(a, a + 2 * n);
printf("%d\n", abs(a[n - 1] - a[n]));
}
return 0;
}
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for i in range(int(input())):
n = int(input())
l = list(map(int,input().split()))
l.sort()
print(l[n] - l[n-1])
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | n = int(input())
for _ in range(n):
k = int(input())
a = list(map(int, input().split()))
a.sort()
print(a[k] - a[k - 1])
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | t=int(input())
for i in range(t):
n=int(input())
L=list(map(int,input().split()))
L.sort()
print(abs(L[n]-L[n-1]))
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long t;
cin >> t;
while (t--) {
long long n, i;
cin >> n;
long long a[2 * n + 1];
for (i = 1; i <= 2 * n; i++) cin >> a[i];
sort(a + 1, a + 1 + 2 * n);
cout << a[n + 1] - a[n] << "\n";
}
}
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
int a[200001];
int n;
int test;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> test;
for (int tt = 1; tt <= test; tt++) {
cin >> n;
for (int i = 1; i <= 2 * n; i++) cin >> a[i];
long long ans = 1e9;
sort(a + 1, a + 2 * n... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | import java.io.*;
import java.math.BigInteger;
import java.util.*;
//Mann Shah [ DAIICT ].
//fast io
public class Main {
static int mod = (int) (1e9+7);
static long N = (long)(2*1e5);
static InputReader in;
static PrintWriter out;
public static void main(String args[] ) {
in = new InputReader... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | n=int(input())
for _ in range(n):
a=int(input())
L=(input()).split()
L2=[]
for i in range(2*a):
x=int(L[i])
L2.append(x)
L2.sort()
if L2[a-1]-L2[a]<0:
print(L2[a]-L2[a-1])
else:
print(L2[a-1]-L2[a])
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | import sys
import math
from collections import defaultdict
from collections import deque
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : list(map(int, input().split()))
go = lambda : 1/0
def write(*args, sep="\n"):
for i in args:
... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | # -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
def main():
for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
print(arr[n] - arr[n - 1])
if __name__ == '__main__':
main()
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for _ in range(int(input())):
n = int(input())
arr = list(sorted(map(int, input().split())))
print(abs(arr[n] - arr[n-1])) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
long long mod(long long a, long long b) { return (b + (a % b)) % b; }
long long subMod(long long a, long long b, long long M) {
return mod((mod(a, M) - mod(b, M)), M);
}
void solve() {
long long t, n;
cin >> t;
while (t--) {
cin >> n;
vector<long long> a(2 *... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | def process(A):
n = len(A)
A = sorted(A)
if n==2:
return A[1]-A[0]
a1 = A[n//2-1]
a2 = A[n//2]
return (a2-a1)
t = int(input())
for i in range(t):
n = int(input())
A = [int(x) for x in input().split()]
print(process(A)) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, m, x, i, j, e, c = 0, t;
scanf("%lld", &t);
while (t--) {
vector<long long int> a;
scanf("%lld", &n);
n = n * 2;
for (i = 0; i < n; i++) {
cin >> e;
a.push_back(e);
}
sort(a.begin(), a.end());
m = a... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | from __future__ import division, print_function
import os,sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
from __builtin__ import xrange as range
from future_builtins import ascii, filter, hex, map, oct, zip
def ii(): return int(input())
def si(): return input()
def mi(): return map(int,inpu... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | import java.util.*;
import java.io.*;
import java.io.IOException;
public class Main
{
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)
{
... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for _ in range(int(input())):
n=int(input())
a=[int(x) for x in input().split()]
a.sort()
print(a[n]-a[n-1]) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for _ in range(int(input())):
n = int(input())
arr = [int(g) for g in input().split(' ')]
sortedarr = sorted(arr)
print(sortedarr[n]-sortedarr[n-1])
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long t;
cin >> t;
while (t--) {
solve();
}
return 0;
}
void solve() {
long long n;
cin >> n;
long long arr[2 * n];
for (int i = 0; i < 2 * n; i++) {
cin >> arr[... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for _ in range(int(input())):
N, X = int(input()), sorted(list(map(int, input().split())))
print(X[N] - X[N - 1])
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for _ in range(int(input())):
n=int(input())
a=sorted([int(i) for i in input().split()])
print(a[n]-a[n-1])
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | #include <bits/stdc++.h>
using namespace std;
void FIO() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int32_t main() {
FIO();
long long int x;
cin >> x;
while (x--) {
long long int n;
cin >> n;
n = 2 * n;
long long int arr[n];
for (long long int i = 0; i < n; i++) {
... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | def iinput():
return [int(x) for x in input().split()]
def main():
n = int(input())
data = iinput()
data.sort()
return abs(data[n] - data[n - 1])
for t in range(int(input())):
print(main()) |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | import sys
t=int(input())
for i in range(t):
n=int(input())
arr=list(eval(input().replace(' ',',')))
if type(arr) is int:
arr=[arr]
arr.sort()
print(arr[n]-arr[n-1])
sys.stdout.flush()
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... |
import math
import functools
def calculate(data):
data.sort()
# print(data)
middle = len(data)//2
# print(middle)
value = abs(data[middle] - data[middle-1])
return value
T = int(input())
for i in range(T):
length = int(input())
data = list(map(int,input().spli... |
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | t = int(input())
for iii in range(t):
n = int(input())
a = sorted(list(map(int, input().split())))
print(a[n] - a[n-1])
|
Problem: Reminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted order. Then median of this array is equal to b_{k+1}.
There are 2n students, the i-th st... | for _ in range(int(input())):
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
print(a[n]-a[n-1]) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.