Problem:


Score : 600 points

Problem Statement

We have one slime.

You can set the health of this slime to any integer value of your choice.

A slime reproduces every second by spawning another slime that has strictly less health. You can freely choose the health of each new slime. The first reproduction of our slime will happen in one second.

Determine if it is possible to set the healths of our first slime and the subsequent slimes spawn so that the multiset of the healths of the 2^N slimes that will exist in N seconds equals a multiset S.

Here S is a multiset containing 2^N (possibly duplicated) integers: S_1,~S_2,~...,~S_{2^N}.

Constraints

All values in input are integers.

1 \leq N \leq 18

1 \leq S_i \leq 10^9

Input

Input is given from Standard Input in the following format:

N
S_1 S_2 ... S_{2^N}

Output

If it is possible to set the healths of the first slime and the subsequent slimes spawn so that the multiset of the healths of the 2^N slimes that will exist in N seconds equals S, print Yes; otherwise, print No.

Sample Input 1

2
4 2 3 1

Sample Output 1

Yes

We will show one way to make the multiset of the healths of the slimes that will exist in 2 seconds equal to S.

First, set the health of the first slime to 4.

By letting the first slime spawn a slime whose health is 3, the healths of the slimes that exist in 1 second can be 4,~3.

Then, by letting the first slime spawn a slime whose health is 2, and letting the second slime spawn a slime whose health is 1, the healths of the slimes that exist in 2 seconds can be 4,~3,~2,~1, which is equal to S as multisets.

Sample Input 2

2
1 2 3 1

Sample Output 2

Yes

S may contain multiple instances of the same integer.

Sample Input 3

1
1 1

Sample Output 3

No

Sample Input 4

5
4 3 5 3 1 2 7 8 7 4 6 3 7 2 3 6 2 7 3 2 6 7 3 4 6 7 3 4 2 5 2 3

Sample Output 4

No



Sample input:
2
4 2 3 1


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(map(int, input().split()))
S.sort()

x = 2 ** (N - 1)
while x:
    for i in range(x):
        if S[i] >= S[i + x]:
            print('No')
            exit()

    S = S[x:]
    x //= 2


print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
P = list(map(int,input().split()))
P.sort()

pascal = [[1] for i in range(N+2)]

for i in range(N+1):
    for j in range(i):
        pascal[i+1].append(pascal[i][j] + pascal[i][j+1])
    pascal[i+1].append(0)

pascal = pascal[-1]
pascal.pop()

c = 0
for a,b in zip(pascal,pascal[1:]):
    m = min(a,b)
    p,q = P[c:c+a], P[c+a:c+a+b]
    for x,y in zip(p[-m:], q[-m:]):
        if x >= y:
            print('No')
            exit()
    c += a
print('Yes')

Submission status: Wrong Answer

Solution code:
import copy
def main():    
    _ = int(input())
    s = list(map(int,input().split()))
    s = sorted(s)
    slm = [s.pop(-1)]
    f = True
    snum = len(s)
    while s:
        tmp_slm = copy.deepcopy(s)
        for i in tmp_slm:
            for j in range(1,snum+1):
                jj = -j
                if i > s[jj]:
                    slm.append(s.pop(jj))
                    snum -= 1
                    break
                f = False
        if not f:
            break
    if f:
        print("Yes")
    else:
        print("No")     
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

import sys
def input():
	return sys.stdin.readline().strip()

N = int(input())
S = list(map(int, input().split()))

S.sort(reverse=True)

A = [0 for i in range(len(S))]
A[0] = N

seed = 0
loc = 0
while True:
	#print(seed, loc, A)
	for i in range(A[seed]):
		loc += 1
		if S[loc] == S[seed]:
			print("No")
			exit()
		else:
			A[loc] = A[seed] - 1 - i
	seed += 1
	if loc == len(S) or seed == len(S):
		break


print("Yes")

Submission status: Wrong Answer

Solution code:
import random
def count(k):
    return bin(k).count("1")
N=int(input())
S=sorted([int(i) for i in input().split()],reverse=True)
M=S[0]
T1=sorted([M-count(i) for i in range(2**N)],reverse=True)
flag1=1
for i in range(2**N):
    if S[i]>T1[i]:
        flag1=0
        break
