Problem:


Score : 900 points

Problem Statement

We have a grid with (2^N - 1) rows and (2^M-1) columns.
You are asked to write 0 or 1 in each of these squares.
Let a_{i,j} be the number written in the square at the i-th row from the top and the j-th column from the left.

For a quadruple of integers (i_1, i_2, j_1, j_2) such that 1\leq i_1 \leq i_2\leq 2^N-1, 1\leq j_1 \leq j_2\leq 2^M-1, let
S(i_1, i_2, j_1, j_2) = \displaystyle \sum_{r=i_1}^{i_2}\sum_{c=j_1}^{j_2}a_{r,c}.
Then, let the oddness of the grid be the number of quadruples (i_1, i_2, j_1, j_2) such that S(i_1, i_2, j_1, j_2) is odd.

Find a way to fill in the grid that maximizes its oddness.

Constraints

N and M are integers between 1 and 10 (inclusive).

Input

Input is given from Standard Input in the following format:

N M

Output

Print numbers to write in the grid so that its oddness is maximized, in the following format:

a_{1,1}a_{1,2}\cdots a_{1,2^M-1}
a_{2,1}a_{2,2}\cdots a_{2,2^M-1}
\vdots
a_{2^N-1,1}a_{2^N-1,2}\cdots a_{2^N-1,2^M-1}

If there are multiple solutions, you can print any of them.

Sample Input 1

1 2

Sample Output 1

111

For this grid, S(1, 1, 1, 1), S(1, 1, 2, 2), S(1, 1, 3, 3), and S(1, 1, 1, 3) are odd, so it has the oddness of 4.

We cannot make the oddness 5 or higher, so this is one of the ways that maximize the oddness.



Sample input:
1 2


Sample output:
111

Submission status: Wrong Answer

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

n2=2**n-1
m2=2**m-1

x=(m2-1)//2
#print(n2,m2,x)

for i in range(n2):
    if i%2==1:
      print('10'*x+'1')
    else:
      print('01'*x+'0')

Submission status: Wrong Answer

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

n2=2**n-1
m2=2**m-1

x=(m2-1)//2
#print(n2,m2,x)

for i in range(n2):
    if i%2==0:
      print('10'*x+'1')
    else:
      print('01'*x+'0')

Submission status: Wrong Answer

Solution code:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
import numpy as np
def resolve():
    N, M = lr()
    rev = 0
    if N < M:
        M, N = N, M
        rev = 1
    T = np.zeros(1, dtype=np.int8)
    for i in range(N):
        T = np.tile(T, (2, 2))
        T[1<<i:, 1<<i:] ^= 1
    T = np.diff(T, axis=0)
    T = np.diff(T, axis=1)
    T = T[:, :1<<M-1]%2
    if rev:
        T = np.transpose(T)
    for i in range(len(T)):
        print(*T[i], sep='')
resolve()

Submission status: Wrong Answer

Solution code:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
import numpy as np
def resolve():
    N, M = lr()
    rev = 0
    if N < M:
        M, N = N, M
        rev = 1
    T = np.zeros(1, dtype=np.int8)
    for i in range(N):
        T = np.tile(T, (2, 2))
        T[1<<i:, 1<<i:] ^= 1
    T = np.diff(T, axis=0)
    T = np.diff(T, axis=1)
    T = T[:1<<M-1]%2
    if not rev:
        T = np.transpose(T)
    for i in range(len(T)):
        print(*T[i], sep='')
resolve()

Submission status: Wrong Answer

Solution code:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
import numpy as np
def resolve():
    N, M = lr()
    rev = 0
    if N < M:
        M, N = N, M
        rev = 1
    T = np.zeros((1<<M, 1<<N), dtype=np.int64)
    for i in range(1<<M):
        for j in range(1<<N):
            T[i][j] = i&j%2
    T = np.diff(T, axis=0)%2
    T = np.diff(T, axis=1)%2
    if not rev:
        T = np.transpose(T)
    for i in range(len(T)):
        print(*T[i], sep='')
