QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#429798#5434. Binary SubstringscmnxAC ✓195ms22124kbPython36.5kb2024-06-02 21:01:452024-06-02 21:01:45

Judging History

你现在查看的是最新测评结果

  • [2024-06-02 21:01:45]
  • 评测
  • 测评结果:AC
  • 用时:195ms
  • 内存:22124kb
  • [2024-06-02 21:01:45]
  • 提交

answer

from typing import List, Tuple


def max2(a: int, b: int) -> int:
    return a if a > b else b


def maxNumDistinctNonemptySubstrings(n: int) -> str:
    n0 = n
    n = 1
    while (1 << n) + (n - 1) < n0:
        n += 1

    def cal() -> str:
        if n == 1:
            return "01"
        if n == 2:
            return "00110"

        def shift(x: str, y: str) -> str:
            m = len(x)
            x += x
            for i in range(m, m + m):
                if x[i - len(y) : i] == y:
                    return x[i - m : i]
            return ""

        def oplus(x: str, y: str) -> str:
            m = len(y).bit_length() - 1
            return x + shift(y, x[len(x) - m :])

        def no(x: str) -> str:
            return "".join("0" if s == "1" else "1" for s in x)

        def psi(x: str) -> str:
            res = []
            a = 0
            for v in x:
                a ^= int(v)
                res.append(str(a))
            return "".join(res)

        def nxt(x: str) -> str:
            x = psi(x)
            return oplus(x, no(x))

        def otimes(x: str, y: str) -> str:
            t = ["0"] * (len(x).bit_length() - 1)
            x = shift(x, "".join(t))
            y = shift(y, "".join(t))
            x = x[-len(t) :] + x[: len(x) - len(t)]
            y = y[-len(t) :] + y[: len(y) - len(t)]

            x0, x1, y0, y1 = 0, 0, 0, 1
            for k, v in runLength(x):
                if k == "0":
                    x0 = max2(x0, v)
                if k == "1":
                    x1 = max2(x1, v)
            for k, v in runLength(y):
                if k == "0":
                    y0 = max2(y0, v)
                if k == "1":
                    y1 = max2(y1, v)
            sbX, sbY = [], []
            for k, v in runLength(x):
                if k == "0" and v < x0:
                    sbX.append(k * v)
                if k == "0" and v == x0:
                    sbX.append(k * (v - 1))
                if k == "1" and v < x1:
                    sbX.append(k * v)
                if k == "1" and v == x1:
                    sbX.append(k * (v + 1))
            for k, v in runLength(y):
                if k == "0" and v < y0:
                    sbY.append(k * v)
                if k == "0" and v == y0:
                    sbY.append(k * (v + 1))
                if k == "1" and v < y1:
                    sbY.append(k * v)
                if k == "1" and v == y1:
                    sbY.append(k * (v - 1))
            return "".join(sbX) + "".join(sbY)

        x, y = "0011", "0011"
        for i in range(2, n - 1):
            t = "1" * i
            x = shift(x, t)
            x = nxt(x)
            y = shift(y, t)
            y = no(nxt(y))
        x = otimes(x, y)
        for i in range(n - 1):
            x += x[i]
        return x

    return cal()[:n0]


def runLength(s: str) -> List[Tuple[str, int]]:
    res = []
    for x in s:
        if not res or res[-1][0] != x:
            res.append([x, 0])
        res[-1][1] += 1
    return res


def countDistinct(s: str) -> int:
    """给定一个字符串 s, 返回 s 的不同子字符串的个数。"""

    def useSA(ords: List[int]) -> Tuple[List[int], List[int], List[int]]:
        """返回 sa, rank, height 数组.ord值很大时,需要先离散化.

        Args:
            ords: 可比较的整数序列

        Returns:
            sa: 每个排名对应的后缀
            rank: 每个后缀对应的排名
            height: 第 i 名的后缀与它前一名的后缀的 `最长公共前缀(LCP)`的长度
        """
        sa = getSA(ords)
        n, k = len(sa), 0
        rank, height = [0] * n, [0] * n
        for i, saIndex in enumerate(sa):
            rank[saIndex] = i

        for i in range(n):
            if k > 0:
                k -= 1
            while (
                i + k < n
                and rank[i] - 1 >= 0
                and sa[rank[i] - 1] + k < n
                and ords[i + k] == ords[sa[rank[i] - 1] + k]
            ):
                k += 1
            height[rank[i]] = k
        return sa, rank, height

    def getSA(ords: List[int]) -> List[int]:
        """
        返回sa数组 即每个排名对应的后缀.
        ord值很大时,需要先离散化.
        """

        def inducedSort(LMS: List[int]) -> List[int]:
            SA = [-1] * (n)
            SA.append(n)
            endpoint = buckets[1:]
            for j in reversed(LMS):
                endpoint[ords[j]] -= 1
                SA[endpoint[ords[j]]] = j
            startpoint = buckets[:-1]
            for i in range(-1, n):
                j = SA[i] - 1
                if j >= 0 and isL[j]:
                    SA[startpoint[ords[j]]] = j
                    startpoint[ords[j]] += 1
            SA.pop()
            endpoint = buckets[1:]
            for i in reversed(range(n)):
                j = SA[i] - 1
                if j >= 0 and not isL[j]:
                    endpoint[ords[j]] -= 1
                    SA[endpoint[ords[j]]] = j
            return SA

        n = len(ords)
        buckets = [0] * (max(ords) + 2)
        for a in ords:
            buckets[a + 1] += 1
        for b in range(1, len(buckets)):
            buckets[b] += buckets[b - 1]
        isL = [1] * n
        for i in reversed(range(n - 1)):
            isL[i] = +(ords[i] > ords[i + 1]) if ords[i] != ords[i + 1] else isL[i + 1]

        isLMS = [+(i and isL[i - 1] and not isL[i]) for i in range(n)]
        isLMS.append(1)
        lms1 = [i for i in range(n) if isLMS[i]]
        if len(lms1) > 1:
            SA = inducedSort(lms1)
            LMS2 = [i for i in SA if isLMS[i]]
            pre = -1
            j = 0
            for i in LMS2:
                i1 = pre
                i2 = i
                while pre >= 0 and ords[i1] == ords[i2]:
                    i1 += 1
                    i2 += 1
                    if isLMS[i1] or isLMS[i2]:
                        j -= isLMS[i1] and isLMS[i2]
                        break
                j += 1
                pre = i
                SA[i] = j
            lms1 = [lms1[i] for i in getSA([SA[i] for i in lms1])]

        return inducedSort(lms1)

    if len(s) == 0:
        return 0
    *_, height = useSA(list(map(ord, s)))
    n = len(s)
    return n * (n + 1) // 2 - sum(height)