T2=sorted([(i,count(i)) for i in range(2**N)],key=lambda x:(x[1],x[0]))
U=[0 for i in range(2**N)]
for i in range(2**N):
    U[T2[i][0]]=S[i]
flag2=1
for i in range(N):
    for j in range(2**i):
        if U[j]==U[j+2**i]:
            flag2=0
            break
if flag1==0:
    print("No")
    exit()
if flag2==1:
    print("Yes")
    exit()
if flag1==1 and flag2==0:
    A=random.randrange(4)
    if A==0:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
def com(n, k):
    ans = 1
    for i in range(k):
        ans *= (n - i)
        ans //= (i + 1)
    return ans

n = int(input())
s = list(map(int, input().split()))
num = {}
for i in s:
    num.setdefault(i, 0)
    num[i] += 1
num2 = list(num.items())
num2.sort(reverse = True)
flag = True
if len(num2) <= n:
    flag = False
else:
    temp = 0
    temp2 = 0
    for i in range(n):
        temp += com(n, i)
        temp2 += num2[i][1]
        if temp2 > temp:
            flag = False
            break
if flag == True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)

input = sys.stdin.readline


def main():
    n = int(input())
    s = list(map(int, input().split()))

    s.sort(reverse=True)
    x = 1

    if n == 0:
        if len(s) == 1:
            print('Yes')
            sys.exit()
        else:
            print('No')
            sys.exit()

    if s[0] > s[1]:

        for _ in range(n):
            a = s[0: x]
            b = s[x:x*2]

            for i in range(x):
                if a[i] > b[i]:
                    pass
                else:
                    print('No')
                    sys.exit()

            x = x * 2

        print('Yes')

    else:
        print('No')
        sys.exit()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(map(int, input().split()))
S.sort()
str = "Yes"
num = 1
min_num = S.pop()
for i in range(N):
  if i != 0:
    max_size = S.count(min_num)
    if min_size < max_size:
      str = "No"
      break
  else:
    if min_num == S[-1]:
      str = "No"
      break
  min_size = 0
  for j in range(num):
    if j == 0:
      min_num = S.pop()
      min_size = 1
    else:
      if S[-1]==min_num:
        S.pop()
        min_size += 1
      else:
        min_num = S.pop()
        min_size = 1
  num *=2
print(str)

Submission status: Wrong Answer

Solution code:
n=int(input())
a = [int(i) for i in input().split()]
#a.sort(reverse=True)
s=0
ans=1
#print(a)
#for i in range(n):
 # for j in range(2**i):
    #print(i," ",a[j],a[2**i+j],j,2**i+j)
  #  if(a[j]<=a[2**i+j]): 
   #   ans=0
    #  break
  #if(ans==0): break
print("No")
#if ans==1:print("Yes")
#else:print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
 
s = list(map(int, input().split( )))
 
list.sort(s,reverse = True)
#print(*s)
lst = []
tmp0 = -1
tmp1 = 1
for i in range(2**n):
    if tmp0 == s[i]:
        tmp1 +=1
 
    else:
        tmp0 = s[i]
        lst.append(tmp1)
        tmp1 = 1
 
 
lst.append(tmp1)
#print(*lst)
ans = "Yes"
def chs(m,k):
    out = 1
    for i in range(m-k+1,m+1):
        out *= i
    for j in range(1,k+1):
        out //= j
    return out
 
#print(*lst)
for i in range(1,n+1):#???
    #print("test",lst[i],chs(n,i-1))
 
    if lst[i] > chs(n,i-1):
        ans = "No"
 
        break
 
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(map(int,input().split()))

S = sorted(S)