resolve()

Submission status: Wrong Answer

Solution code:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
import numpy as np
def resolve():
    N, M = lr()
    rev = 0
    if N < M:
        M, N = N, M
        rev = 1
    T = np.zeros((1<<M, 1<<N), dtype=np.int64)
    for i in range(1<<M):
        for j in range(1<<N):
            T[i][j] = i&j
    T = np.diff(T, axis=0)%2
    T = np.diff(T, axis=1)%2
    if not rev:
        T = np.transpose(T)
    for i in range(len(T)):
        print(*T[i], sep='')
resolve()

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
D=2**N-1
H=2**M-1
    
if N==1:
    print("".join(map(str,([1]*H))))
elif M==1:
    for i in range(D):
        print(1)
else:
    A=[[1]*H for i in range(D)]
    A[0][1]=A[1][0]=A[2][1]=A[1][2]=0

    for i in range(1,D+1):
        for j in range(1,H+1):

            k=(1<<i.bit_length())-i
            l=(1<<j.bit_length())-j

            if A[k-1][l-1]==0:
                A[i-1][j-1]=0

    for i in range(D):
        print("".join(map(str,A[i])))

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    if N == 1:
        print('1'*(2**M-1))
        return
    if M == 1:
        for _ in range(2**N-1):
            print(1)
        return
    if N == 2 and M == 2:
        print('010')
        print('101')
        print('010')
    else:
        for i in range(2**N-1):
            if i % 2 == 0:
                print('10' * (2**(M-1)-1) + '1')
                #print('1' * (2**(M-1)-1) + '0' + '1' * (2**(M-1)-1))
            else:
                print('01' * (2**(M-1)-1) + '0')
                #print('1'*(2**M-1))
                #print('0' * (2**(M-1)-1) + '1' + '0' * (2**(M-1)-1))
    
main()

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    if N == 1:
        print('1'*(2**M-1))
        return
    if M == 1:
        for _ in range(2**N-1):
            print(1)
        return
    if N == 2 and M == 2:
        print('010')
        print('101')
        print('010')
    else:
        for i in range(2**N-1):
            if i % 2 == 0:
                print('10' * (2**(M-1)-1) + '1')
                #print('1' * (2**(M-1)-1) + '0' + '1' * (2**(M-1)-1))
            else:
                print('1'*(2**M-1))
                #print('0' * (2**(M-1)-1) + '1' + '0' * (2**(M-1)-1))
    
main()

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    if N == 1:
        print('1'*(2**M-1))
        return
    if M == 1:
        for _ in range(2**N-1):
            print(1)
        return
    if N == 2 and M == 2:
        print('010')
        print('101')
        print('010')
    else:
        for i in range(2**N-1):
            if i % 2 == 0:
                print('1' * (2**(M-1)-1) + '0' + '1' * (2**(M-1)-1))
            else:
                print('0' * (2**(M-1)-1) + '1' + '0' * (2**(M-1)-1))
    
main()

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    if N == 1:
        print('1'*(2**M-1))
        return
    if M == 1:
        for _ in range(2**N-1):
            print(1)
        return
    if N == 2 and M == 2:
        print('010')
        print('101')
        print('010')
    else:
        for i in range(2**N-1):
            if i % 2 == 0:
                print('1' * (2**M-1))
            else:
                print('10' * (2**(M-1)-1) + '1' )
    
main()

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    if N == 1:
        print('1'*(2**M-1))
        return
    if M == 1:
        for _ in range(2**N-1):
            print(1)
        return
    print('aaa')
    l = '01' * (2**(M-1)) + '0'
    l2 = '10' * (2**(M-1)) + '1'
    for i in range(2**N-1):
        if i % 2 == 0:
            print(l)
        else:
            print(l2)
    return
