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:
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)

class SegTree:
  def segfunc(self, x, y):
    if x[0] >= y[0]: return x
    return y
  def __init__(self, n, ide_ele, init_val):
    #####単位元######
    self.ide_ele = ide_ele
    #num:n以上の最小の2のべき乗
    self.num = 2 ** (n - 1).bit_length()
    self.seg = [self.ide_ele] * 2 * self.num
    #set_val
    for i in range(n):
      self.seg[i + self.num - 1] = init_val[i]    
    #built
    for i in range(self.num - 2, -1, -1) :
      self.seg[i] = self.segfunc(self.seg[2 * i + 1], self.seg[2 * i + 2]) 
  def update(self, k, x):
    k += self.num - 1
    self.seg[k] = x
    while k + 1:
      k = (k - 1) // 2
      self.seg[k] = self.segfunc(self.seg[k * 2 + 1], self.seg[k * 2 + 2]) 
  def query(self, p, q):
    if q <= p:
      return self.ide_ele
    p += self.num - 1
    q += self.num - 2
    res = self.ide_ele
    while q - p > 1:
      if p & 1 == 0:
        res = self.segfunc(res, self.seg[p])
      if q & 1 == 1:
        res = self.segfunc(res, self.seg[q])
        q -= 1
      p = p // 2
      q = (q - 1) // 2
    if p == q:
      res = self.segfunc(res, self.seg[p])
    else:
      res = self.segfunc(self.segfunc(res, self.seg[p]), self.seg[q])
    return res

x = pow(2, N)
table = [0] * pow(2, N)
for i in range(pow(2, N)):
  ng = 0
  ok = x
  while ok - ng > 1:
    m = (ok + ng) // 2
    if a[i] > a[m]: ok = m
    else: ng = m
  table[i] = ok

#print(table)
seg = SegTree(x, (0, N), [(a[i], i) for i in range(x)])
for i in range(N):
  t = pow(2, i)
  for j in range(t):
    if table[j] >= x:
      print("No")
      exit(0)
    y, k = seg.query(table[j], x)
    if a[j] <= y or (y == 0):
      print("No")
      exit(0)
    seg.update(k, (0, N))
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
import heapq
input = sys.stdin.readline
hpop = heapq.heappop
hpush = heapq.heappush
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
table = [0] * pow(2, N)
h = []
for i in range(1, pow(2, N)): hpush(h, (-a[i], i))
for i in range(pow(2, N)):
  p = i + 0
  while len(h):
    if table[p] >= N: break
    _, j = hpop(h)
    table[j] = table[p] + 1
    p = j

d = [[] for _ in range(N + 1)]
for i in range(pow(2, N)): d[table[i]].append(a[i])

t = []
for i in range(N):
  t += d[i]
  t.sort(reverse = True)
  for j in range(pow(2, i)):
    if t[j] <= d[i + 1][j]:
      print("No")
      exit(0)
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
table = [0] * pow(2, N)
table[0] = 1
for i in range(1, pow(2, N)):
  j = i.bit_length() - 1
  if a[i - pow(2, j)] > a[i]: table[i] |= table[i - pow(2, j)]
  #print(i, i - pow(2, j))
if 0 in table: print("No")
else: print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(map(int,input().split()))
s.sort(reverse=True)
a = [1]+[0]*n
for i in range(n):
  for j in range(n):
    a[n-j] += a[n-1-j]
t = []
j = 0
for i in range(n+1):
  t.append(s[j:(j+a[i])])
  j += a[i]
ans = 'Yes'
for i in range(n):
  l1 = n - i
  l2 = l1
  k1 = 0
  for j in range(len(t[i])):
    if k1 >= len(t[i+1]):
      break
    k2 = k1 + l2
    x = t[i][j]
    if x <= max(t[i+1][k1:k2]+[0]):
      ans = 'No'
      break
    k1 = k2
    if l2==-1:
      l1 -= 1
      l2 = l1
    else:
      l2 -= 1
  if ans == 'No':
    break
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(map(int,input().split()))
s.sort(reverse=True)
a = [1]+[0]*n
for i in range(n):
  for j in range(n):
    a[n-j] += a[n-1-j]
t = []
j = 0
for i in range(n+1):
  t.append(s[j:(j+a[i])])
  j += a[i]