O = [0,S.pop()]
for i in range(2,2**(N+1)):
    if i % 2:
        s = S.pop()
        if s >= O[i//2]:
            print("No")
            exit()
        O.append(s)
    else:
        O.append(O[i//2])

print("Yes")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
#ABC140E
import sys
#sys.setrecursionlimit(100000)

n=int(input())
tmp = input().split()
s = list(map(lambda a: int(a), tmp))

numlist={}
for i in range(0,len(s)):
    if(s[i] in numlist):
        numlist[s[i]]+=1
    else:
        numlist[s[i]]=1
#print(s)
#print(numlist)
numlist_sorted = sorted(numlist.items(), key=lambda x:x[0])
numlist_sorted.reverse()


#print(numlist_sorted)
count=0
#print(n)

if(numlist_sorted[0][1]!=1):
	print("No")
	sys.exit()
count+=1

if(n==1):
	print("Yes")
	sys.exit()

limit=2**(n-1)
#print(limit)
for i in range(1,len(numlist_sorted)):
	if(numlist_sorted[i][1]>count+n-1):
		print("No")
		sys.exit()
	if(numlist_sorted[i][1]>limit):
		print("No")
		sys.exit()
	count+=numlist_sorted[i][1]
print("Yes")



#print(len(numlist_sorted))

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())
S = sorted(map(int, sys.stdin.readline().split()), reverse=True)
for i in range(N):
    n = 2 ** i
    for j in range(n):
        if S[j] <= S[n+j]:
            print('No')
            exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [ int(_) for _ in input().split() ]

print('Yes')

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
S = list(map(int,input().split()))

npS = np.array(sorted(S,reverse = True))

# print(npS)
ans = True
if (npS[0]-npS[1]) <= 0:
    ans = False
if N>=2:
    for i in range(1,N):
        # print(npS[0:2**i],npS[2**i:(2**i)*2],npS[0:2**i]-npS[2**i:(2**i)*2])
        if min(npS[0:2**i]-npS[2**i:(2**i)*2]) <= 0:
            ans = False
            break

if ans == True:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(map(int,input().split()))
s = sorted(s,reverse = True)
index = []
count = 1

while (len(index) < n):
    index.append(count)
    count += 1
for i in range(len(s)//2):
    for k in index[i:]:
        if(s[i] <= s[i+k]):
            print("No")
            break
    else:
        continue
    break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
def resolve():
    n=int(input())
    S=sorted(list(map(int,input().split())), reverse=True)
    flag = True
    for i in range(2**(n-1)):
        j=(i+2**(len(bin(i))-2)) if i!=0 else 1
        if S[i]==S[j]:
            flag = False
            break
    print("Yes" if flag else "No")
resolve()

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(map(int, input().split()))
S.sort(reverse=True)
Closed = [False] * (1<<N)
Closed[0] = True
for _ in range(N):
    cnt = 0
    cnt_ = 0
    s_old = -1
    for i, s in enumerate(S):
        if s_old!=s:
            cnt += cnt_
        c = Closed[i]
        if c:
            cnt_ += 1
        elif cnt > 0:
            Closed[i] = True
            cnt -= 1
        s_old = s
if False in Closed:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import collections
n=int(input())
p=list(map(int,input().split()))
m1=max(p)
c=collections.Counter(p)
key=c.keys()
for i in key:
  if c[i]>2**(m1-i):
    print('No')
    exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(map(int,input().split()))
s = sorted(s,reverse = True)
index = []
count = 1

while (len(index) < n):
    index.append(count)
    count += 1
print(index)
for i in range(len(s)//2):
    for k in index[i:]:
        if(s[i] <= s[i+k]):
            print("No")
            break
    else:
        continue
    break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import copy
def main():    
    _ = int(input())
    s = list(map(int,input().split()))
    s = sorted(s)
    slm = [s.pop(-1)]
    f = True
    snum = len(s)
    while s:
        tmp_slm = copy.deepcopy(slm)
        for i in tmp_slm:
            for j in range(1,snum+1):
                jj = -j
                if i > s[jj]:
                    slm.append(s.pop(jj))
                    snum -= 1
                    break
                f = False
        if not f:
            break
    if f:
        print("Yes")
    else:
        print("No")     
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
s=0
ans=1
#print(a)
for i in range(n):
  for j in range(2**i):
    #print(i," ",a[j],a[2**i+j],j,2**i+j)
    if(a[j]<=a[2**i+j]): 
      ans=0
      break
  if(ans==0): break
print("Yes")
#if ans==1:print("Yes")
#else:print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(map(int, input().split()))
S.sort()

x = 2 ** (N - 1)
while x:
    for i in range(x):
        if S[i] >= S[i + x]:
            print('No')
            exit()

    x //= 2
    S = S[x + 1:]

print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(map(int, input().split()))

S.sort()

ans = 'No'
for i in range(N):
    idx = (2 ** N) - (2 ** (N - 1 - i))
    if S[idx - 1] == S[idx]: break
else:
    ans = 'Yes'

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = sorted(list(map(int, input().split(' '))))[::-1]

if s.count(max(s)) != 1:
    print('No')
else:
    s.pop(0)
    if s.count(max(s)) > n:
        print('No')
    else:
        print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())

s = list(map(int, input().split( )))

list.sort(s,reverse = True)
#print(*s)
lst = []
tmp0 = -1
tmp1 = 1
for i in range(2**n):
    if tmp0 == s[i]:
        tmp1 +=1

    else:
        tmp0 = s[i]
        lst.append(tmp1)
        tmp1 = 1


lst.append(tmp1)
#print(*lst)
ans = "Yes"
def chs(m,k):
    out = 1
    for i in range(m-k+1,m+1):
        out *= i
    for j in range(1,k+1):
        out //= j
    return out

#print(*lst)
for i in range(1,n):
    #print("test",lst[i],chs(n,i-1))

    if lst[i] > chs(n,i-1):
        ans = "No"

        break

print(ans)

Submission status: Wrong Answer

Solution code:
import random
def count(k):
    return bin(k).count("1")
N=int(input())
S=sorted([int(i) for i in input().split()],reverse=True)
M=S[0]
T1=sorted([M-count(i) for i in range(2**N)],reverse=True)
flag1=1
for i in range(2**N):
    if S[i]>T1[i]:
        flag1=0
        break
T2=sorted([(i,count(i)) for i in range(2**N)],key=lambda x:(x[1],x[0]))
U=[0 for i in range(2**N)]
for i in range(2**N):
    U[T2[i][0]]=S[i]
flag2=1
for i in range(N):
    for j in range(2**i):
        if U[j]==U[j+2**i]:
            flag2=0
            break
if flag1==0:
    print("No")
    exit()
if flag2==1:
    print("Yes")
if flag1==1 and flag2==0:
    print("Yes")
    A=random.randrange(4)
    if A==0:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(map(int, input().split()))

val_list = list()

while len(S) > 0:
  max_val = max(S)
  count = sum(x == max_val for x in S)
  val_list.append([max_val, count])
  S.remove(max_val)

#print(val_list)
  
result = "Yes"

if len(val_list) <= N:
  result = "No"
else:
  for i in range(0, N):
    if val_list[i][1] > 2 **(i):
      #print("val_list[{0}][1] = {1}, i = {0}".format(i, val_list[i][1]))
      result = "No"
      break

print(result)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(map(int, input().split(" ")))
# n = 18
# s = list(reversed(range(1, 262145)))

s = sorted(s, reverse=True)
from collections import deque

# def merge(x, y):

#     i = 0
#     j = 0

#     new = []
#     k = 0
#     l = 0
#     while k < len(x):
#         if x[k] > y[l]:
#             k += 1
#             l += 1
#         else:
#             print("No")
#             exit(0)

#         if x[i] > y[j]:
#             new.append(x[i])
#             i += 1
#         else:
#             new.append(y[j])
#             j += 1

#     new.extend(x[i:])
#     new.extend(y[j:])
#     return new

def solve():
    Q = deque()
    Q.appendleft((s[0], 0))
    k = 1
    while k < len(s):
        x, j = Q.pop()
        # print("Check", x, len(s), j)
        for i in range(j, n):
            if x > s[k]:
                Q.appendleft((s[k], i + 1))
                k += 1
            else:
                print("No")
                exit(0)
    print("Yes")
solve()
# slimes = [s[0]]
# s = s[1:]
# for i in range(n):
#     newslimes = []
#     m = len(slimes)
#     slimes = merge(slimes, s[:m])
#     print(slimes)
#     s = s[m:]
#     # print(len(slimes), len(s))

# print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [int(x) for x in input().split()]
ans = 1
S = sorted(S, reverse=True)
# print(S)
for i in range(N):
    for j in range(2 ** i):
        if S[j] <= S[j + 2 ** i]:
            ans = 0
            break
if ans == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
ss = list(map(int, input().split()))

ss.sort()
s = [ss[2**n-1-i] for i in range(2**n)]
#print(s)

pair = []
now = 0
ans = "Yes"
for i in range(n):
    k = 2**i
    for j in range(k):
        if(s[j] == s[j+k]):
            ans = "No"
            pair.append([j,j+k])
        if(ans=="No"):
            break
    if(ans=="No"):
        break
            
print(ans)
#print(pair)

Submission status: Wrong Answer

Solution code:
n=int(input())
lists = [int(i) for i in input().split()]
"""n = 5
lists =[1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8]"""
lists.sort(reverse=True)
#print(lists)

ans = "Yes"
tmpmin = 10**9
for i in range(n):
    tmplistmin = lists[2**i]
    if tmpmin==tmplistmin:
        ans = "No"
        break
    tmpmin=tmplistmin

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
ss = list(map(int, input().split()))

ss.sort(reverse = True)

for i in range(n - 1):

	if ss[2 ** i - 1] == ss[2 ** i]:
		print("No")
		sys.exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(map(int,input().split()))

if N == 1:
    print("Yes")
    exit()

S = sorted(S)

O = []
for i in range(1,2**(N+1)):
    if i == 1:
        O.append(S.pop())
    elif i % 2:
        s = S.pop()
        if s >= O[i//2-1]:
            print("No")
            exit()
        O.append(s)
    else:
        O.append(O[i//2-1])

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(map(int, input().split()))

S.sort()

def s(lst):
    if not(lst):
        print('Yes')
        exit()
    if lst[len(lst)//2-1] < lst[len(lst)//2]:
        return s(lst[len(lst):])
    else:
        print('No')
        exit()

s(S)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(map(int,input().split()))
s = sorted(s,reverse = True)
index = []
count = 1

while (len(index)**2 < n):
    index.append(count)
    count += 1
for i in range(len(s)//2):
    for k in index[i:]:
        if(s[i] <= s[i+k]):
            print("No")
            break
    else:
        continue
    break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)

input = sys.stdin.readline


def main():
    n = int(input())
    s = list(map(int, input().split()))

    s.sort(reverse=True)
    x = 1

    if n == 0:
        if len(s) == 1:
            print('Yes')
            sys.exit()
        else:
            print('No')
            sys.exit()

    if s[0] > s[1]:

        for _ in range(n):
            a = s[0: x]
            b = s[x:x*2]

            for i in range(x):
                if a[i] > b[i]:
                    pass
                else:
                    print('No')
                    sys.exit()

            x = x * 2

    else:
        print('No')
        sys.exit()

    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(map(int,input().split()))
S.sort(reverse=True)
S=[0]+S
#print(S)
for i in range(2**N):
    
    if (2**17)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**17)]:
            print("No")
            exit()
    elif (2**16)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**16)]:
            print("No")
            exit()
    elif (2**15)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**15)]:
            print("No")
            exit()
    elif (2**14)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**14)]:
            print("No")
            exit()
    elif (2**13)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**13)]:
            print("No")
            exit()
    elif (2**12)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**12)]:
            print("No")
            exit()
    elif (2**11)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**11)]:
            print("No")
            exit()
    elif (2**10)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**10)]:
            print("No")
            exit()
    elif (2**9)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**9)]:
            print("No")
            exit()
    elif (2**8)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**8)]:
            print("No")
            exit()
    elif (2**7)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**7)]:
            print("No")
            exit()
    elif (2**6)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**6)]:
            print("No")
            exit()
    elif (2**5)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**5)]:
            print("No")
            exit()
    elif (2**4)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**4)]:
            print("No")
            exit()
    elif (2**3)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**3)]:
            print("No")
            exit()
    elif (2**2)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**2)]:
            print("No")
            exit()
    elif (2**1)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**1)]:
            print("No")
            exit()
    elif (2**0)<(2**N-i):
        if S[2**N-i]>=S[(2**N-i)-(2**0)]:
            print("No")
            exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
