Submission #4068673


Source Code Expand

import string

ch = string.ascii_lowercase

s = input()
K =  int(input())
pointer = 0
buf = []
boundary = [('a', i) for i in range(len(s)) if s[i] == 'a']
boundary.sort(key=lambda x: x[0])
while True:
  if len(buf) >= 5 or pointer >= len(ch):
    break
  tmp = len(boundary)
  if tmp > 0:
    for _ in range(1):
      element = boundary.pop(0)
      buf.append(element[0])
      buf = list(set(buf))
      if element[1] < len(s) - 1:
        next_element = (element[0] + s[element[1] + 1], element[1] + 1)
        boundary.append(next_element)
  if len(boundary) == 0:
    if pointer + 1 >= len(ch):
      break
    pointer += 1
    if s.find(ch[pointer]) != -1:
    	boundary = [(ch[pointer], i) for i in range(len(s)) if s[i] == ch[pointer]]
  buf.sort()
  boundary.sort(key=lambda x: x[0])
  #print(boundary)
  #print(buf)
  
print(buf[K - 1])

Submission Info

Submission Time
Task A - Colorful Transceivers
User u271969h
Language Python (3.4.3)
Score 0
Code Size 881 Byte
Status RE
Exec Time 25 ms
Memory 3768 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
RE × 4
RE × 10
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt
Case Name Status Exec Time Memory
0_000.txt RE 25 ms 3764 KB
0_001.txt RE 25 ms 3764 KB
0_002.txt RE 25 ms 3764 KB
0_003.txt RE 25 ms 3768 KB
1_003.txt RE 25 ms 3764 KB
1_004.txt RE 25 ms 3768 KB
1_005.txt RE 25 ms 3764 KB
1_006.txt RE 25 ms 3764 KB
1_007.txt RE 25 ms 3764 KB
1_008.txt RE 25 ms 3764 KB