ans = 'Yes'
for i in range(n):
  k1 = 0
  for j in range(len(t[i])):
    k2 = k1 + n - i - j + 1
    x = t[i][j]
    if any([x <= y for y in t[i+1][k1:k2]]):
      ans = 'No'
      break
    k1 = k2 + 1
  if ans == 'No':
    break
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
_S = list(map(int, input().split()))
_S.sort(reverse=True)
S = [0] * (2**N)

n = [0] * (2**N)
n[0] = N
par = 0
idx = 1
while idx < 2**N:
  _n = n[par]
  for i in range(n[par]):
    _n -= 1
    n[idx] = _n
    idx += 1
  par += 1

nn = []
for i, _n in enumerate(n):
  nn.append([_n, -i])
nn.sort(reverse=True)
order = [-_n[1] for _n in nn]
for idx, s in zip(order, _S):
  S[idx] = s


par = 0
idx = 1
res = True
while idx < 2**N:
  for i in range(n[par]):
    res *= S[par] > S[idx]
    if not res:
      print('No')
      quit()
    idx += 1
  par += 1

print('Yes')

Submission status: Wrong Answer

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

n = [0] * (2**N)
n[0] = N
par = 0
idx = 1
while idx < 2**N:
  _n = n[par]
  for i in range(n[par]):
    _n -= 1
    n[idx] = _n
    idx += 1
  par += 1


par = 0
idx = 1
res = True
while idx < 2**N:
  for i in range(n[par]):
    res *= S[par] > S[idx]
    if not res:
      print('No')
      quit()
    idx += 1
  par += 1

print('Yes')

Submission status: Wrong Answer

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

n = [N] * (2**N)
idx = 1
i = 0
c = 1
while idx < 2**N:
  for _ in range(2**i):
    n[idx] = N-c
    idx += 1
  c += 1
  i += 1

par = 0
idx = 1
res = True
while idx < 2**N:
  for i in range(n[par]):
    res *= S[par] > S[idx]
    if not res:
      print('No')
      quit()
    idx += 1
  par += 1

print('Yes')

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
S = list(map(int, input().split()))
S.sort(reverse=True)
S = np.array(S)