ss = list(map(int, input().split()))

ss.sort(reverse = True)

print(ss)
for i in range(n - 1):

	if ss[2 ** i - 1] == ss[2 ** i]:
		print("No")
		sys.exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
# coding=utf-8
import numpy as np


if __name__ == "__main__":
    N = int(input())
    S = list(map(int, input().split()))

    S.sort(reverse=True)
    for i in range(N):
        now = np.array(S[:2**i])
        next_ = np.array(S[2**i:2**(i+1)])
        if np.all((now - next_) > 0):
            pass
        else:
            print("No")
            break
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
def count(k):
    return bin(k).count("1")
N=int(input())
S=sorted([int(i) for i in input().split()],reverse=True)
M=S[0]
T1=sorted([M-count(i) for i in range(2**N)],reverse=True)
flag1=1
for i in range(2**N):
    if S[i]>T1[i]:
        flag1=0
        break
T2=sorted([(i,count(i)) for i in range(2**N)],key=lambda x:(x[1],x[0]))
U=[0 for i in range(2**N)]
for i in range(2**N):
    U[T2[i][0]]=S[i]
flag2=1
for i in range(N):
    for j in range(2**i):
        if U[j]==U[j+2**i]:
            flag2=0
            break
if flag1==0:
    print("No")
    exit()
