Sort by

recency

|

9 Discussions

|

  • + 0 comments

    Update - solution checker still not working. Python 3. Anybody read these?

  • + 0 comments

    Update - solution checker still not working. C and Python 3. Anybody read these?

  • + 1 comment

    Solution checker not working, but even if it did I still have no idea how it could do the decoding, given that it is esplicitely asked to provide only 17-bit codes for words and avoid 8-bit codes for single alpha-nuemeric and special characters....

    strings = []
    start = None
    end = None
    
    for _ in range(1000000):
        try:
            line = input()
            for i,c in enumerate(line):
                if c.isalnum() and start is None:
                    start = i
                if not c.isalnum():
                    strings.append(c)
                    if start is not None:
                        end = i
                        strings.append(line[start:end])
                        start = None
        except EOFError:
            break
    
    d = {}
    ix = 2**9
    for i,s in enumerate(set(strings)):
        if len(s) == 1:
            b = bin(ord(s))[2:]
            b = ''.join(['0']*(8-len(b))) + b
            d[s] = b
        if len(s) > 1:
            b = bin(ix)[2:]
            b = '1' + ''.join(['0']*(16-len(b))) + b
            ix += 1
            d[s] = b    
    
    print(str(ix-2**9))
    
    for k,v in d.items():
        if len(k)>1:
            print(k + '\t' + v)
            
    encoded = ''
    for s in strings:
        if len(s)>0:
            encoded += d[s]
    print(encoded)
        
    
  • + 0 comments

    Checker is still broken (17 Nov. 2019) Please fix!?!!?

  • + 1 comment

    The program that checks the encoding is faulty (see output):

    File "/custom-bq2VgBPyqygWVeh9pvf8/solution.py", line 58, in unpack n = int(lines[0]) ValueError: invalid literal for int() with base 10: "The Project Gutenberg's Etext of Shakespeare's First Folio

    It reads the original text where it was expecting an integer (the only expected integer is the number of 17-bit codes on the first line of the output). I seems that the input to the checker is not the output of my program, but the original text. It is a problem of either miss-alignment, or even reading order being changed. None of the sample cases nor the test cases pass, although I have checked my program and satisfies the problem specifications.