if __name__ == "__main__":
    n = int(input())
    print(maxNumDistinctNonemptySubstrings(n))

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 16ms
memory: 11648kb

input:

2

output:

01

result:

ok meet maximum 3

Test #2:

score: 0
Accepted
time: 16ms
memory: 11532kb

input:

5

output:

00110

result:

ok meet maximum 12

Test #3:

score: 0
Accepted
time: 19ms
memory: 11544kb

input:

1

output:

0

result:

ok meet maximum 1

Test #4:

score: 0
Accepted
time: 10ms
memory: 11652kb

input:

3

output:

001

result:

ok meet maximum 5

Test #5:

score: 0
Accepted
time: 21ms
memory: 11532kb

input:

4

output:

0011

result:

ok meet maximum 8

Test #6:

score: 0
Accepted
time: 8ms
memory: 11480kb

input:

6

output:

011100

result:

ok meet maximum 16

Test #7:

score: 0
Accepted
time: 10ms
memory: 11652kb

input:

7

output:

0111000

result:

ok meet maximum 21

Test #8:

score: 0
Accepted
time: 15ms
memory: 11536kb

input:

8

output:

01110001

result:

ok meet maximum 27

Test #9:

score: 0
Accepted
time: 10ms
memory: 11548kb

input:

9

output:

011100010

result:

ok meet maximum 34

Test #10:

score: 0
Accepted
time: 15ms
memory: 11524kb

input:

10

output:

0111000101

result:

ok meet maximum 42

Test #11:

score: 0
Accepted
time: 10ms
memory: 11656kb

input:

11

output:

00101111000

result:

ok meet maximum 50

Test #12:

score: 0
Accepted
time: 20ms
memory: 11608kb

input:

12

output:

001011110000

result:

ok meet maximum 59

Test #13:

score: 0
Accepted
time: 175ms
memory: 22096kb

input:

200000

output:

000000000000000010010011100111101101111100000000100100010111001011011101111011001001001110010101101000011110011111101111100101011010001100001011111011010111001011011111000010111110011011000010110101001011000010011010110010011010100010111011111001101100100110101010010101111110010000101110110101100101...

result:

ok meet maximum 19996962278

Test #14:

score: 0
Accepted
time: 13ms
memory: 11652kb

input:

24

output:

000110101111100100000101

result:

ok meet maximum 240

Test #15:

score: 0
Accepted
time: 11ms
memory: 11544kb

input:

35

output:

00011010111110010000010100111011000

result:

ok meet maximum 526

Test #16:

score: 0
Accepted
time: 14ms
memory: 11540kb

input:

30

output:

000110101111100100000101001110

result:

ok meet maximum 381

Test #17:

score: 0
Accepted
time: 9ms
memory: 11612kb

input:

45

output:

000010011010001111110110010101110000001100010

result:

ok meet maximum 882

Test #18:

score: 0
Accepted
time: 14ms
memory: 11616kb

input:

66

output:

000010011010001111110110010101110000001100010110111100111010100100

result:

ok meet maximum 1953

Test #19:

score: 0
Accepted
time: 11ms
memory: 11532kb

input:

50

output:

00001001101000111111011001010111000000110001011011

result:

ok meet maximum 1097

Test #20:

score: 0
Accepted
time: 19ms
memory: 11516kb

input:

80

output:

00000111011000010100100011001011111110001001111010101101110011010000000100001101

result:

ok meet maximum 2901

Test #21:

score: 0
Accepted
time: 20ms
memory: 11488kb

input:

107

output:

00000111011000010100100011001011111110001001111010101101110011010000000100001101101011101001100011111011110

result:

ok meet maximum 5277

Test #22:

score: 0
Accepted
time: 12ms
memory: 11488kb

input:

81

