Submission #1037861


Source Code Expand

ans = []
def f(k, x, y, t):
    if k == 0:
        ans.append("%d %d" % (x, y))
        #ans.append((x, y))
        return
    a = 2**(k-1)
    nx = x if t else x+1
    ny = y if not t else y+1
    if t:
        f(k-1, x+a, y+a, t)
        ans.append("%d %d" % (x, y))
        f(k-1, nx, ny, t)
    else:
        f(k-1, x+a, y+a, t)
        ans.append("%d %d" % (x, y))
        f(k-1, nx, ny, t)
    #ans.append((x, y))
N = 11
f(N-1, 0, 1, 1)
ans.append("%d %d" % (0, 0))
f(N-1, 1, 0, 0)
#ans.append((0, 0))
print "\n".join(ans)

Submission Info

Submission Time
Task B - Binary Tree
User sugopurochakku
Language Python (2.7.6)
Score 0
Code Size 553 Byte
Status WA
Exec Time 21 ms
Memory 2820 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
WA × 1
Set Name Test Cases
All 1.txt
Case Name Status Exec Time Memory
1.txt WA 21 ms 2820 KB