main()

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    if N == 1:
        print('1'*(2**M-1))
        return
    if M == 1:
        for _ in range(2**N-1):
            print(1)
        return
    l = '01' * (2**(M-1)) + '0'
    l2 = '10' * (2**(M-1)) + '1'
    for i in range(2**N-1):
        if i % 2 == 0:
            print(l)
        else:
            print(l2)
    return
main()

Submission status: Wrong Answer

Solution code:
def gcd(a,b):
  while b:a,b=b,a%b
  return a

n,m=map(int,input().split())
n=2**n-1
m=2**m-1

ans=[m*["0"]for _ in range(n)]

for i in range(n):
  for j in range(m):
    g=gcd(i+1,j+1)
    count=0
    while g%2==0 and g>0:
      count+=1
      g%=2
    if count%2==1:
      ans[i][j]="0"
    else:
      ans[i][j]="1"

for i in ans:print("".join(i))

Submission status: Wrong Answer

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

def test():
    if n == m:
        flag = False
        for i in range(pow(2,n)-1):
            for j in range(pow(2,m)-1):
                if i ==0 or j==0:
                    print(1, end='')
                elif i==pow(2,n)-2 or j==pow(2,m)-2:
                    print(1, end='')
                else:
                    if flag:
                        print(1, end='')
                    else:
                        print(0, end='')
                    flag = not flag
            print()
        return 0

def main():
    if n == m:
        row = True
        column = True
        ans = []
        for i in range(pow(2,n)-1):
            if i > (pow(2,n)-1)/2:
                break
            ans.append('')
            for j in range(pow(2,m)-1):
                if j <= i-1 or j >= pow(2,m)-1-i:
                    if column:
                        # print(1, end='')
                        ans[i] +='1'
                    else:
                        # print(0, end='')
                        ans[i] +='0'
                    if j == i-1 or j == pow(2,m)-2:
                        continue
                    column = not column
                else:
                    if row:
                        # print(1, end='')
                        ans[i] +='1'
                    else:
                        # print(0, end='')
                        ans[i] +='0'
            row = not row
            # print()
        count = 0
        for i in range(2*len(ans)-1):
            if i < len(ans):
                print(ans[i])
            else:
                print(ans[len(ans) -count-2])
                count += 1
        return 0
    flag = True
    for i in range(pow(2,n)-1):
        for j in range(pow(2,m)-1):
            if flag:
                print(1, end='')
            else:
                print(0, end='')
            flag = not flag
        print()
    return 0
main()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
n=pow(2,n)-1
m=pow(2,m)-1