output:

000001110110000101001000110010111111100010011110101011011100110100000001000011011

result:

ok meet maximum 2976

Test #23:

score: 0
Accepted
time: 19ms
memory: 11548kb

input:

147

output:

000000101101111100111000010001101010000111010110011011010001001111111101001000001100011110111001010101111000101001100100101110110000000011111011011

result:

ok meet maximum 10124

Test #24:

score: 0
Accepted
time: 14ms
memory: 11492kb

input:

255

output:

000000101101111100111000010001101010000111010110011011010001001111111101001000001100011110111001010101111000101001100100101110110000000011111011011001011000100001010110101110001100111100100010111111000001001001101001110111101010100101000111001100001101110

result:

ok meet maximum 31130

Test #25:

score: 0
Accepted
time: 16ms
memory: 11548kb

input:

173

output:

00000010110111110011100001000110101000011101011001101101000100111111110100100000110001111011100101010111100010100110010010111011000000001111101101100101100010000101011010111

result:

ok meet maximum 14115

Test #26:

score: 0
Accepted
time: 19ms
memory: 11568kb

input:

288

output:

000000011011010100010111110000100110000010110010001001001111000101010011100000010000101001011100110010100001100010001110010110111111111001001010111010000011110110011111010011011101101100001110101010110001111110111101011010001100110101111001110111000110100100000000010101101101110010000111

result:

ok meet maximum 39850

Test #27:

score: 0
Accepted
time: 16ms
memory: 11552kb

input:

407

output:

000000011011010100010111110000100110000010110010001001001111000101010011100000010000101001011100110010100001100010001110010110111111111001001010111010000011110110011111010011011101101100001110101010110001111110111101011010001100110101111001110111000110100100000000010101101101110010000111110011011001...

result:

ok meet maximum 80310

Test #28:

score: 0
Accepted
time: 12ms
memory: 11544kb

input:

349

output:

000000011011010100010111110000100110000010110010001001001111000101010011100000010000101001011100110010100001100010001110010110111111111001001010111010000011110110011111010011011101101100001110101010110001111110111101011010001100110101111001110111000110100100000000010101101101110010000111110011011001...

result:

ok meet maximum 58821

Test #29:

score: 0
Accepted
time: 16ms
memory: 11584kb

input:

526

output:

000000001001001100001101010000011101111110010001111000111010111100110001011111110000011000110100010001100000100001111010001101101010100011100110100111111010110111010100111011010010010000010110011001000010101001010011011000010001001101011101001011110110001111111111011011001111001010111110001000000110...

result:

ok meet maximum 134925

Test #30:

score: 0
Accepted
time: 20ms
memory: 11640kb

input:

1018

output:

000000001001001100001101010000011101111110010001111000111010111100110001011111110000011000110100010001100000100001111010001101101010100011100110100111111010110111010100111011010010010000010110011001000010101001010011011000010001001101011101001011110110001111111111011011001111001010111110001000000110...

result:

ok meet maximum 510567

Test #31:

score: 0
Accepted
time: 20ms
memory: 11584kb

input:

1017

output:

000000001001001100001101010000011101111110010001111000111010111100110001011111110000011000110100010001100000100001111010001101101010100011100110100111111010110111010100111011010010010000010110011001000010101001010011011000010001001101011101001011110110001111111111011011001111001010111110001000000110...

result:

ok meet maximum 509558

Test #32:

score: 0
Accepted
time: 21ms
memory: 11620kb

input:

1209

output:

000000000111000100000100110000001011010101110000101000010110010100010000110101010000001000010011110000100000011111010110000100100110011110100010011101010110010010110011101001001110001111110010001000111110011000110001001000001111000100110100111001010010000101010100100100010100011001010111100000001001...

result:

ok meet maximum 721446

Test #33:

score: 0
Accepted
time: 7ms
memory: 11572kb

input:

1632

output:

000000000111000100000100110000001011010101110000101000010110010100010000110101010000001000010011110000100000011111010110000100100110011110100010011101010110010010110011101001001110001111110010001000111110011000110001001000001111000100110100111001010010000101010100100100010100011001010111100000001001...

result:

ok meet maximum 1318299

Test #34:

score: 0
Accepted
time: 14ms
memory: 11628kb

input:

1829

output:

000000000111000100000100110000001011010101110000101000010110010100010000110101010000001000010011110000100000011111010110000100100110011110100010011101010110010010110011101001001110001111110010001000111110011000110001001000001111000100110100111001010010000101010100100100010100011001010111100000001001...

result:

ok meet maximum 1657336

Test #35:

score: 0
Accepted
time: 19ms
memory: 11856kb

input:

3187

output:

000000000010111100000011101111111001001100101111100111110010001100001111101100110000000111110001010000011111110101001101111100011101110101100001110100110010001110010001011000111010000101010001111000010101110111101111000111111010111100010011101000110001111100110011100011110011110111001101011111111000...

result:

ok meet maximum 5049170

Test #36:

score: 0
Accepted
time: 19ms
memory: 11744kb

input:

2138

output:

000000000010111100000011101111111001001100101111100111110010001100001111101100110000000111110001010000011111110101001101111100011101110101100001110100110010001110010001011000111010000101010001111000010101110111101111000111111010111100010011101000110001111100110011100011110011110111001101011111111000...