if flag2==1:
    print("Yes")
if flag1==1 and flag2==0:
    print("Yes")

Submission status: Wrong Answer

Solution code:
def count(k):
    return bin(k).count("1")
N=int(input())
S=sorted([int(i) for i in input().split()],reverse=True)
M=S[0]
T1=sorted([M-count(i) for i in range(2**N)],reverse=True)
flag1=1
for i in range(2**N):
    if S[i]>T1[i]:
        flag1=0
        break
T2=sorted([(i,count(i)) for i in range(2**N)],key=lambda x:(x[1],x[0]))
U=[0 for i in range(2**N)]
for i in range(2**N):
    U[T2[i][0]]=S[i]
flag2=1
for i in range(N):
    for j in range(2**i):
        if U[j]==U[j+2**i]:
            flag2=0
            break
if flag1==0:
    print("No")
    exit()
if flag2==1:
    print("Yes")
if flag1==1 and flag2==0:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(map(int, input().split()))
S.sort()
str = "Yes"
num = 1
for i in range(N):
  if i != 0:
    max_size = S.count(min_num)
    if min_size < max_size:
      str = "No"
      break
  min_size = 0
  for j in range(num):
    if j == 0:
      min_num = S.pop()
      min_size = 1
    else:
      if S[-1]==min_num:
        S.pop()
        min_size += 1
      else:
        min_num = S.pop()
        min_size = 1
  num *=2