def check(s):
  l = len(s)
  a = s[:l//2]
  b = s[l//2:]
  res = (a > b).all()
  return res, a

ans = True
while len(S) > 1:
  ans, S = check(S)
  if not ans:
    print('No')
    quit()

print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(map(int, input().split()))
s.sort(reverse=True)
idx = 0
for i in range(n):
    p = 2 ** i
    for j in range(p):
        if s[j] <= s[p + j]:
            print('No')
            exit(0)
print('Yes')

Submission status: Wrong Answer

Solution code:
import math
def cmb(n,r):
  return math.factorial(n)//(math.factorial(r)*math.factorial(n-r))
n=int(input())
a=list(map(int,input().split()))
a.sort()
ls=[0]
cnt=0
for i in range(1,2**n):
  if a[i]>a[i-1]:
    cnt+=1
  ls.append(cnt)
lmt = []
for i in range(n+1):
  lmt.extend([i]*cmb(n,i))
bias = ls[-1]-lmt[-1]
for i in range(n):
  if ls.count(i)>2**(n-i-1):
    print("No")
    exit()
for x,l in zip(ls,lmt):
  if x-l > bias:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
import math
def cmb(n,r):
  return math.factorial(n)//(math.factorial(r)*math.factorial(n-r))
n=int(input())
a=list(map(int,input().split()))
a.sort()
ls=[0]
cnt=0
for i in range(1,2**n):
  if a[i]>a[i-1]:
    cnt+=1
  ls.append(cnt)
lmt = []
for i in range(n+1):
  lmt.extend([i]*cmb(n,i))
bias = ls[-1]-lmt[-1]
for x,l in zip(ls,lmt):
  if x-l > bias:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
import math
def cmb(n,r):
  return math.factorial(n)//(math.factorial(r)*math.factorial(n-r))
n=int(input())
a=list(map(int,input().split()))
a.sort()
print(*a)
ls=[0]
cnt=0
for i in range(1,2**n):
  if a[i]>a[i-1]:
    cnt+=1
  ls.append(cnt)
lmt = []
for i in range(n+1):
  lmt.extend([i]*cmb(n,i))
bias = ls[-1]-lmt[-1]
for x,l in zip(ls,lmt):
  if x-l > bias:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
a=list(map(int,input().split()))
a.sort()
ls=[0]
cnt=0
for i in range(1,2**n):
  if a[i]>a[i-1]:
    cnt+=1
  ls.append(cnt)
for i in range(2**n):
  if i<2**n-1:
    lmt=n-int(math.log2(2**n-i-1))-1
    if ls[i]<lmt:
      print("No")
      break
  if i==2**n-1:
    if ls[i]<n:
      print("No")
      break
else:
  print("Yes")

Submission status: Wrong Answer

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

ar = [A.pop()]
for i in range(N):
    ar.sort(reverse=True)
    br = []
    for j in range(2**i):
        br.append(A.pop())
    assert len(ar) == len(br)
    if any(a<=b for a,b in zip(ar,br)):
        print('No')
        exit()
    ar += br
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
M = 2**N
A = list(map(int,input().split()))
A.sort()

ar = [A.pop()]
for i in range(N):
    ar.sort(reverse=True)
    br = []
    for j in range(2**i):
        br.append(A.pop())
    if any(a<=b for a,b in zip(ar,br)):
        print('No')
        exit()
    ar += br
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
M = 2**N
A = list(map(int,input().split()))
A.sort(reverse=True)

tr = [None] * (M*2)

def check(i,a):
    j = M+i
    tr[j] = a
    while j > 1:
        j //= 2
        if tr[j] is None:
            tr[j] = a
        else:
            if tr[j] <= a:
                print('No')
                exit()
check(0, A[0])
check(M//2, A[1])
m = M//2
i = 2
while m > 1:
    for j in range(m//2,M,m):
        check(j, A[i])
        i += 1
    m //= 2
print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import deque
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)

q = deque([(0,N)])
nx = 1
es = []
while q:
    v,h = q.popleft()
    for i in range(h-1,-1,-1):
        es.append((v,nx))
        q.append((nx,i))
        nx += 1

for a,b in es:
    if A[a] <= A[b]:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
def solve():
    N = int(input())
    Ss = list(map(int, input().split()))

    Ss.sort(reverse=True)
    pow2s = [2**i for i in range(N)]

    As = [0] * (2**N)
    As[0] = Ss[0]
    iAs = [0] * N
    tm0 = 0
    for S in Ss[1:]:
        for tm in range(tm0, N):
            if iAs[tm] >= pow2s[tm]:
                tm0 = tm
            else:
                if As[iAs[tm]] > S:
                    As[pow2s[tm] + iAs[tm]] = S
                    iAs[tm] += 1
                    break
        else:
            return False

    return True

if solve():
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import heapq

n=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)

timelist=[-1] #ステージが代わるごとに更新
importlist=[]
before=0
flag=True

for a in A:
    if before!=a: #世代交代 importlistをtimelistに追加
        for p in importlist:
            if p<n:
                heapq.heappush(timelist,p)
        importlist=[]
    before=a
    if len(timelist)!=0:
        v=heapq.heappop(timelist)
        importlist.append(v+1)
        importlist.append(v+1)
    else:    
        flag=False
        break
print("Yes" if flag else "No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

A.sort(reverse=1)
cur = [A[0]]
# 作成済を-1とする
A[0] = -1

for _ in range(N):
    nxt = cur[:]
    j = 0
    for i, a in enumerate(A):
        if a == -1:
            continue
        if a < cur[j]:
            # 大きい要素から順に、まだ作っていない大きい要素を作っていく
            nxt.append(a)
            A[i] = -1
            j += 1
            # この世代は作り終わった
            if j == len(cur):
                break
    else:
        # 子要素を作れない要素があった
        No()
        exit()
    cur = nxt[:]
Yes()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

A.sort(reverse=1)
cur = [A[0]]
# 作成済を-1とする
A[0] = -1

for _ in range(N):
    cur.sort(reverse=1)
    nxt = cur[:]
    j = 0
    for i, a in enumerate(A):
        if a == -1:
            continue
        if a < cur[j]:
            # 大きい要素から順に、まだ作っていない1大きい要素を作っていく
            nxt.append(a)
            A[i] = -1
            j += 1
            # この世代は作り終わった
            if j == len(cur):
                break
        else:
            # 子要素を作れなかった
            No()
            exit()
    cur = nxt[:]
Yes()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

A.sort(reverse=1)
stack = A[::-1]
stack.pop()

j = 0
for i in range(N):
    if i == 0:
        m = 1
    else:
        m = 2**(i-1)
    for _ in range(m):
        if stack[-1] >= A[j]:
            No()
            exit()
        else:
            for _ in range(N-i):
                if stack:
                    stack.pop()
        j += 1
Yes()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

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

A.sort(reverse=1)
stack = A[::-1]
stack.pop()

j = 0
for i in range(N):
    if i == 0:
        m = 1
    else:
        m = 2**(i-1)
    for _ in range(m):
        if stack[-1] >= A[j]:
            No()
            exit()
        else:
            for _ in range(N-i):
                stack.pop()
        j += 1
Yes()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

A.sort(reverse=1)
stack = A[::-1]
stack.pop()

j = 0
for i in range(N):
    if i == 0:
        m = 1
    else:
        m = 2**(i-1)
    for _ in range(m):
        if stack[-1] >= A[j]:
            No()
            exit()
        else:
            for _ in range(N-i):
                stack.pop()
        j += 1
Yes()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

A.sort()
for i in range(N):
    n = len(A) // 2
    A1, A2 = A[:n], A[n:]
    for j in range(n):
        if A1[j] >= A2[j]:
            No()
            exit()
    A = A2
Yes()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

A.sort()
for i in range(N):
    n = len(A)
    A1, A2 = A[:n//2], A[n//2:]
    if A1[-1] == A2[0]:
        No()
        exit()
    A = A2
Yes()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
graph = [[] for _ in range(1<<N)]

A.sort(reverse=True)

def main():
    for l in range(N):
        for n in range(1<<l):
            graph[n].append(n+(1<<l))
    q = [0]
    count = [-1]*(1<<N)
    count[0] = 0
    c = 0
    while q:
        qq = []
        for p in q:
            for np in graph[p]:
                c += 1
                count[np] = c
                if A[count[p]] == A[count[np]]:
                    return False
                qq.append(np)
        q = qq
    return True

if __name__ == "__main__":
    print("Yes" if main() else "No")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)

def main():
    for l in range(N):
        for n in range(1<<l):
            if A[n] == A[n+(1<<l)]:
                return False
    return True

if __name__ == "__main__":
    print("Yes" if main() else "No")

Submission status: Wrong Answer

Solution code:
#F - Many Slimes
N=int(input())
S=list(map(int,input().split()))
if int(len(S))<=2**N:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
s = sorted(list(map(int, input().split())), reverse=True)
ok = True

childs = [0 for _ in range(1<<n)]
childs[0] = n
adj = [[] for _ in range(1<<n)]
cnt = 1
for i in range(1<<n):
	for j in range(childs[i]-1, -1, -1):
		childs[cnt] = j
		adj[i].append(cnt)
		cnt += 1

for i in range(1<<n):
	for j in adj[i]:
		if s[i] <= s[j]:
			ok = False

if ok:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
s = sorted(list(map(int, input().split())), reverse=True)
ok = True
for i in range(1<<(n-1)):
	if i == 0:
		j = 1
	else:
		j = 2*i
	if s[i] <= s[j]:
		ok = False

	while (j<<1) + 1 < (1<<n):
		if s[j] <= s[(j<<1) + 1]:
			ok = False
		j = (j<<1) + 1
if ok:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
def examA():
    N = I()
    ans = 0
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    def bfs(n, e, S):
        W = [0]*(2**n)
        cur = 1
        que = deque()
        que.append(e)
        while cur<2**n:
            now = que.popleft()
            if S[now]<=S[cur]:
                return "No"
            for ne in range(n-W[now]):
                cur +=1
                W[now+1+ne] = W[now]+1
                que.append(now+1+ne)
        return "Yes"
    N = I()
    S = LI(); S.sort(reverse=True)
    ans = bfs(N,0,S)
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examF()

"""

"""

Submission status: Wrong Answer

Solution code:
def examA():
    N = I()
    ans = 0
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    def bfs(n, e, S):
        cur = 1
        que = deque()
        que.append(0)
        while cur<2**n:
            now = que.popleft()
            if S[now]<=S[cur]:
                return "No"
            for ne in range(n):
                cur +=1
                que.append(now+1+ne)
        return "Yes"
    N = I()
    S = LI(); S.sort(reverse=True)
    ans = bfs(N,0,S)
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examF()

"""

"""

Submission status: Wrong Answer

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

a = sorted(a, reverse=True)
for i in range(n):
    length = 1 << i 
    for j in range(length):
        if a[j] <= a[j + length]:
            print("No")
            exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
S=list(map(int,input().split()))
S.sort(reverse=True)
data=np.array([S[0]])
for i in range(N):
    h1=np.array(S[:2**i])
    h2=np.array(S[2**i:2**(i+1)])
    if np.all(h1>h2):
        continue
    else:
        print("No")
        break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
import heapq
N = int(input())
S = list(map(int,input().split()))
d = defaultdict(lambda:0)
for s in S:
    d[s] += 1
S = []
for s in d:
    S.append([s,d[s]])
S.sort(reverse=True)
S = [s[1] for s in S]
c = [-N]
possible = True
for s in S:
    if len(c)<s:
        possible = False
        break
    i = -heapq.heappop(c)
    for k in range(s):
        for j in range(i):
            heapq.heappush(c,-j)
if possible:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N = int(input())
S = list(map(int,input().split()))
d = defaultdict(lambda:0)

for s in S:
    d[s] += 1

S = []
for s in d:
    S.append([s,d[s]])
S.sort(reverse=True)

used = defaultdict(lambda:False)

p = 1
n = 1
possible = True
for s in S:
    if s[1]>n:
        possible = False
    for i in range(s[1]):
        while used[p]:
            p += 1
        used[p] = True
        n -= 1
        c = 2*p
        while c < 2**(N+1):
            used[c] = True
            n += 1
            c *= 2

if possible:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N = int(input())
S = list(map(int,input().split()))
d = defaultdict(lambda:0)

for s in S:
    d[s] += 1

S = []
for s in d:
    S.append([s,d[s]])
S.sort(reverse=True)

used = defaultdict(lambda:False)

p = 1
n = 1
possible = True
for s in S:
    if s[1]>n:
        possible = False
    for i in range(s[1]):
        while used[p]:
            p += 1
        else:
            used[p] = True
            n -= 1
            c = 2*p
            while c < 2**(N+1):
                used[c] = True
                n += 1
                c *= 2

if possible:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N = int(input())
S = list(map(int,input().split()))
d = defaultdict(lambda:0)

for s in S:
    d[s] += 1

S = []
for s in d:
    S.append([s,d[s]])
S.sort(reverse=True)

used = defaultdict(lambda:False)

p = 1
n = 1
possible = True
for s in S:
    if s[1]>n:
        possible = False
    else:
        for i in range(s[1]):
            if used[p]:
                p += 1
            else:
                used[p] = True
                n -= 1
                c = 2*p
                while c < 2**(N+1):
                    used[c] = True
                    n += 1
                    c *= 2

if possible:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N = int(input())
S = list(map(int,input().split()))
d = defaultdict(lambda:0)

for s in S:
    d[s] += 1

S = []
for s in d:
    S.append([s,d[s]])
S.sort(reverse=True)

used = defaultdict(lambda:False)

p = 1
n = 1
possible = True
for s in S:
    if s[1]>n:
        possible = False
    if used[p]:
        p += 1
    else:
        used[p] = True
        n -= 1
        c = 2*p
        while c < 2**(N+1):
            used[c] = True
            n += 1
            c *= 2

if possible:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
s = LI()
h = []
for i in s:
    heappush(h,-i)
x = heappop(h)
use = [-x]
for _ in range(n):
    for i in use:
        rest_tmp = []
        use_tmp = []
        while h:
            x = heappop(h)
            x = -x
            if i > x:
                use_tmp.append(x)
                break
            else:
                rest_tmp.append(x)
        for j in rest_tmp:
            heappush(h,-j)
    use += use_tmp
if len(use) == 2**n:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
s = LI()
h = []
for i in s:
    heappush(h,-i)
x = heappop(h)
use = [-x]
for _ in range(n):
    for i in use:
        tmp = []
        while h:
            x = heappop(h)
            x = -x
            if i > x:
                use.append(x)
                break
            else:
                tmp.append(x)
        for j in tmp:
            heappush(h,-j)
if len(use) == 2**n:
    print('Yes')
else:
    print('No')