result:

ok meet maximum 2267222

Test #37:

score: 0
Accepted
time: 23ms
memory: 11744kb

input:

4030

output:

000000000010111100000011101111111001001100101111100111110010001100001111101100110000000111110001010000011111110101001101111100011101110101100001110100110010001110010001011000111010000101010001111000010101110111101111000111111010111100010011101000110001111100110011100011110011110111001101011111111000...

result:

ok meet maximum 8082284

Test #38:

score: 0
Accepted
time: 11ms
memory: 11900kb

input:

6101

output:

000000000001101011111110100101010111000100011010100010101110000100000101011011101111111101010000110000001010101100111011010100001011010011011111010011101110000101110000110111101001111100110000101000001100101101011010111101010110010100001110100111101111010100010001011110101110101101000100110101010111...

result:

ok meet maximum 18549195

Test #39:

score: 0
Accepted
time: 14ms
memory: 11924kb

input:

5917

output:

000000000001101011111110100101010111000100011010100010101110000100000101011011101111111101010000110000001010101100111011010100001011010011011111010011101110000101110000110111101001111100110000101000001100101101011010111101010110010100001110100111101111010100010001011110101110101101000100110101010111...

result:

ok meet maximum 17445655

Test #40:

score: 0
Accepted
time: 20ms
memory: 11996kb

input:

6635

output:

000000000001101011111110100101010111000100011010100010101110000100000101011011101111111101010000110000001010101100111011010100001011010011011111010011101110000101110000110111101001111100110000101000001100101101011010111101010110010100001110100111101111010100010001011110101110101101000100110101010111...

result:

ok meet maximum 21943566

Test #41:

score: 0
Accepted
time: 26ms
memory: 12224kb

input:

9993

output:

000000000000100110101010011100110010111100001001100001100101111100000011001001011010101011001111101111111001100100010110110011111001001110110101001110100101111100101111101101011000101011101111100111111011100100110110010100110010001100000101100010100101001100001111001010011010011011000011101100110010...

result:

ok meet maximum 49821572

Test #42:

score: 0
Accepted
time: 30ms
memory: 12188kb

input:

14474

output:

000000000000100110101010011100110010111100001001100001100101111100000011001001011010101011001111101111111001100100010110110011111001001110110101001110100101111100101111101101011000101011101111100111111011100100110110010100110010001100000101100010100101001100001111001010011010011011000011101100110010...

result:

ok meet maximum 104583873

Test #43:

score: 0
Accepted
time: 31ms
memory: 12248kb

input:

11534

output:

000000000000100110101010011100110010111100001001100001100101111100000011001001011010101011001111101111111001100100010110110011111001001110110101001110100101111100101111101101011000101011101111100111111011100100110110010100110010001100000101100010100101001100001111001010011010011011000011101100110010...

result:

ok meet maximum 66388863

Test #44:

score: 0
Accepted
time: 27ms
memory: 12772kb

input:

19098

output:

000000000000011101100110001011101110010100000111011111011100101011111110111000110110011001000101011010101000100011110010010001010111000101101100111010011100101011100101011011001000011001011010100010101001011100010010001100010001111011111100100001100011000100000101000110001001110110111110100100010001...

result:

ok meet maximum 182141836

Test #45:

score: 0
Accepted
time: 33ms
memory: 12680kb

input:

31872

output:

000000000000011101100110001011101110010100000111011111011100101011111110111000110110011001000101011010101000100011110010010001010111000101101100111010011100101011100101011011001000011001011010100010101001011100010010001100010001111011111100100001100011000100000101000110001001110110111110100100010001...

result:

ok meet maximum 507514777

Test #46:

score: 0
Accepted
time: 29ms
memory: 12600kb

input:

27626

output:

000000000000011101100110001011101110010100000111011111011100101011111110111000110110011001000101011010101000100011110010010001010111000101101100111010011100101011100101011011001000011001011010100010101001011100010010001100010001111011111100100001100011000100000101000110001001110110111110100100010001...

result:

ok meet maximum 381257844

Test #47:

score: 0
Accepted
time: 62ms
memory: 14172kb

input:

43245

output:

000000000000001011011101111001011010001100000010110101001011100110101010010111101101110111000011001001100111100001010001110000110010111100100100010110001011100110100011001001000111110111001001100001100111001011110001111011110000101001010100011111011110111100000011000010000111010010010101100011110000...

result:

ok meet maximum 934503599

Test #48:

score: 0
Accepted
time: 52ms
memory: 14180kb

input:

34491

output:

000000000000001011011101111001011010001100000010110101001011100110101010010111101101110111000011001001100111100001010001110000110010111100100100010110001011100110100011001001000111110111001001100001100111001011110001111011110000101001010100011111011110111100000011000010000111010010010101100011110000...

result:

ok meet maximum 594380060

Test #49:

score: 0
Accepted
time: 54ms
memory: 14192kb

input:

64535

output:

000000000000001011011101111001011010001100000010110101001011100110101010010111101101110111000011001001100111100001010001110000110010111100100100010110001011100110100011001001000111110111001001100001100111001011110001111011110000101001010100011111011110111100000011000010000111010010010101100011110000...

result:

ok meet maximum 2081512994