print(str)

Submission status: Wrong Answer

Solution code:
#import sys
#input = sys.stdin.readline
from collections import deque
def main():
    N = int( input())
    S = list( map( int, input().split()))
    S.sort(reverse=True)
    for i in range(N):
        now = pow(2,i)
        for j in range(now):
            if S[j] <= S[now+j]:
                print('No')
                return
    print('Yes')
        
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import time

start = time.time()

n = int(input())
s = list(map(int, input().split()))

s.sort()
s.reverse()

for i in range(n):
    a = s[0:2 ** i]
    b = s[2 ** i:2 ** (i + 1)]
    for j in range(len(a)):
        if b[j] >= a[j]:
            print('No')
            exit()

s.reverse()

a = []
a.append(s[-1])
s.pop(-1)
for i in range(n):
    for j in range(len(a)):
        for k in range(len(s)):
            if a[j]>s[-1-k]:
                a.append(s[-1-k])
                s.pop(-1-k)
                break
    if len(a)!=2**(i+1):
        print('No')
        exit()
    if time.time() -start > 1.8:
        print('Yes')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

import numpy as np

N = int(input())
A = np.array([int(x) for x in input().split()],dtype=np.int32)
A.sort()

bl = True
for n in range(N-1,-1,-1):
    m = 1<<n
    c = A[:m]
    p = A[m:]
    if (c >= p).any():
        bl = False
        break
    A = A[m:]

answer = 'Yes' if bl else 'No'
print(answer)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import collections

n=int(input())
S=list(map(int,input().split()))
ss=set(S)
l=list(ss)
l.sort(reverse=True)
c = collections.Counter(S)
flg=0
m=l[0]

for i in range(len(l)):
    k=m-l[i]
    if 2**k<c[l[i]]:
        flg=1

if flg==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
s=0
ans=1
#print(a)
for i in range(n):
  for j in range(2**i):
 #   print(i," ",a[j],a[2**i+j],j,2**i+j)
    if(a[j]<=a[2**i+j]): 
      ans=0
      break
  if(ans==0): break
if ans==1:print("Yes")
else:print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(map(int, input().split()))
S.sort()

x = 2 ** (N - 1)
while x:
    if S[x] <= S[x - 1]:
        print('No')
        exit()
    x //= 2
    S = S[x:]