for i in range(n):
    if i%2==0:
        print("1"*m)
    elif i%4==1:
        print("10"*((m-1)//2)+"1")
    else:
        print("10"+"1110"*((m-2)//4)+"1")

Submission status: Wrong Answer

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

for i in range(N):
    for j in range(M):
        print(1, end="")
    print()

Submission status: Wrong Answer

Solution code:
def solve(n, m):

    if m == 1:
        s1 = "1"
        s2 = "1"
        s0 = "1"
    elif m == 2:
        s1 = "111"
        s2 = "101"
        s0 = "000"
    else:
        s1 = "1" + "0" * (2 ** (m - 1) - 2) + "1" + "0" * (2 ** (m - 1) - 2) + "1"
        s0 = "0" * (2 ** m - 1)
        s2 = "1" + "0" * (2 ** m - 3) + "1"

    if n == 1:
        return [s1]
    res = []
    for i in range(2 ** n - 1):
        if i == 0:
            s = s1
        elif i == 2 ** n - 2:
            s = s1
        elif i == 2 ** (n - 1) - 1:
            s = s2
        else:
            s = s0
        res.append(s)
    return res


def main():
    n, m = map(int, input().split())
    res = solve(n, m)
    for r in res:
        print(r)


def test():
    assert solve() == 0
    assert solve() == 0
    assert solve() == 0


if __name__ == "__main__":
    # test()
    main()

Submission status: Wrong Answer

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

for i in range(N):
    for j in range(M):
        print(1, end=" ")
    print()

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def f(s):
        res = 0
        sum = [[0] for i in range(h+1)]
        sum[0] = [0]*(w+1)
        for y in range(h):
            for x in range(w):
                sum[y+1].append(sum[y+1][-1]^s[y][x])
        for x in range(w+1):
            for y in range(h):
                sum[y+1][x] ^= sum[y][x]
        for i1 in range(h):
            for i2 in range(i1,h):
                for j1 in range(w):
                    for j2 in range(j1,w):
                        su = sum[i2+1][j2+1]^sum[i1][j2+1]^sum[i2+1][j1]^sum[i1][j1]
                        if su:
                            res += 1
        return res
    n,m = LI()
    h,w = (1<<n)-1,(1<<m)-1
    ans = [[1]*w for i in range(h)]
    for i in range(1,h)[::2]:
        for j in range(1 if i%4 == 1 else 3, w)[::4]:
            ans[i][j] = 0
    for i in ans:
        print(*i,sep = "")
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

for i in range(2**N - 1):
  ans = []
  for j in range(2**M-1):
    if j % 2 == 0 and i % 2 == 0:
      ans.append('0')
    elif j % 2 == 1 and i % 2 == 1:
      ans.append('0')
    else:
      ans.append('1')
  print("".join(ans))

Submission status: Wrong Answer

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

def test():
    if n == m:
        flag = False
        for i in range(pow(2,n)-1):
            for j in range(pow(2,m)-1):
                if i ==0 or j==0:
                    print(1, end='')
                elif i==pow(2,n)-2 or j==pow(2,m)-2:
                    print(1, end='')
                else:
                    if flag:
                        print(1, end='')
                    else:
                        print(0, end='')
                    flag = not flag
            print()
        return 0

def main():
    if n == m:
        row = True
        column = True
        for i in range(pow(2,n)-1):
            for j in range(pow(2,m)-1):
                if i == pow(2,n)-2:
                    print(1, end='')
                    continue
                if j <= i-1 or j >= pow(2,m)-1-i:
                    if column:
                        print(1, end='')
                    else:
                        print(0, end='')
                    if j == i-1 or j == pow(2,m)-2:
                        continue
                    column = not column
                else:
                    if row:
                        print(1, end='')
                    else:
                        print(0, end='')
            row = not row
            print()
        return 0
    flag = True
    for i in range(pow(2,n)-1):
        for j in range(pow(2,m)-1):
            if flag:
                print(1, end='')
            else:
                print(0, end='')
            flag = not flag
        print()
    return 0
main()

Submission status: Wrong Answer

Solution code:
def main():
    N, M = (int(i) for i in input().split())
    A = [[1 for j in range(2**M-1)] for i in range(2**N-1)]
    for i in range(N//2 + N, 2**N-1, N*2):
        for j in range(M//2 + M, 2**M-1, M*2):
            A[i][j] = 0
    for i in range(2**N-1):
        for j in range(2**M-1):
            print(A[i][j], end="")
        print()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if M == 1 or M == 2:
  L = [1] * (2 ** M - 1)
  for i in range(2 ** N - 1):
    print("".join(list(map(str, L))))
  exit()

L = [0] * (2 ** M - 1)
for i in range(0, 2 ** M - 1, 6):
  L[i] = 1
R = [0] * (2 ** M - 1)

for i in range(2 ** N - 1):
  if i % 6 == 0:
    print("".join(list(map(str, L))))
  else:
    print("".join(list(map(str, R))))

Submission status: Wrong Answer

Solution code:
def examA():
    S = SI()
    if len(S)%2==1:
        print("No")
        return
    for i in range(len(S)//2):
        if S[i*2:i*2+2]!="hi":
            print("No")
            return
    print("Yes")
    return

def examB():
    a, b, M = LI()
    A = LI()
    B = LI()
    D = [LI()for _ in range(M)]
    ans = min(A) + min(B)
    for x,y,c in D:
        cur = A[x-1]+B[y-1]-c
        ans = min(ans,cur)
    print(ans)
    return

def examC():
    def bfs(n, e, fordfs):
        # 点の数、スタートの点、有向グラフ
        W = [-1] * n
        # 各点の状態量、最短距離とか,見たかどうかとか
        W[e] = 0
        que = deque()
        que.append(e)
        while que:
            now = que.popleft()
            nowW = W[now]
            for ne in fordfs[now]:
                if W[ne] == -1:
                    W[ne] = nowW + 1
                    que.append(ne)
        return W
    N = I()
    V = [[]for _ in range(N)]
    for _ in range(N-1):
        a, b = LI()
        a -= 1
        b -= 1
        V[a].append(b)
        V[b].append(a)
    L = bfs(N,0,V)
    #print(L)
    odd = 0
    for l in L:
        if l==-1:
            print(-1)
            return
        if l%2==1:
            odd += 1
    G = []
    if odd*2<N:
        for i in range(N):
            if L[i]%2==1:
                G.append(i)
    else:
        for i in range(N):
            if L[i]%2==0:
                G.append(i)

    used = [False]*(N+1)
    ans = [0]*N
    if N//3>=len(G):
        cur = 3
        for g in G:
            ans[g] = cur
            used[cur] = True
            cur += 3
        cur = 1
        for i in range(N):
            if ans[i]!=0:
                continue
            while(used[cur]):
                cur += 1
            ans[i] = cur
            used[cur] = True
    else:
        cur = 1
        for g in G:
            ans[g] = cur
            used[cur] = True
            cur += 3
            if cur>N:
                cur = 3
        cur = 1
        for i in range(N):
            if ans[i]!=0:
                continue
            while(used[cur]):
                cur += 1
            ans[i] = cur
            used[cur] = True
    print(" ".join(map(str,ans)))
    return

def examD():
    N, T = LI()


    ans = 0
    print(ans)
    return

def examE():
    N, M = LI()
    H = 2**N-1; W = 2**M -1
    ans = [[0]*W for _ in range(H)]
    for h in range(H):
        flagh = False
        for m in range(1,11)[::-1]:
            if (h+1)%(2**m)==0:
                flagh = 2**m*2
        for w in range(W):
            flagw = False
            for m in range(1,11)[::-1]:
                if (w+1)%(2**m)==0:
                    flagw = 2 ** m * 2
            if flagh and flagw:
                continue
            ans[h][w] = 1
    for v in ans:
        print("".join(map(str,v)))
    return

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

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
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,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examE()

"""

"""

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
if n==1:print("1"*m);exit()
if m==1:
  for i in range(n):print(1)
  exit()
n=2**n-1
m=2**m-1
ans=[m*["1"]for _ in range(n)]
i=j=0
def aaa(i,j):
  global ans
  while i<n and j<m:
    ans[i][j]="0"
    i+=1
    j+=2
while i<n and j<m:
  aaa(i,j)
  i+=2
  j+=1
i=j=0
while i<n and j<m:
  aaa(i,j)
  j+=3
for i in ans:print("".join(i))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N,M = inpl()
H = 2**N-1
W = 2**M-1

ans = [[0] * W for _ in range(H)]
# for i in range(W):
    # for j in range(H):
        # ans[j][i] =

# ans[0][0] = 1
# ans[0][W-1] = 1
# ans[H-1][0] = 1
# ans[H-1][W-1] = 1
# ans[H//2][W//2] = 1
ans[0][W//2] = 1
ans[H-1][W//2] = 1
ans[H//2][0] = 1
ans[H//2][W-1] = 1

for a in ans:
    print("".join(map(str,a)))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
if n == 1:
    print('1' * (2 ** m - 1))
    exit()
if m == 1:
    print('\n'.join('1' * (2 ** n - 1)))
    exit()
ans = ['1' * (2 ** m - 1)] * (2 ** n - 1)
print('\n'.join(ans))

Submission status: Wrong Answer

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

a = ['1']*(2**m-1)
b = ['1']*(2**m-1)

for i in range(2**m-1):
    if i % 2 != 0:
        b[i] = '0'

b[2**(m-1)-1] = '1'

for i in range(2**n-1):
    if i % 2 == 0:
        print(''.join(a))
    else:
        print(''.join(b))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
for i in range(2 ** n - 1):
  print('1' * (2 ** m - 1))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
h = 2 ** n - 1
w = 2 ** m - 1

odd = "10" * (w // 2) + "1"
even = "01" * (w // 2) + "0"

for i in range(1, h + 1):
    if i % 2:
        print(odd)
    else:
        print(even)

Submission status: Wrong Answer

Solution code:
def mi():return map(int,input().split())
n,m=mi()
n=pow(2,n)-1
m=pow(2,m)-1
mod=7
for i in range(n):
    if i%mod==0:
        print("1"*m)
    else:
        print("1"+"001"*((m-1)//mod)+"0"*(m-((m-1)//mod)*mod-1))

Submission status: Wrong Answer

Solution code:
def main():
    N, M = (int(i) for i in input().split())
    A = [[1 for j in range(2**M-1)] for i in range(2**N-1)]
    for i in range(N//2 + N, 2**N-1, N):
        for j in range(M//2 + M, 2**M-1, M):
            A[i][j] = 0
    for i in range(2**N-1):
        for j in range(2**M-1):
            print(A[i][j], end="")
        print()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
X, Y = 2 ** N - 1, 2 ** M - 1
for i in range(X):
  for j in range(Y):
    if i % 3 == 1 and j % 3 == 1:
      print(0, end = '')
    else:
      print(1, end = '')
  print()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
h = 2 ** n - 1
w = 2 ** m - 1

odd = "10" * (w // 2) + "1"
even = "01" * (w // 2) + "0"

for i in range(1, h + 1):
    if i:
        print(odd)
    else:
        print(even)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N,M = inpl()
H = 2**N-1
W = 2**M-1

ans = [[0] * W for _ in range(H)]
# for i in range(W):
    # for j in range(H):
        # ans[j][i] =

ans[0][0] = 1
ans[0][W-1] = 1
ans[H-1][0] = 1
ans[H-1][W-1] = 1
ans[H//2][W//2] = 1
ans[0][W//2] = 1
ans[H-1][W//2] = 1
# ans[H//2][0] = 1
# ans[H//2][W-1] = 1

for a in ans:
    print("".join(map(str,a)))

Submission status: Wrong Answer

Solution code:
def mi():return map(int,input().split())
n,m=mi()
n=pow(2,n)-1
m=pow(2,m)-1

for i in range(n):
    if i%3==0:
        print("1"*m)
    else:
        print("1"+"001"*((m-1)//3)+"0"*(m-((m-1)//3)*3-1))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N,M = inpl()
H = 2**N-1
W = 2**M-1

ans = [[0] * W for _ in range(H)]
# for i in range(W):
    # for j in range(H):
        # ans[j][i] =

ans[0][0] = 1
ans[0][W-1] = 1
ans[H-1][0] = 1
ans[H-1][W-1] = 1
ans[H//2][W//2] = 1
ans[0][W//2] = 1
ans[H-1][W//2] = 1
ans[H//2][0] = 1
ans[H//2][W-1] = 1

for a in ans:
    print("".join(map(str,a)))

Submission status: Wrong Answer

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

L = [0] * (2 ** M - 1)
for i in range(0, 2 ** M - 1, 2):
  L[i] = 1
R = [0] * (2 ** M - 1)

for i in range(2 ** N - 1):
  if i % 2 == 0:
    print("".join(list(map(str, L))))
  else:
    print("".join(list(map(str, R))))

Submission status: Wrong Answer

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

L = [0] * (2 ** M - 1)
for i in range(0, 2 ** M - 1, 2):
  L[i] = 1
R = [0] * (2 ** M - 1)

for i in range(2 ** N - 1):
  if i == 0 or i == 2 ** N - 2:
    print("".join(list(map(str, L))))
  else:
    print("".join(list(map(str, R))))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N,M = inpl()
H = 2**N-1
W = 2**M-1

ans = [[0] * W for _ in range(H)]
# for i in range(W):
    # for j in range(H):
        # ans[j][i] =

ans[0][0] = 1
ans[0][W-1] = 1
ans[H-1][0] = 1
ans[H-1][W-1] = 1
ans[H//2][W//2] = 1

for a in ans:
    print("".join(map(str,a)))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
NN, MM = 2**N-1, 2**M-1
def calc(a):
    return [1 if i % (1<<a+1) == (1<<a) - 1 else 0 for i in range(MM)]

A = [0]
for i in range(N-1):
    A = A + [i+1] + A

for a in A:
    print(*calc(a))

Submission status: Wrong Answer

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

ans = []
for i in range(2**N - 1):
    if i%5 == 0:
        print(''.join(["0" if j%5 == 3 else "1" for j in range(2**M - 1)]))
    elif i%5 == 1:
        print(''.join(["0" if j%5 == 1 else "1" for j in range(2**M - 1)]))
    elif i%5 == 2:
        print(''.join(["0" if j%5 == 4 else "1" for j in range(2**M - 1)]))
    elif i%5 == 3:
        print(''.join(["0" if j%5 == 2 else "1" for j in range(2**M - 1)]))
    elif i%5 == 4:
        print(''.join(["0" if j%5 == 0 else "1" for j in range(2**M - 1)]))
        #print(''.join(['1'] * (2**M - 1)))
    #    print(''.join([str(j%2) for j in range(2**M - 1)]))
    #elif i%4 == 1:
    #    print(''.join([str(j%2) for j in range(2**M - 1)]))
    #else:
    #    print(''.join([str((j+1)%2) for j in range(2**M - 1)]))

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def f(s):
        res = 0
        sum = [[0] for i in range(h+1)]
        sum[0] = [0]*(w+1)
        for y in range(h):
            for x in range(w):
                sum[y+1].append(sum[y+1][-1]^s[y][x])
        for x in range(w+1):
            for y in range(h):
                sum[y+1][x] ^= sum[y][x]
        for i1 in range(h):
            for i2 in range(i1,h):
                for j1 in range(w):
                    for j2 in range(j1,w):
                        su = sum[i2+1][j2+1]^sum[i1][j2+1]^sum[i2+1][j1]^sum[i1][j1]
                        if su:
                            res += 1
        return res
    n,m = LI()
    h,w = (1<<n)-1,(1<<m)-1
    ans = [[1]*w for i in range(h)]
    if w < h:
        for i in range(1,w)[::2]:
            ans[i][i] = 0
            ans[h-i-1][i] = 0
    else:
        for i in range(1,h)[::2]:
            ans[i][i] = 0
            ans[i][w-i-1] = 0
    for i in ans:
        print(*i,sep = "")
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N,M = inpl()
H = 2**N-1
W = 2**M-1

ans = [[0] * W for _ in range(H)]
# for i in range(W):
    # for j in range(H):
        # ans[j][i] =

ans[0][0] = 1
ans[0][W-1] = 1
ans[H-1][0] = 1
ans[H-1][W-1] = 1


for a in ans:
    print("".join(map(str,a)))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
for i in range(2**n-1):
    if i%2==0:
        print("1"*(2**m-1))
    else:
        for j in range(2**(m-1)-1):
            print(10,end="")
        print(1)

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline

    N, M = map(int, input().split())

    grid = [[0] * (2**M-1) for _ in range(2**N-1)]
    for i in range(2**N-1):
        for j in range(2**M-1):
            if i&1:
                grid[i][j] = (j&1) ^ 1
            else:
                grid[i][j] = 1
    for i in range(2**N-1):
        print(''.join(map(str, grid[i])))


if __name__ == '__main__':
    main()