Test #50:

score: 0
Accepted
time: 115ms
memory: 16896kb

input:

65746

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 2160380385

Test #51:

score: 0
Accepted
time: 106ms
memory: 16776kb

input:

65861

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 2167946005

Test #52:

score: 0
Accepted
time: 102ms
memory: 16756kb

input:

66725

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 2225209765

Test #53:

score: 0
Accepted
time: 107ms
memory: 16812kb

input:

86349

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 3726867681

Test #54:

score: 0
Accepted
time: 102ms
memory: 16844kb

input:

68454

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 2342045211

Test #55:

score: 0
Accepted
time: 95ms
memory: 16828kb

input:

112260

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 6299544960

Test #56:

score: 0
Accepted
time: 106ms
memory: 16812kb

input:

108023

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 5832941098

Test #57:

score: 0
Accepted
time: 105ms
memory: 16848kb

input:

103787

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 5384393176

Test #58:

score: 0
Accepted
time: 87ms
memory: 16812kb

input:

128710

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 8281268235

Test #59:

score: 0
Accepted
time: 107ms
memory: 16844kb

input:

129534

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 8387651991

Test #60:

score: 0
Accepted
time: 102ms
memory: 16840kb

input:

128670

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 8276121255

Test #61:

score: 0
Accepted
time: 192ms
memory: 22100kb

input:

154721

output:

000000000000000010010011100111101101111100000000100100010111001011011101111011001001001110010101101000011110011111101111100101011010001100001011111011010111001011011111000010111110011011000010110101001011000010011010110010011010100010111011111001101100100110101010010101111110010000101110110101100101...

result:

ok meet maximum 11967003302

Test #62:

score: 0
Accepted
time: 184ms
memory: 22124kb

input:

143149

output:

000000000000000010010011100111101101111100000000100100010111001011011101111011001001001110010101101000011110011111101111100101011010001100001011111011010111001011011111000010111110011011000010110101001011000010011010110010011010100010111011111001101100100110101010010101111110010000101110110101100101...

result:

ok meet maximum 10243718420

Test #63:

score: 0
Accepted
time: 189ms
memory: 21996kb

input:

134065

output:

000000000000000010010011100111101101111100000000100100010111001011011101111011001001001110010101101000011110011111101111100101011010001100001011111011010111001011011111000010111110011011000010110101001011000010011010110010011010100010111011111001101100100110101010010101111110010000101110110101100101...

result:

ok meet maximum 8984762318

Test #64:

score: 0
Accepted
time: 179ms
memory: 21972kb

input:

163454

output:

000000000000000010010011100111101101111100000000100100010111001011011101111011001001001110010101101000011110011111101111100101011010001100001011111011010111001011011111000010111110011011000010110101001011000010011010110010011010100010111011111001101100100110101010010101111110010000101110110101100101...

result:

ok meet maximum 13356170345

Test #65:

score: 0
Accepted
time: 183ms
memory: 22012kb

input:

139150

output:

000000000000000010010011100111101101111100000000100100010111001011011101111011001001001110010101101000011110011111101111100101011010001100001011111011010111001011011111000010111110011011000010110101001011000010011010110010011010100010111011111001101100100110101010010101111110010000101110110101100101...

result:

ok meet maximum 9679327553

Test #66:

score: 0
Accepted
time: 189ms
memory: 22084kb

input:

172380

output:

000000000000000010010011100111101101111100000000100100010111001011011101111011001001001110010101101000011110011111101111100101011010001100001011111011010111001011011111000010111110011011000010110101001011000010011010110010011010100010111011111001101100100110101010010101111110010000101110110101100101...

result:

ok meet maximum 14854850208

Test #67:

score: 0
Accepted
time: 183ms
memory: 21992kb

input:

178166

output:

000000000000000010010011100111101101111100000000100100010111001011011101111011001001001110010101101000011110011111101111100101011010001100001011111011010111001011011111000010111110011011000010110101001011000010011010110010011010100010111011111001101100100110101010010101111110010000101110110101100101...

result:

ok meet maximum 15868884317

Test #68:

score: 0
Accepted
time: 193ms
memory: 22020kb

input:

143651

output:

000000000000000010010011100111101101111100000000100100010111001011011101111011001001001110010101101000011110011111101111100101011010001100001011111011010111001011011111000010111110011011000010110101001011000010011010110010011010100010111011111001101100100110101010010101111110010000101110110101100101...

result:

ok meet maximum 10315696937

Test #69:

score: 0
Accepted
time: 188ms
memory: 22080kb

input:

198199

output:

000000000000000010010011100111101101111100000000100100010111001011011101111011001001001110010101101000011110011111101111100101011010001100001011111011010111001011011111000010111110011011000010110101001011000010011010110010011010100010111011111001101100100110101010010101111110010000101110110101100101...

result:

ok meet maximum 19638413795

Test #70:

score: 0
Accepted
time: 195ms
memory: 22124kb

input:

186272

output:

000000000000000010010011100111101101111100000000100100010111001011011101111011001001001110010101101000011110011111101111100101011010001100001011111011010111001011011111000010111110011011000010110101001011000010011010110010011010100010111011111001101100100110101010010101111110010000101110110101100101...

result:

ok meet maximum 17345817782

