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... |
for _ in range(int(input())):
n = int(input())
v = list(map(int, input().split()))
v.sort()
print(v[n] - v[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 t in range(int(input())):
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... | #author : SanskarxRawat
t=int(input())
for i in range(t):
n=int(input())
lsr=list(map(int,input().strip().split()))[:2*n]
lsr.sort()
print(lsr[n]-lsr[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... |
from sys import stdin
input=stdin.buffer.readline
t=int(input())
for i in range(t):
n=int(input())
arr=[int(x) for x in input().split()]
arr.sort()
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... | '''
Online Python Compiler.
Code, Compile, Run and Debug python program online.
Write your code in this editor and press "Run" button to execute it.
'''
t=int(input())
for i in range(t):
n=int(input())
l=list(map(int,input().split()))
l.sort()
n=n*2
prin... |
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... | //package com.company;
import java.io.*;
import java.util.*;
import java.lang.*;
public class Main{
public static class FastReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilter filter;
... |
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... | x=int(input())
for i in range(x):
m=int(input())
arr=[int(new) for new in input().split()]
arr.sort()
print(abs(arr[m]-arr[m-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()
if n%2:
print(a[2*(n//2) + 1] - a[2*(n//2) ])
else:
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... | """
Template written to be used by Python Programmers.
Use at your own risk!!!!
Owned by adi0311(rating - 1989 at CodeChef and 1435 at CodeForces).
"""
from sys import *
from bisect import bisect_left as bl, bisect_right as br, bisect # Binary Search alternative
from math import *
from time import clock 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() {
int t;
cin >> t;
for (int f = 0; f < t; ++f) {
int n;
cin >> n;
vector<int> v(2 * n);
for (int i = 0; i < 2 * n; ++i) {
cin >> v[i];
}
sort(v.begin(), v.end());
cout << abs(v[n] - v[n - 1]) << '\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... |
import java.util.*;
import static java.lang.System.out;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
public class Main
{
static int mod = 1000000007;
static final long M = (int)1e9+7;
static ... |
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,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
# import time,random,resource
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI():... |
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 main():
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]))
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... |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class B {
public static void main(String []args) throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String input;
String []splited;
long q,m,t,a,b,c,x,y,p;int n;
Long []arr,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 t;
cin >> t;
while (t--) {
long long i, j, n;
cin >> n;
vector<long long> a(2 * n);
for (i = 0; i < 2 * n; i++) cin >> a[i];
sort(a.begin(), a.end());
long long ans = a[n] - a[n - 1];
cout << ans << 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 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[2*n];
for(int i=0;i<2*n;i++){
a[i] = sc.nextInt();
}
Arrays.sort(a);
System.out.printl... |
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())
l=list(map(int,input().split()))
l.sort()
z=[]
x=l[1:]
t=l[0]
for i in range(2*n-1):
z.append(abs(t-x[len(x)//2]))
t,x[i]=x[i],t
# print(x,t)
print(min(z)) |
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 u 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... | t = int(input())
for _ in range(t):
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... | def main(n, xs):
xs = sorted(xs)
return abs(xs[n-1] - xs[n])
if __name__ == '__main__':
t = int(input())
for _ in range(t):
n = int(input())
xs = [int(x) for x in input().split()]
print(main(n, xs))
|
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(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 j in range(T):
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... | import java.util.*;
import java.lang.*;
import java.io.*;
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();
long arr[]=new long[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... | t = int(raw_input())
for teste in xrange(t):
n = int(raw_input())
a = map(int, raw_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... | t = int(input())
while(t):
t -= 1
n = int(input())
a = sorted(list(map(int, input().split())))
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... | from collections import Counter, defaultdict
from sys import stdin, stdout
raw_input = stdin.readline
pr=stdout.write
range=xrange
for t in range(input()):
n=int(raw_input())
n*=2
l=map(int,raw_input().split())
l.sort()
pos=n/2
ans=1000000000000
for i in range(n):
if i>=pos:
... |
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... | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);... |
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 x in range(t):
n=int(input())
n=n*2
a=list(map(int,input().split()))
a.sort()
m=float('inf')
for x in range(1,n,2):
s=abs(a[(x//2)+1]-a[n-((x//2)+1)-1])
if s<m:
m=s
print(m)
|
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() {
const int maxn = 1e5 + 5;
int node[2 * maxn];
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int sum = 0;
for (int i = 0; i < 2 * n; i++) {
cin >> node[i];
}
sort(node, node + 2 * n);
cout << node[n] - node[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;
long long int arr[2 * n];
for (int i = 0; i < 2 * n; i++) {
cin >> arr[i];
}
sort(arr, arr + 2 * n);
cout << (arr[n] - arr[n - 1]) << endl;
}
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... | import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
INF = 1 << 60
#ここから書き始める
t = int(input())
for i in range(t):
n = int(input())
a = list(map(int, input().split(... |
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... | /*
* Created by cravuri on 2/9/20
*/
import java.util.Arrays;
import java.util.Scanner;
public class AssigningToClasses {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int t = 0; t < T; t++) {
int N = sc.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... | t = int(input())
for p in range(t):
n = int(input())
lis = list(map(int,input().split()))
lis.sort()
print(lis[n] - lis[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, n, ans, i, j, k;
cin >> t;
for (i = 0; i < t; i++) {
cin >> n;
int x[2 * n];
for (j = 0; j < 2 * n; j++) cin >> x[j];
sort(x, x + 2 * n);
ans = x[n] - x[n - 1];
cout << ans << endl;
}
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... | import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;
import java.util.Arrays;
import java.util.Comparator;
public class 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... | # quite easy - have one class of size 1
t = int(input())
for x in range(t):
n = int(input())
l1 = [int(x) for x in input().split()]
l1.sort()
print(l1[n]-l1[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 test in range(t) :
num_half_students = int(input())
skill_students = list( map (int, input().split()))
skill_students.sort()
print(skill_students[num_half_students] - skill_students[num_half_students-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... | #Bhargey Mehta (Junior)
#DA-IICT, Gandhinagar
import sys, math
MOD = 998244353
#sys.stdin = open('input.txt', 'r')
def diff(x, y):
return abs(x[len(x)//2] - y[len(y)//2])
for i in range(int(input())):
n = int(input())
a = sorted(map(int, input().split()))
x, y = [], []
for i in range(n):
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... | y=input
for i in[0]*int(y()):
n=int(y())
l=sorted(map(int,input().split()))
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... | for _ in range(int(input())):
l= []
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() {
int t;
cin >> t;
for (int i = 0; i < t; i++) {
int n;
cin >> n;
vector<int> b(2 * n);
for (int j = 0; j < 2 * n; j++) {
cin >> b[j];
}
sort(b.begin(), b.end());
cout << b[n] - b[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... | #include <bits/stdc++.h>
using namespace std;
int a[200005];
int read() {
int A;
bool K;
char C;
C = A = K = 0;
while (C < '0' || C > '9') K |= C == '-', C = getchar();
while (C > '/' && C < ':') A = (A << 3) + (A << 1) + (C ^ 48), C = getchar();
return (K ? -A : A);
}
int main() {
int t, n, i;
t = re... |
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
def main():
T = int(stdin.readline())
for _ in range(T):
n = int(stdin.readline())
arr = list(map(int, stdin.readline().split()))
arr.sort()
if n % 2 == 1:
stdout.write(str(arr[int(n)] - arr[int(n-1)] )+"\n")
else:
st... |
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 case_num 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 sys, collections, math, itertools, random, bisect
INF = sys.maxsize
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def input(): return sys.stdin.readline().strip()
mod = int(1e9+7)
for _ in range(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... | for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
x,y=[],[]
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... | from _collections import OrderedDict
from math import fabs
t = int(input())
while t:
t -= 1
n = int(input())
mas = [int(i) for i in input().split()]
mas.sort()
print(int(fabs(mas[n] - mas[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
tests = int(sys.stdin.readline())
for _ in range(tests):
n = int(sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().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... | # DON'T SEE RANK LIST UNTIL CONTEST IS OVER
# TRY AT FIRST ELEMINATION METHOD
# BEGIN FROM FRONT TRACK
# IF ABOVE FAILS TRY FROM BACK TRACK
# DON'T CROSS 10e8
# BELIEVE IN YOURSELF
# IT'S IS NOT PROGRAMMING IT'S MATHEMATICS
# ITS ALL ABOUT COMPERATIVE CODING
# FIND ME AT subrata1999.github.io
# COPYRIGHT Template handl... |
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 test in range(t):
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... | for ts in range(int(input())):
m=int(input())
arr=list(map(int,input().split()))
arr.sort()
class1=[arr[i] for i in range(0,len(arr),2)]
class2=[arr[i] for i in range(1,len(arr),2)]
if m%2==1:
print(abs(class1[m//2]-class2[m//2]))
else:
class1.append(class2.pop())
tem... |
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
import bisect
def st():
return list(stdin.readline().strip())
def inp():
return int(stdin.readline())
def li():
return list(map(int,stdin.readline().split()))
def mp():
return map(int,stdin.readline().split())
def pr(n):
stdout.write(str(n)+"\n")
def soe(limit):
... |
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... | q = int(input())
while q:
q += -1
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... | k=int(input())
for i in range(k):
n=int(input())
x=[int(i) for i in input().split(' ')]
x.sort()
print(abs(x[n-1]-x[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 i in range(T):
n=int(input())
A=list(map(int,input().split()))
A=sorted(A)
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 i in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
a.sort()
#print(a)
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 i in range(T):
n = int(input())
a = list(map(int, input().split(" ")))
if n > 1:
a.sort()
diff1 = a[len(a)//2]-a[len(a)//2 - 1]
#diff2 = a[len(a)//2 + 1] - a[len(a)//2]
print(diff1)
else:
print(abs(a[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... | t=int(input())
while t!=0:
t=t-1
n=int(input())
arr=list(map(int,input().strip().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... |
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class Main {
static InputStream is;
static PrintWriter out;
static String INPUT = "";
static int lenbuf = 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())
a=list(map(int,input().split()))
a.sort()
if n%2!=0 :
print(abs(a[n-1]-a[n]))
else :
print(min(abs(a[n-1]-a[n]),a[n+1]-a[n-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... | t=int(input())
for i in range(t):
n=int(input())
a=list(map(int,input().split()))
s=0
a.sort(reverse=True)
b=[]
c=[]
if n%2==1:
for i in range(0,len(a),2):
b.append(a[i])
c.append(a[i+1])
else:
for i in range(0,len(a),2):
b.append(a[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())
n=2*n
ai=list(map(int,input().split()))
ai.sort()
print(ai[(n//2)]-ai[(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... | def med(arr):
return arr[len(arr) >> 1]
def solve():
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
b1, b2 = list(), list()
for i in range(n):
b1.append(arr[2 * i])
b2.append(arr[2 * i + 1])
#print(b1)
#print(b2)
if n & 1:
return abs(med(b... |
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 _ in range(test):
a = int(input())
LIST = list(map(int,input().split()))
LIST.sort()
print(LIST[a]-LIST[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... |
import java.lang.management.LockInfo;
import java.util.*;
public class cf1300b {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
for (int tc = 0; tc < t; tc++) {
int n = in.nextInt();
Integer[] a = new Integer[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.util.*;
public class contest1 {
public static int main1(ArrayList<Integer> arr1) {
int middle = arr1.size()/2;
int middleValue = arr1.get(middle);
return (middleValue);
}
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextI... |
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 collections import Counter, defaultdict, deque
import bisect
from sys import stdin, stdout,setrecursionlimit
from itertools import repeat
import math
# sys.stdin = open('input')
# n, k = map(int, raw_input().split())
# da = map(int, raw_input().split())
# db = map(int, raw_input().split())
def main():
q = ma... |
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 [0]*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... | t=int(input())
for i in range(t):
n=int(input())
a=list(map(int,input().split()))
a.sort()
m1=a[len(a)//2]
m2=a[(len(a)//2)-1]
print(m1-m2) |
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 tc in range(int(input())):
n = int(input())
a = list(map(int, input().split(' ')))
a.sort()
ans = 10**9 + 5
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... | //
import java.math.*;
import java.util.*;
import java.io.*;
public class B {
static BufferedReader in;
static String file = "../in";
static int test = 10; // 0 for local testing, 1 for std input
static int inf = 1_000_000;
static String[] split() throws Exception
{
return in.re... |
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... | I=input
for _ in[0]*int(I()):n=int(I());a=sorted(map(int,I().split()));print(a[n]-a[n-1])
#JSR
|
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([int(x) for x in input().split()])
print(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;
const int N = 1e5 + 7;
const int INF = 2e9 + 7;
int a[N * 2];
int main() {
int T;
scanf("%d", &T);
while (T--) {
int n;
scanf("%d", &n);
for (int i = 0; i < n * 2; ++i) scanf("%d", &a[i]);
sort(a, a + n * 2);
int ans = INF;
for (int i = 0; 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 solve():
n = int(input())
m = list(map(int, input().split()))
m.sort()
print(m[n] - m[n - 1])
t = int(input())
while (t):
solve()
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())
lis = sorted(map(int,input().split()))
print(lis[n]-lis[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 _listinput(): return list(map(int,input().split(" ")))
def _input(): return int(input())
def main():
answer = ""
for test in range(_input()):
n = _input()
ints = _listinput()
ints.sort()
mindiff = abs(ints[n]-ints[n-1])
answer += str(mindiff) + "\n"
pass
p... |
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 nt in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
if n==1:
print (abs(l[0]-l[1]))
continue
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 binarylow(unsigned long long *a, int low, int high, unsigned long long k) {
int mid = (low + high) / 2;
if (low > high)
return high;
else if (a[mid] == k)
return mid;
else if (a[mid] < k)
return binarylow(a, mid + 1, high, k);
else if (a[mid] > k)
... |
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(i) for i in 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... | #include <bits/stdc++.h>
using namespace std;
int t;
int main() {
scanf("%d", &t);
while (t--) {
int n;
scanf("%d", &n);
vector<int> A(2 * n);
int sum = 0;
int zero = 0;
for (int i = 0; i < 2 * n; ++i) {
scanf("%d", &A[i]);
}
sort(A.begin(), A.end());
cout << abs(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=int(input())
y=list(map(int,input().split()))
y=sorted(y)
print(abs(y[n]-y[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 item in range(t):
n = int(input())
string = input()
lists = string.split(" ")
for x in range(2 * n):
lists[x] = int(lists[x])
lists.sort()
print(lists[n] - lists[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(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... | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
PrintWriter out = new PrintWriter(System.out);
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer tok = new StringTokenizer("");
String next() throws IOException {
if (!tok.hasMoreToke... |
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.Arrays;
import java.util.Scanner;
public class B {
private static int calcAns(int[] a) {
Arrays.sort(a);
int n = a.length / 2;
return a[n] - a[n - 1];
}
public static void main(String[] args) {
final Scanner scanner = new Scanner(System.in);
final 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... |
import java.io.*;
import java.math.*;
import java.util.*;
public class Level {
public static DS.Scanner in = new DS.Scanner();
public static void main(String[] args) {
int Q = in.nextInt();
while (Q-- > 0) {
ArrayList<Integer> afuck1 = new ArrayList<Integer>();
ArrayL... |
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 N = 200100;
int main() {
ios_base::sync_with_stdio(false);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int a[n << 1];
for (int i = 0; i < n << 1; ++i) {
cin >> a[i];
}
sort(a, a + (n << 1));
n <<= 1;
int ans = 1e9 ... |
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... | //package base;
import java.lang.reflect.Array;
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception{
//File file = new File("src/base/input.txt");
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int i, j, t, x1, x2;
... |
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(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())
l=list(map(int,input().split()))
l.sort()
c=0
a,b=[],[]
for i in range(len(l)):
if c%2==0:
a.append(l[i])
else:
b.append(l[i])
c=c+1
if n%2==0:
q=b.pop(len(b)-1)
a.append(q)
x,y=len(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())
l=[int(i) for i in input().split()]
l.sort()
#print(l)
print(abs(l[n-1]-l[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(0);
int t = 1, n, m, i, j, k, u, to;
cin >> t;
int tc = t;
while (t--) {
cin >> n;
vector<int> a(n + n);
for (auto &it : a) {
cin >> it;
}
sort(a.begin(), a.end());
cout << a[n] - 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... | import sys
# sys.setrecursionlimit(10**6)
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
def modinv(n,p):
return pow(n,p-2,p)
def cin():
return map(int,sin().split())
def ain(): #takes array as input
return list(map(int,sin().split... |
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;
import java.util.StringTokenizer;
public class AssigningtoClasses {
public static void main(String[] args) {
FastReader s = new FastReader();
int t = s.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... | import java.util.ArrayList;
import java.util.Arrays;
import java.util.*;
public class d6182
{
public static void main (String[] args)
{
Scanner sc=new Scanner(System.in);
int t,i;
t=sc.nextInt();
double st=System.nanoTime();
while(t>0)
{
t--;
int n=sc.nextInt();
int a[]=new int[2*n];
for(i=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... | t = int(input())
for case in range(t):
n = int(input())
inp = list(map(int,input().split()))
inp.sort()
ans = inp[n]-inp[n-1]
print(ans) |
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--) {
long long int n;
cin >> n;
long long int a[2 * n];
long long int i;
for (i = 0; i < 2 * n; i++) {
cin >> a[i];
}
sort(a, a + 2 * n);
cout << a[n] - a[n - 1] << endl;
}
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... | n= int(input())
for i in range(n):
t= int(input())
a= list(map(int,input().split(' ')))
a.sort()
print(a[t]-a[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... | t=int(input())
for i in range(t):
n=int(input())
s=[int(j) for j in input().split()]
s.sort()
print(s[n]-s[n-1]) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.