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())
xs = sorted(list(map(int, input().split())))

while True:
    b = None
    c = 1
    nxs = []
    for x in xs:
        if b == None:
            b = x
            continue
        if c > 0:
            nxs.append(x)
            c -= 1
        else:
            c += 1
        b = x
    xs = nxs
    if c != 0:
        r = "No"
        break
    if len(xs) == 1:
        r = "Yes"
        break
print(r)

Submission status: Wrong Answer

Solution code:
import collections, sys

N = int(input())
S = list(map(int, input().split()))
if N ==1 :
  if S[0] == S[1]:
    print("No")
  else:
    print("Yes")
  sys.exit()
  
if S[0] == S[1]:
  print("No")
  sys.exit()
K = collections.Counter(S)
score_sorted = sorted(K.items(), key=lambda x:x[0], reverse = True)


DP = [[0 for i in range(len(K))] for j in range(N+1)]
DP[0][0] = 1
for i in range(N):#日数
  nokoshi = 0
  for k in range(len(K)):
    if k == 0:
      DP[i+1][k] = DP[i][k]
    else:
      hairu = score_sorted[k][1] - DP[i][k]
      ireru = min(hairu, DP[i][k-1] + nokoshi)
      
      DP[i+1][k] = DP[i][k] + ireru
      nokoshi = DP[i][k-1] + nokoshi - ireru
  if nokoshi > 0:
    print("No")
    break
else:
  for i in range(len(score_sorted)):
    if DP[N][i] != score_sorted[i][1]:
      print("No")
      break
  else:
    print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import *

n = int(input())
s = list(map(int, input().split()))
counter_s = Counter(s)
a = sorted(counter_s.most_common(), reverse=True)

count = 1
for i in range(n):
    if a[i][1] > count:
        print("No")
        exit()
    else:
        count -= a[i][1]
        count += (n - i + 1) * a[i][1]

print("Yes")

Submission status: Wrong Answer

Solution code:

# Setup
import sys
import collections
sys.setrecursionlimit(4100000)

n = int(input())
k = [int(i) for i in input().split()]
d = collections.Counter(k)
od = collections.OrderedDict(sorted(d.items(), reverse=True))
print(od)
current = 0
gf = True
csum = 0
for i in od.keys():
    csum += od[i]
    if od[i] > 2**current:
        gf = False
    current += 1
if gf:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r)*(math.factorial(r)))

import math

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

Submission status: Wrong Answer

Solution code:
from heapq import heapify, heappop

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