Test #71:

score: 0
Accepted
time: 173ms
memory: 22028kb

input:

198102

output:

000000000000000010010011100111101101111100000000100100010111001011011101111011001001001110010101101000011110011111101111100101011010001100001011111011010111001011011111000010111110011011000010110101001011000010011010110010011010100010111011111001101100100110101010010101111110010000101110110101100101...

result:

ok meet maximum 19619194797

Test #72:

score: 0
Accepted
time: 22ms
memory: 11916kb

input:

8201

output:

000000000001101011111110100101010111000100011010100010101110000100000101011011101111111101010000110000001010101100111011010100001011010011011111010011101110000101110000110111101001111100110000101000001100101101011010111101010110010100001110100111101111010100010001011110101110101101000100110101010111...

result:

ok meet maximum 33542145

Test #73:

score: 0
Accepted
time: 24ms
memory: 11984kb

input:

8202

output:

000000000001101011111110100101010111000100011010100010101110000100000101011011101111111101010000110000001010101100111011010100001011010011011111010011101110000101110000110111101001111100110000101000001100101101011010111101010110010100001110100111101111010100010001011110101110101101000100110101010111...

result:

ok meet maximum 33550335

Test #74:

score: 0
Accepted
time: 22ms
memory: 12048kb

input:

8203

output:

000000000001101011111110100101010111000100011010100010101110000100000101011011101111111101010000110000001010101100111011010100001011010011011111010011101110000101110000110111101001111100110000101000001100101101011010111101010110010100001110100111101111010100010001011110101110101101000100110101010111...

result:

ok meet maximum 33558526

Test #75:

score: 0
Accepted
time: 22ms
memory: 11924kb

input:

8204

output:

000000000001101011111110100101010111000100011010100010101110000100000101011011101111111101010000110000001010101100111011010100001011010011011111010011101110000101110000110111101001111100110000101000001100101101011010111101010110010100001110100111101111010100010001011110101110101101000100110101010111...

result:

ok meet maximum 33566718

Test #76:

score: 0
Accepted
time: 27ms
memory: 12312kb

input:

8205

output:

000000000000100110101010011100110010111100001001100001100101111100000011001001011010101011001111101111111001100100010110110011111001001110110101001110100101111100101111101101011000101011101111100111111011100100110110010100110010001100000101100010100101001100001111001010011010011011000011101100110010...

result:

ok meet maximum 33574910

Test #77:

score: 0
Accepted
time: 24ms
memory: 12144kb

input:

8206

output:

000000000000100110101010011100110010111100001001100001100101111100000011001001011010101011001111101111111001100100010110110011111001001110110101001110100101111100101111101101011000101011101111100111111011100100110110010100110010001100000101100010100101001100001111001010011010011011000011101100110010...

result:

ok meet maximum 33583103

Test #78:

score: 0
Accepted
time: 22ms
memory: 12232kb

input:

16394

output:

000000000000100110101010011100110010111100001001100001100101111100000011001001011010101011001111101111111001100100010110110011111001001110110101001110100101111100101111101101011000101011101111100111111011100100110110010100110010001100000101100010100101001100001111001010011010011011000011101100110010...

result:

ok meet maximum 134193153

Test #79:

score: 0
Accepted
time: 22ms
memory: 12216kb

input:

16395

output:

000000000000100110101010011100110010111100001001100001100101111100000011001001011010101011001111101111111001100100010110110011111001001110110101001110100101111100101111101101011000101011101111100111111011100100110110010100110010001100000101100010100101001100001111001010011010011011000011101100110010...

result:

ok meet maximum 134209535

Test #80:

score: 0
Accepted
time: 25ms
memory: 12192kb

input:

16396

output:

000000000000100110101010011100110010111100001001100001100101111100000011001001011010101011001111101111111001100100010110110011111001001110110101001110100101111100101111101101011000101011101111100111111011100100110110010100110010001100000101100010100101001100001111001010011010011011000011101100110010...

result:

ok meet maximum 134225918

Test #81:

score: 0
Accepted
time: 26ms
memory: 12196kb

input:

16397

output:

000000000000100110101010011100110010111100001001100001100101111100000011001001011010101011001111101111111001100100010110110011111001001110110101001110100101111100101111101101011000101011101111100111111011100100110110010100110010001100000101100010100101001100001111001010011010011011000011101100110010...

result:

ok meet maximum 134242302

Test #82:

score: 0
Accepted
time: 37ms
memory: 12708kb

input:

16398

output:

000000000000011101100110001011101110010100000111011111011100101011111110111000110110011001000101011010101000100011110010010001010111000101101100111010011100101011100101011011001000011001011010100010101001011100010010001100010001111011111100100001100011000100000101000110001001110110111110100100010001...

result:

ok meet maximum 134258686

Test #83:

score: 0
Accepted
time: 37ms
memory: 12748kb

input:

16399

output:

000000000000011101100110001011101110010100000111011111011100101011111110111000110110011001000101011010101000100011110010010001010111000101101100111010011100101011100101011011001000011001011010100010101001011100010010001100010001111011111100100001100011000100000101000110001001110110111110100100010001...

result:

ok meet maximum 134275071

Test #84:

score: 0
Accepted
time: 26ms
memory: 12700kb

