Submission #11507091


Source Code Expand

Copy
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

runrun = [None for _ in range(100)]
runrun[1] = (1, 2, 3, 4, 5, 6, 7, 8, 9)


def gen_runrun_keta(k):
    for x in runrun[k - 1]:
        r = x % 10
        if r > 0:
            yield 10 * x + (r - 1)
        yield 10 * x + r
        if r < 9:
            yield 10 * x + (r + 1)


for keta in range(2, 11):
    runrun[keta] = tuple(gen_runrun_keta(keta))


rest = int(read())

answer = 0
for n in range(1, 11):
    if rest <= len(runrun[n]):
        answer = runrun[n][rest - 1]
        break
    rest -= len(runrun[n])
print(answer)

Submission Info

Submission Time
Task D - Lunlun Number
User maspy
Language Python3 (3.4.3)
Score 400
Code Size 707 Byte
Status
Exec Time 57 ms
Memory 12104 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All 400 / 400 etc_01.txt, etc_02.txt, etc_03.txt, etc_04.txt, etc_05.txt, etc_06.txt, etc_07.txt, etc_08.txt, etc_09.txt, etc_10.txt, etc_11.txt, etc_12.txt, etc_13.txt, etc_14.txt, etc_15.txt, etc_16.txt, etc_17.txt, etc_18.txt, rand_01.txt, rand_02.txt, rand_03.txt, rand_04.txt, rand_05.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Case Name Status Exec Time Memory
etc_01.txt 56 ms 12104 KB
etc_02.txt 56 ms 12104 KB
etc_03.txt 55 ms 12104 KB
etc_04.txt 56 ms 12104 KB
etc_05.txt 56 ms 12104 KB
etc_06.txt 56 ms 12104 KB
etc_07.txt 56 ms 12104 KB
etc_08.txt 55 ms 12104 KB
etc_09.txt 57 ms 12104 KB
etc_10.txt 56 ms 12104 KB
etc_11.txt 56 ms 12104 KB
etc_12.txt 55 ms 12104 KB
etc_13.txt 56 ms 12104 KB
etc_14.txt 56 ms 12104 KB
etc_15.txt 56 ms 12104 KB
etc_16.txt 56 ms 12104 KB
etc_17.txt 56 ms 12104 KB
etc_18.txt 56 ms 12104 KB
rand_01.txt 56 ms 12104 KB
rand_02.txt 56 ms 12104 KB
rand_03.txt 56 ms 12104 KB
rand_04.txt 56 ms 12104 KB
rand_05.txt 56 ms 12104 KB
sample_01.txt 56 ms 12104 KB
sample_02.txt 56 ms 12104 KB
sample_03.txt 55 ms 12104 KB
sample_04.txt 56 ms 12104 KB