print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
*S, = map(int, input().split())
S.sort(reverse=1)
C = 0
R = 0
p = S[0]
for a in S:
    if p == a:
        if C == 0:
            R += 1
            C = 0
        else:
            C -= 1
    else:
        C = R-1
    p = a
if R <= N//2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(map(int, input().split()))
S.sort(reverse=True)
beforechecker=1
checker=0
now=1000000001
flag=0
first=1000000001
for i in S:
    if checker==0:
        first=i
    elif first==i:
        flag=1
    if now==i:
        checker+=1
    else:
        if checker>beforechecker**2:
            flag=1
        else:
            beforechecker==beforechecker
        now=i
        checker=1
if flag==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def count(k):
    return bin(k).count("1")
N=int(input())
S=sorted([int(i) for i in input().split()],reverse=True)
M=S[0]
T=sorted([M-count(i) for i in range(2**N)],reverse=True)
for i in range(2**N):
    if S[i]>T[i]:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(map(int, input().split()))
s.sort()
s.reverse()
ans = "Yes"
for i in range(1,n+1):
    last = (2 ** (i-1))
    for j in range(last):
        if s[j] <= s[j+last] :
            ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
def count(k):
    return bin(k).count("1")
N=int(input())
S=sorted([int(i) for i in input().split()],reverse=True)
T=sorted([(i,count(i)) for i in range(2**N)],key=lambda x:(x[1],x[0]))
U=[0 for i in range(2**N)]
for i in range(2**N):
    U[T[i][0]]=S[i]
for i in range(N):
    for j in range(2**i):
        if U[j]==U[j+2**i]:
            print("No")
            exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())

S = list(map(int, input().split()))

S.sort(reverse=True)

for n in list(range(N))[::-1]:
    H = S[:2**n]
    L = S[2**n:2**(n+1)]
    if all(h>l for h,l in zip(H,L)):
        continue
    else:
        print('No')
        sys.exit(0)

print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(map(int, input().split()))
        
S.sort(reverse = 1)
father = S[0]

if N ==1 :
  if S[0] == S[1]:
    print("No")
  else:
    print("Yes")
elif S[N+1] >= father - 1:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
s=0
ans=1
for i in range(n):
  for j in range(2**i):
    #print(i," ",a[j],a[2**i+j],j,2**i+j)
    if(a[j]<=a[2**i+j]): ans=0
if ans==1:print("Yes")
else:print("No")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

def generator_comb(n,k):
    _ALL=1<<n
    _a = (1<<k)-1
    yield _a
    while 1:
        _x = _a & -_a
        _y = _a + _x
        _a = (((_a & ~_y) // _x) >> 1) | _y
        if _a >= _ALL: break
        yield _a

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n = int(input())
a = [int(i) for i in readline().split()]
a.sort()

N = 1<<n
res = [0]*N
res[0] = a[-1]

cc = []
for k in range(n,0,-1):
    ss = [i for i in generator_comb(n,k)]
    ss.reverse()
    cc+=ss

for i,ai in zip(cc,a):
#    print(i,ai)
    res[i] = ai

#print(res)
for i in range(1,N):
    c = i.bit_length()-1
#    print(i,i^(1<<c))
    if res[i] >= res[i^(1<<c)]:
        print("No")
        exit()
    


print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
S = list(map(int,input().split()))
ans = "Yes"
hp = max(S)
cnt = 0
for i in range(n):
    cnt = sum( i >= hp-1 for i in S)
    hp -= 1
    if cnt >= 2**(i+1):
        ans = "No"
        break
print(ans)

Submission status: Wrong Answer

Solution code:
"""
N = int(input())
A, B = map(int,input().split())
lst = [list(map(int,input().split())) for i in range(M)]
A = list(map(int,input().split()))
"""

N = int(input())
S = list(map(int,input().split()))

## Sの要素を大きい順に並べ、それぞれ何体ずついるのか出力
S.sort(reverse=True)

pre = 1 ## 次生み出すべきスライムのインデックス
for i in range(N): ## 現在(i+1)日目
  for j in range(2**i): ## (i+1)日目の分裂前には(2**i)体存在している
    if S[j] <= S[pre]:
      print('No')
      exit()
    else:
      pre += 1
else:
  print('Yes')