input:

32779

output:

000000000000011101100110001011101110010100000111011111011100101011111110111000110110011001000101011010101000100011110010010001010111000101101100111010011100101011100101011011001000011001011010100010101001011100010010001100010001111011111100100001100011000100000101000110001001110110111110100100010001...

result:

ok meet maximum 536821761

Test #85:

score: 0
Accepted
time: 41ms
memory: 12692kb

input:

32780

output:

000000000000011101100110001011101110010100000111011111011100101011111110111000110110011001000101011010101000100011110010010001010111000101101100111010011100101011100101011011001000011001011010100010101001011100010010001100010001111011111100100001100011000100000101000110001001110110111110100100010001...

result:

ok meet maximum 536854527

Test #86:

score: 0
Accepted
time: 27ms
memory: 12796kb

input:

32781

output:

000000000000011101100110001011101110010100000111011111011100101011111110111000110110011001000101011010101000100011110010010001010111000101101100111010011100101011100101011011001000011001011010100010101001011100010010001100010001111011111100100001100011000100000101000110001001110110111110100100010001...

result:

ok meet maximum 536887294

Test #87:

score: 0
Accepted
time: 29ms
memory: 12704kb

input:

32782

output:

000000000000011101100110001011101110010100000111011111011100101011111110111000110110011001000101011010101000100011110010010001010111000101101100111010011100101011100101011011001000011001011010100010101001011100010010001100010001111011111100100001100011000100000101000110001001110110111110100100010001...

result:

ok meet maximum 536920062

Test #88:

score: 0
Accepted
time: 52ms
memory: 14152kb

input:

32783

output:

000000000000001011011101111001011010001100000010110101001011100110101010010111101101110111000011001001100111100001010001110000110010111100100100010110001011100110100011001001000111110111001001100001100111001011110001111011110000101001010100011111011110111100000011000010000111010010010101100011110000...

result:

ok meet maximum 536952830

Test #89:

score: 0
Accepted
time: 57ms
memory: 14132kb

input:

32784

output:

000000000000001011011101111001011010001100000010110101001011100110101010010111101101110111000011001001100111100001010001110000110010111100100100010110001011100110100011001001000111110111001001100001100111001011110001111011110000101001010100011111011110111100000011000010000111010010010101100011110000...

result:

ok meet maximum 536985599

Test #90:

score: 0
Accepted
time: 54ms
memory: 14128kb

input:

65548

output:

000000000000001011011101111001011010001100000010110101001011100110101010010111101101110111000011001001100111100001010001110000110010111100100100010110001011100110100011001001000111110111001001100001100111001011110001111011110000101001010100011111011110111100000011000010000111010010010101100011110000...

result:

ok meet maximum 2147385345

Test #91:

score: 0
Accepted
time: 59ms
memory: 14172kb

input:

65549

output:

000000000000001011011101111001011010001100000010110101001011100110101010010111101101110111000011001001100111100001010001110000110010111100100100010110001011100110100011001001000111110111001001100001100111001011110001111011110000101001010100011111011110111100000011000010000111010010010101100011110000...

result:

ok meet maximum 2147450879

Test #92:

score: 0
Accepted
time: 54ms
memory: 14180kb

input:

65550

output:

000000000000001011011101111001011010001100000010110101001011100110101010010111101101110111000011001001100111100001010001110000110010111100100100010110001011100110100011001001000111110111001001100001100111001011110001111011110000101001010100011111011110111100000011000010000111010010010101100011110000...

result:

ok meet maximum 2147516414

Test #93:

score: 0
Accepted
time: 63ms
memory: 14244kb

input:

65551

output:

000000000000001011011101111001011010001100000010110101001011100110101010010111101101110111000011001001100111100001010001110000110010111100100100010110001011100110100011001001000111110111001001100001100111001011110001111011110000101001010100011111011110111100000011000010000111010010010101100011110000...

result:

ok meet maximum 2147581950

Test #94:

score: 0
Accepted
time: 102ms
memory: 16816kb

input:

65552

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 2147647486

Test #95:

score: 0
Accepted
time: 94ms
memory: 16840kb

input:

65553

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 2147713023

Test #96:

score: 0
Accepted
time: 102ms
memory: 16756kb

input:

131085

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 8589737985

Test #97:

score: 0
Accepted
time: 106ms
memory: 16752kb

input:

131086

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 8589869055

Test #98:

score: 0
Accepted
time: 103ms
memory: 16824kb

input:

131087

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 8590000126

Test #99:

score: 0
Accepted
time: 108ms
memory: 16832kb

input:

131088

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 8590131198

Test #100:

score: 0
Accepted
time: 188ms
memory: 22040kb

input:

131089

output:

000000000000000010010011100111101101111100000000100100010111001011011101111011001001001110010101101000011110011111101111100101011010001100001011111011010111001011011111000010111110011011000010110101001011000010011010110010011010100010111011111001101100100110101010010101111110010000101110110101100101...

result:

ok meet maximum 8590262270

Test #101:

score: 0
Accepted
time: 193ms
memory: 22100kb

input:

131090

output:

000000000000000010010011100111101101111100000000100100010111001011011101111011001001001110010101101000011110011111101111100101011010001100001011111011010111001011011111000010111110011011000010110101001011000010011010110010011010100010111011111001101100100110101010010101111110010000101110110101100101...