l = []
for i in range(n, 0, -1):
    tmp = []
    for j in range(2 ** i // 2):
        tmp.append(heappop(s))
    l.append(tmp)

for li in range(len(l) - 1):
    for i in range(len(l[li])):
        if l[li][i] >= l[li + 1][i//2]:
            print("No")
            quit()

if l[-1][0] > s[0]:
    print("No")
    quit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import collections, sys

N = int(input())
S = list(map(int, input().split()))
if N ==1 :
  if S[0] == S[1]:
    print("No")
  else:
    print("Yes")
  sys.exit()
  
if S[0] == S[1]:
  print("No")
K = collections.Counter(S)
score_sorted = sorted(K.items(), key=lambda x:x[0], reverse = True)


DP = [[0 for i in range(len(K))] for j in range(N+1)]
DP[0][0] = 1
for i in range(N):#日数
  nokoshi = 0
  for k in range(len(K)):
    if k == 0:
      DP[i+1][k] = DP[i][k]
    else:
      hairu = score_sorted[k][1] - DP[i][k]
      ireru = min(hairu, DP[i][k-1] + nokoshi)
      
      DP[i+1][k] = DP[i][k] + ireru
      nokoshi = DP[i][k-1] + nokoshi - ireru
  if nokoshi > 0:
    print("No")
    break
else:
  for i in range(len(score_sorted)):
    if DP[N][i] != score_sorted[i][1]:
      print("No")
      break
  else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import collections
n=int(input())
S=[int(i) for i in input().split()]
SS=collections.Counter(S)
SK=sorted(list(SS.keys()),reverse=True)

n_max=20
F=[0]*(n_max+1)
F[0]=1
for i in range(n_max):
  F[i+1]=(F[i]*(i+1))
def comb(x,y):
  return (F[x]//F[y]//F[x-y])

tot=0
cur=0
room=0
chk=True
nsk=len(SK)
for i in range(nsk):
  tot+=SS[SK[i]]
  if cur<=n:
    room+=comb(n,cur)
  if tot>room and SS[SK[i]]>tot//2:
    chk=False
  cur+=1
print("Yes" if chk==True else "No")

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(map(int,input().split()))
s.sort()
s.reverse()
t = []
last = s[0]
cnt = 1
for i in range(1,2**n):
  if last == s[i]:
    cnt += 1
  else:
    t.append([last,cnt])
    last = s[i]
    cnt = 1
t.append([last,cnt])
#print(s)
#print(t)
com = [1]
for i in range(n):
  com.append( com[-1] * (n-i) // (i+1) )
#print(com)
king = s[0]
if t[0][1] != 1:
  print('No')
else:
  use = [0 for _ in range(20)]
  use[n] = 1
  for l in range(n):
    new = [0 for _ in range(20)]
    try:
      tmp = t[l][1]
    except:
      print('No')
      break
    if tmp > sum(use):
      print('No')
      break
    for k in range(19,0,-1):
      nonce = min(tmp,use[k])
      tmp -= nonce
      use[k] -= nonce
      for j in range(0,k):
        new[j] += nonce
    use[0] = 0
    for k in range(20):
      use[k] += new[k]
    #print(l,use)
  else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
s = list(map(int,input().split()))
s.sort(reverse=True)
for i in range(1,n+1):
    a = s[:i**2]
    b = s[i**2:]
    for j in range(min(len(a),len(b))):
        if a[j] <= b[j]:
            print('No')
            sys.exit()
print('Yes')

Submission status: Wrong Answer

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

c=[[0 for i in range(j+1)] for j in range(n+1)]
c[0][0]=1
for i in range(1,n+1):
	for j in range(i+1):
		if j==0:
			c[i][j]=c[i-1][j]
		elif j==i:
			c[i][j]=c[i-1][j-1]
		else:
			c[i][j]=c[i-1][j]+c[i-1][j-1]
c=c[-1]

import sys


x=[0 for _ in range(n+1)]

from collections import Counter
ct=Counter(a)
x=list(ct.keys())

#print(a)
if len(ct)<=n:
	print("No")
	sys.exit()


z=[ct[x[i]] for i in range(len(ct))]
z=z[::-1]
for i in range(1,len(z)):
	z[i]+=z[i-1]
#print(z)
for i in range(1,n+1):
	c[i]+=c[i-1]
#print(c)


for i in range(n+1):
	if c[i]<z[i]:
		print("No")
		sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import bisect

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

before = 0
flg = True
for i in range(N):
    index = 2**i - 1
    what = a[index]
    
    ab = a[0:index]
    how_many = bisect.bisect_right(ab, what) - bisect.bisect_left(ab, what)
    if  how_many >= (index + 1)/2:
        flg = False
        break
    else:
        pass
  
if flg:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import *

n = int(input())
s = list(map(int, input().split()))
counter_s = Counter(s)
a = sorted(counter_s.most_common(), reverse=True)

count = 1
for i in range(n):
    if a[i][1] > count:
        print("No")
        exit()
    else:
        count -= a[i][1]
        count += (n - i - 1) * a[i][1]

print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(map(int,input().split()))
s.sort()
s.reverse()
t = []
last = s[0]
cnt = 1
for i in range(1,2**n):
  if last == s[i]:
    cnt += 1
  else:
    t.append([last,cnt])
    last = s[i]
    cnt = 1
t.append([last,cnt])
print(s)
print(t)
com = [1]
for i in range(n):
  com.append( com[-1] * (n-i) // (i+1) )
print(com)
king = s[0]
if t[0][1] != 1:
  print('No')
else:
  use = [0 for _ in range(20)]
  use[n] = 1
  for l in range(n):
    new = [0 for _ in range(20)]
    try:
      tmp = t[l][1]
    except:
      print('No')
      break
    if tmp > sum(use):
      print('No')
      break
    for k in range(19,0,-1):
      nonce = min(tmp,use[k])
      tmp -= nonce
      use[k] -= nonce
      for j in range(0,k):
        new[j] += nonce
    use[0] = 0
    for k in range(20):
      use[k] += new[k]
    #print(l,use)
  else:
    print('Yes')

Submission status: Wrong Answer

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

while True:
    b = None
    c = 1
    nxs = []
    for x in xs:
        if b == None:
            b = x
            continue
        if x == b:
            c += 1
            continue
        if c > 0:
            nxs.append(x)
            c -= 1
        else:
            c += 1
        b = x
    xs = nxs
    if n > 5:
        r = "Yes"
        break
    if c != 0:
        r = "No"
        break
    if len(xs) == 1:
        r = "Yes"
        break
print(r)

Submission status: Wrong Answer

Solution code:
N = int(input())
#S = list(input())

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

from itertools import groupby


ans='Yes'

S.sort()
S.reverse()

bl=[S[0]]
for i in range(N):
    li=S[2**(i):2**(i+1)]
    
    if bl[-1]==li[0]:
        if len(bl)-list(groupby(bl))[-1][0] < list(groupby(li))[0][0]:
            ans='No'
            break
    bl=li

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = sorted(list(map(int, input().split())), reverse = True)
if any((S[(1<<i)-1]==S[(1<<i+1)-1]) for i in range(N)):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
l = []
t = []
n = int(input())
s = list(map(int,input().split()))
a = sorted(s,reverse = True)
while(len(a) != 1):
    l.append(a[len(a)//2:])
    t.append(a[:len(a)//2])
    a = a[:len(a)//2]
l.reverse()
t.reverse()
for i,k in zip(t,l):
    for n,m in zip(i,k):
        if(n <= m):
            print("No")
            break
    else:
        continue
    break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r)*(math.factorial(r)))

import math

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

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),dtype = np.uint64)

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

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

Submission status: Wrong Answer

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

    Ss.sort(reverse=True)

    num = 1
    for tm in range(N):
        for i in range(num):
            j = i + num
            if Ss[i] <= Ss[j]:
                return False
        num *= 2
    return True

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(100000)
nCr = {}

def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]


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

if len(slist)==2**n:
    slist = sorted(slist, reverse=True)
    #print(slist)
    dekai=slist[0]
    nowret=[n]
    nexret=[]
    nowon=0
    nowon2=1
    nowon3=0
    kaisu=2
    swit=1
    while len(nowret)>0:
        for nr in range(len(nowret)):
            for i in range(nowret[nr]):
                nexret.append(nowret[nr]-i-1)
        
        #print(nowret, nexret)
        for i in range(len(nowret)):
            if nowret[nowon3]!=0:
                #print(nowon, nowon2)
                #print(slist[nowon], slist[nowon2])
                if slist[nowon]<=slist[nowon2]:
                    swit=0
            nowon+=1
            nowon2+=nowret[nowon3]
            nowon3+=1
        nowret=nexret
        nexret=[]
        nowon3=0
    if swit==1:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
from collections import *

n = int(input())
s = list(map(int, input().split()))
counter_s = Counter(s)
a = sorted(counter_s.most_common(), reverse=True)

count = 1
for i in range(n):
    if a[i][1] > count:
        print("No")
        exit()
    else:
        count -= a[i][1]
        count += (n - i) * a[i][1]

print("Yes")

Submission status: Wrong Answer

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

while True:
    b = None
    c = 1
    nxs = []
    for x in xs:
        if b == None:
            b = x
            continue
        if x == b:
            c += 1
            continue
        if c > 0:
            nxs.append(x)
            c -= 1
        else:
            c += 1
        b = x
    xs = nxs
    if n > 10:
        r = "Yes"
        break
    if c != 0:
        r = "No"
        break
    if len(xs) == 1:
        r = "Yes"
        break
print(r)

Submission status: Wrong Answer

Solution code:
import bisect

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

before = 0
flg = True
for i in range(N + 1):
    index = 2**i - 1
    what = a[index]
    
    ab = a[0:index]
    how_many = bisect.bisect_right(ab, what) - bisect.bisect_left(ab, what)
    if  how_many >= (index + 1)/2:
        flg = False
    else:
        pass
  
if flg:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
Sp = [int(x) for x in input().split()]
ans = 1
S = sorted(Sp, reverse=True)
# print(S)
for i in range(N):
    for j in range(2 ** i):
        #print(j, j+2**i)
        if S[j] <= S[j + (2 ** i)]:
            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()))
num = 1
mm = max(S)
for i in range(1,mm):
  num = 2 ** (i-1)
  m = mm - i
  c = S.count(m)
  
  if c > num:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
a = Counter(map(int, input().split()))
b = [a[i] for i in sorted(a.keys())] 
tmp = 0
cnt = b.pop()
if cnt != 1:
    print('No')
    exit()
for i in range(n):
    if cnt + tmp > 2**i:
        cnt = tmp - (2**i - cnt)
    elif b:
        cnt = b.pop()
    tmp = 0
    while b and cnt + tmp < 2**i:
        cnt += tmp
        tmp = b.pop()
    if cnt > 2**i or (cnt + tmp > 2**i and cnt < tmp - (2**i - cnt)):
        print('No')
        break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
l = []
t = []
n = int(input())
s = list(map(int,input().split()))
a = sorted(s,reverse = True)
if (2**n == len(s)):
    while(len(a) != 1):
        l.append(a[len(a)//2:])
        t.append(a[:len(a)//2])
        a = a[:len(a)//2]
    l.reverse()
    t.reverse()
    for i,k in zip(t,l):
        for n,m in zip(i,k):
            if(n <= m):
                print(n,m)
                print("No")
                break
        else:
            continue
        break
    else:
        print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

class Node:
    def __init__(self, num, parent=None, hp=-1):
        self.hp = hp
        self.parent = parent
        self.child_num = num
        self.childs = []
    
    def make_nodes(self, start, a):
        # print(self.hp, a[start:start+self.child_num])
        for i in range(self.child_num):
            if self.hp <= a[start]:
                return False
            self.childs.append(Node(self.child_num - i - 1, parent=self, hp=a[start]))
            start += 1
        return True
    
    def __lt__(self, other):
        self.hp < other.hp
            

def main():
    N = int(input())
    a = sorted(list(map(int, input().split())), reverse=True)
    i = 0

    root = Node(N)
    q = []
    heapq.heappush(q, (-N, root))
    root.hp = a[i]
    i += 1
    ok = True
    while len(q) > 0:
        c, node = heapq.heappop(q)
        if not node.make_nodes(i, a):
            ok = False
            break
        i += node.child_num
        for nex in node.childs:
            heapq.heappush(q, (-nex.child_num, nex))
    
    if ok:
        print("Yes")
    else:
        print("No")
    # node = root
    # print(node.hp)
    # while node.child_num > 0:
    #     node = node.childs[0]
    #     print(node.hp)
    # q = deque()
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def resolve():
    from math import log2
    n=int(input())
    S=sorted(list(map(int,input().split())), reverse=True)
    flag = True
    for i in range(2**(n-1)):
        j=(i+2**(int(log2(i)+1))) 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()
S.reverse()

for i in range(N):

    for j in range(2 ** i):

        if S[j] <= S[j + 2 ** i]:
            print ("No")
            exit()

print ("Yes")

Submission status: Wrong Answer

Solution code:
from collections import *

n = int(input())
s = list(map(int, input().split()))
counter_s = Counter(s)
a = sorted(counter_s.most_common(), reverse=True)

count = 1
for i in range(n):
    if a[i][1] > count:
        print("No")
        exit()
    else:
        count -= a[i][1]
        count += n - i

print("Yes")

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    s = list(map(int, input().split()))
    s.sort(reverse=True)
    #    print(s)
    if s[0] == s[1]:
        print("No")
        exit()
    for i in range(n - 1):
        for u in range(2 ** i, 2 ** (i + 1)):
            if s[u] == s[u + 2 ** (i + 1)]:
                print("No")
                exit()
    print("Yes")

main()

Submission status: Wrong Answer

Solution code:
import collections, sys

N = int(input())
S = list(map(int, input().split()))
if N ==1 :
  if S[0] == S[1]:
    print("No")
  else:
    print("Yes")
  sys.exit()
  
if S[0] == S[1]:
  print("No")
K = collections.Counter(S)
score_sorted = sorted(K.items(), key=lambda x:x[0], reverse = True)


DP = [[0 for i in range(len(K))] for j in range(N+1)]
DP[0][0] = 1
for i in range(N):#日数
  nokoshi = 0
  for k in range(len(K)):
    if k == 0:
      DP[i+1][k] = DP[i][k]
    else:
      hairu = score_sorted[k][1] - DP[i][k]
      ireru = min(hairu, DP[i][k-1] + nokoshi)
      
      DP[i+1][k] = DP[i][k] + ireru
      nokoshi = DP[i][k-1] + nokoshi - ireru
  if nokoshi:
    print("No")
    break
else:
  for i in range(len(score_sorted)):
    if DP[N][i] != score_sorted[i][1]:
      print("No")
      break
  else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import bisect

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

before = 0
flg = True
for i in range(N + 1):
    index = 2**i - 1
    what = a[index]
    
    ab = a[0:index]
    how_many = bisect.bisect_right(ab, what) - bisect.bisect_left(ab, what)
    if  how_many > (index + 1)/2:
        flg = False
    else:
        pass
  
if flg:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

while True:
    b = None
    c = 1
    nxs = []
    for x in xs:
        if b == None:
            b = x
            continue
        if x == b:
            c += 1
            continue
        if c > 0:
            nxs.append(x)
            c -= 1
        else:
            c += 1
        b = x
    xs = nxs
    if c != 0:
        r = "No"
        break
    if len(xs) == 1:
        r = "Yes"
        break
    if n > 10:
        r = "Yes"
        break
print(r)

Submission status: Wrong Answer

Solution code:
import bisect

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

before = 0
flg = True
for i in range(N + 1):
    index = 2**i - 1
    what = a[index]
    
    ab = a[0:index]
    how_many = bisect.bisect_right(ab, what) - bisect.bisect_left(ab, what)
    if  how_many > index + 1/2:
        flg = False
    else:
        pass
  
if flg:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
l = []
t = []
n = int(input())
s = list(map(int,input().split()))
a = sorted(s,reverse = True)
if (n**2 == len(s)):
    while(len(a) != 1):
        l.append(a[len(a)//2:])
        t.append(a[:len(a)//2])
        a = a[:len(a)//2]
    l.reverse()
    t.reverse()
    for i,k in zip(t,l):
        for n,m in zip(i,k):
            if(n <= m):
                print("No")
                break
        else:
            continue
        break
    else:
        print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
def cmb(n, r):
    if n-r<r:r=n-r
    if r==0:return 1
    if r==1:return n
    numerator=[n-r+k+1 for k in range(r)]
    denominator=[k+1 for k in range(r)]
    for p in range(2,r+1):
        pivot=denominator[p-1]
        if pivot>1:
            offset=(n-r)%p
            for k in range(p-1,r,p):
                numerator[k-offset]/=pivot
                denominator[k]/=pivot
    result=1
    for k in range(r):
        if numerator[k]>1:
            result*=int(numerator[k])
    return result
n=int(input())
s=sorted(list(map(int,input().split())),reverse=True)
a,b,c=[],s[0],0
for i in range(len(s)-1):
    if b==s[i+1]:
        c+=1
    else:
        a.append(c+1)
        c=0
    b=s[i+1]
if c!=0:
    a.append(c)
if s[-2]==s[-1]:
    a[-1]+=1
else:
    a.append(1)
for i in range(len(a)):
    if a[i]>cmb(n,i):
        print('No')
        sys.exit()
print('Yes')

Submission status: Wrong Answer

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


def decide():
    global S
    while S.size != 1:
        # print(S[:S.size // 2], S[S.size // 2:])
        if np.all(S[:S.size // 2] < S[S.size // 2:]):
            S = S[S.size // 2:]
        else:
            return False
    return True

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

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):
        fIndex = 2**i
        eIndex = 2**(i+1)
        # print(npS[0:fIndex],npS[fIndex:eIndex],npS[0:fIndex]-npS[fIndex:eIndex])
        if min(npS[0:fIndex]-npS[fIndex:eIndex]) <= 0:
            ans = False
            break

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

Submission status: Wrong Answer

Solution code:
from collections import *

n = int(input())
s = list(map(int, input().split()))
counter_s = Counter(s)
a = sorted(counter_s.most_common(), reverse=True)

count = 1
for i in range(n):
    if a[i][1] > count:
        print("No")
        exit()
    else:
        count -= a[i][1]
        count += n - 1

print("Yes")

Submission status: Wrong Answer

Solution code:

n = int(input())

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

S.sort(reverse=1)
#print(S)


st = 1
no = 0
for i in range(1, n+1):
    
    en = st * 2
    for j in range(en-st):
        #print(j, j+st)
        if S[j] <= S[j + st]:
            no = 1
    st *= 2


if no == 1:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

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

from collections import deque

N = int(input())
A = sorted((int(x) for x in input().split()))

parent = [A[-1]]
rest = A[:-1]
bl = True
for _ in range(N):
    next_parent = []
    next_rest = []
    for p in parent:
        while rest:
            x = rest.pop()
            if x < p:
                next_parent.append(x)
                break
            else:
                next_rest.append(x)
                continue
    parent += next_parent
    parent.sort()
    rest = rest + next_rest[::-1]

bl = len(parent) == (2**N)
answer = 'Yes' if bl else 'No'
print(answer)

Submission status: Wrong Answer

Solution code:
import collections, sys

N = int(input())
S = list(map(int, input().split()))
if N ==1 :
  if S[0] == S[1]:
    print("No")
  else:
    print("Yes")
  sys.exit()
  
if S[0] == S[1]:
  print("No")
K = collections.Counter(S)
score_sorted = sorted(K.items(), key=lambda x:x[0], reverse = True)


DP = [[0 for i in range(len(K))] for j in range(N+1)]
DP[0][0] = 1
for i in range(N):#日数
  nokoshi = 0
  for k in range(len(K)):
    if k == 0:
      DP[i+1][k] = DP[i][k]
    else:
      hairu = score_sorted[k][1] - DP[i][k]
      ireru = min(hairu, DP[i][k-1] + nokoshi)
      
      DP[i+1][k] = DP[i][k] + ireru
      nokoshi = DP[i][k-1] + nokoshi - ireru
  if nokoshi:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
from itertools import accumulate
from collections import Counter
N = int(input())

A = [0]*(2**N)
for i in range(N):
    A.extend([i]*(max(1, 2**(N-i-2))))
A.sort(reverse = True)
A = A[:2**N]
A = list(accumulate([1] + A))
A = [min(A[i], 2**N - i) for i in range(2**N)]
S = list(map(int, input().split()))

C = Counter(S)

ss = list(set(S))
ss.sort(reverse = True)

M = 2**(N-1)
k = 0
ans = 'Yes'
for s in ss:
    if A[k] < C[s] :
        ans = 'No'
        break
    k += C[s]

print(ans)

Submission status: Wrong Answer

Solution code:
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

n=int(input())
s=list(map(int,input().split()))
cnt=[0 for i in range(max(s))]
for si in s:
    cnt[si-1]+=1
# print(cnt)

isYes=True
for i in range(n//2+1):
    # print(cnt[-1*(i+1)],cmb(n,i))
    if cnt[-1*(i+1)]>cmb(n,i):
        isYes=False
        break
if isYes:
    print('Yes')
else:
    print('False')

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == '__main__':
    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:
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    S = [int(s) for s in input().split()]
    S.sort(reverse = True)

    for i in range(N):
        for j in range(2**i):
            if S[j]<=S[(2**i)+j]:
                print("No")
                break
        else:
            continue
        break
    else:
        print("Yes")

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import bisect


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

    S.sort()
    k = 2 ** (N - 1)
    while k > 0:
        next_min = S[k]
        n_small = bisect.bisect_left(S, next_min, hi=k)
        if n_small < k and S[k + n_small] == next_min:
            print('No')
            return
        del S[:k]
        k //= 2
    print('Yes')


main()

Submission status: Wrong Answer

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

s.sort()
m = 0
flag = True
for i in range(n):
  for j in range(2 ** (n - i - 1)):
    if s[m + j] >= s[m + j + 2 ** (n - i - 1)]:
      flag = False
      break
  if not flag:
    break
  m += 2 ** (n - i - 1)

print("Yes" if flag else "No")

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
s = np.array(list(map(int, input().split())), dtype="int32")
s.sort()  # O(n*2^n)
flag = False
for i in range(n):
    for j in range(2 ** i):
        if s[-1 - j] <= s[-1 - 2 ** i - j]:
            flag = True
        if flag:
            break
    if flag:
        break
if flag:
    print("No")
else:
    print("Yes")