result:

ok meet maximum 8590393343

Test #102:

score: 0
Accepted
time: 21ms
memory: 11984kb

input:

8197

output:

000000000001101011111110100101010111000100011010100010101110000100000101011011101111111101010000110000001010101100111011010100001011010011011111010011101110000101110000110111101001111100110000101000001100101101011010111101010110010100001110100111101111010100010001011110101110101101000100110101010111...

result:

ok meet maximum 33509395

Test #103:

score: 0
Accepted
time: 31ms
memory: 12248kb

input:

16328

output:

000000000000100110101010011100110010111100001001100001100101111100000011001001011010101011001111101111111001100100010110110011111001001110110101001110100101111100101111101101011000101011101111100111111011100100110110010100110010001100000101100010100101001100001111001010011010011011000011101100110010...

result:

ok meet maximum 133114152

Test #104:

score: 0
Accepted
time: 42ms
memory: 12800kb

input:

32608

output:

000000000000011101100110001011101110010100000111011111011100101011111110111000110110011001000101011010101000100011110010010001010111000101101100111010011100101011100101011011001000011001011010100010101001011100010010001100010001111011111100100001100011000100000101000110001001110110111110100100010001...

result:

ok meet maximum 531233481

Test #105:

score: 0
Accepted
time: 51ms
memory: 14176kb

input:

65141

output:

000000000000001011011101111001011010001100000010110101001011100110101010010111101101110111000011001001100111100001010001110000110010111100100100010110001011100110100011001001000111110111001001100001100111001011110001111011110000101001010100011111011110111100000011000010000111010010010101100011110000...

result:

ok meet maximum 2120796035

Test #106:

score: 0
Accepted
time: 100ms
memory: 16752kb

input:

130420

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 8502797880

Test #107:

score: 0
Accepted
time: 23ms
memory: 12232kb

input:

8265

output:

000000000000100110101010011100110010111100001001100001100101111100000011001001011010101011001111101111111001100100010110110011111001001110110101001110100101111100101111101101011000101011101111100111111011100100110110010100110010001100000101100010100101001100001111001010011010011011000011101100110010...

result:

ok meet maximum 34068260

Test #108:

score: 0
Accepted
time: 32ms
memory: 12736kb

input:

16508

output:

000000000000011101100110001011101110010100000111011111011100101011111110111000110110011001000101011010101000100011110010010001010111000101101100111010011100101011100101011011001000011001011010100010101001011100010010001100010001111011111100100001100011000100000101000110001001110110111110100100010001...

result:

ok meet maximum 136067031

Test #109:

score: 0
Accepted
time: 54ms
memory: 14136kb

input:

33008

output:

000000000000001011011101111001011010001100000010110101001011100110101010010111101101110111000011001001100111100001010001110000110010111100100100010110001011100110100011001001000111110111001001100001100111001011110001111011110000101001010100011111011110111100000011000010000111010010010101100011110000...

result:

ok meet maximum 544351055

Test #110:

score: 0
Accepted
time: 101ms
memory: 16832kb

input:

65964

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 2174733396

Test #111:

score: 0
Accepted
time: 184ms
memory: 22120kb

input:

131692

output:

000000000000000010010011100111101101111100000000100100010111001011011101111011001001001110010101101000011110011111101111100101011010001100001011111011010111001011011111000010111110011011000010110101001011000010011010110010011010100010111011111001101100100110101010010101111110010000101110110101100101...

result:

ok meet maximum 8669480792

Test #112:

score: 0
Accepted
time: 31ms
memory: 12244kb

input:

15843

output:

000000000000100110101010011100110010111100001001100001100101111100000011001001011010101011001111101111111001100100010110110011111001001110110101001110100101111100101111101101011000101011101111100111111011100100110110010100110010001100000101100010100101001100001111001010011010011011000011101100110010...

result:

ok meet maximum 125318747

Test #113:

score: 0
Accepted
time: 37ms
memory: 12756kb

input:

31560

output:

000000000000011101100110001011101110010100000111011111011100101011111110111000110110011001000101011010101000100011110010010001010111000101101100111010011100101011100101011011001000011001011010100010101001011100010010001100010001111011111100100001100011000100000101000110001001110110111110100100010001...

result:

ok meet maximum 497623597

Test #114:

score: 0
Accepted
time: 51ms
memory: 14172kb

input:

64241

output:

000000000000001011011101111001011010001100000010110101001011100110101010010111101101110111000011001001100111100001010001110000110010111100100100010110001011100110100011001001000111110111001001100001100111001011110001111011110000101001010100011111011110111100000011000010000111010010010101100011110000...

result:

ok meet maximum 2062587185

Test #115:

score: 0
Accepted
time: 103ms
memory: 16816kb

input:

73307

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 2685953056

Test #116:

score: 0
Accepted
time: 96ms
memory: 16828kb

input:

129593

output:

000000000000000110110100101000110110000100000001101100111001011101100110001101011011010010111110111000100010100000110000101111101110010100011100001101111001011101100001000111000010101101000111011111011101000110101111010110101111100111001100001010110101101011111110111110000010110001110011011110101111...

result:

ok meet maximum 8395295323