CSES - Harjoituskisa 7.1.2018 - Results
Submission details
Task:Ruudukko
Sender:FSMnArmosta
Submission time:2018-01-07 21:02:59 +0200
Language:Python3
Status:READY
Result:59
Feedback
groupverdictscore
#1ACCEPTED17
#2ACCEPTED42
#30
Test results
testverdicttimegroup
#1ACCEPTED0.06 s1details
#2ACCEPTED0.08 s1details
#3ACCEPTED0.06 s1details
#4ACCEPTED0.07 s1details
#5ACCEPTED0.07 s1details
#6ACCEPTED0.07 s2details
#7ACCEPTED0.07 s2details
#8ACCEPTED0.07 s2details
#9ACCEPTED0.08 s2details
#10ACCEPTED0.10 s2details
#110.33 s3details
#120.34 s3details
#130.41 s3details
#140.33 s3details
#150.35 s3details

Code

n = int(input())

table = []
fcache = []

for t in range(n):
  table.append(input())

for t in range(n):
  fcache.append([None]*n)

def f(x, y):
  if fcache[x][y] == None:
    result = ""
    if x == (n-1) and y == (n-1):
      result = table[x][y]
    elif x == (n-1):
      result = table[x][y] + f(x, y+1)
    elif y == (n-1):
      result = table[x][y] + f(x+1, y)
    else:
      a, b = f(x+1, y), f(x, y+1)
      result = table[x][y] + min(a, b)
    fcache[x][y] = result
  return fcache[x][y]

print(f(0, 0))

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
5
ILRBG
SBRHV
PAGKM
YKKNG
...

correct output
ILBAGKMGQ

user output
ILBAGKMGQ

Test 2

Group: 1

Verdict: ACCEPTED

input
5
KQQBB
IWDQN
TENSD
PGXMV
...

correct output
KITEGMIWH

user output
KITEGMIWH

Test 3

Group: 1

Verdict: ACCEPTED

input
5
DSWIO
RWFDY
ISZRK
GBVYS
...

correct output
DRIGBJDLU

user output
DRIGBJDLU

Test 4

Group: 1

Verdict: ACCEPTED

input
5
VGQFP
FTISL
QCLYU
EYNZZ
...

correct output
VFQCLNRZP

user output
VFQCLNRZP

Test 5

Group: 1

Verdict: ACCEPTED

input
5
WCSNV
UWNDB
WDHZA
XGRBQ
...

correct output
WCSNDBAQW

user output
WCSNDBAQW

Test 6

Group: 2

Verdict: ACCEPTED

input
100
WFNOQZOAMZPHFRDYGXQNUPWVMFDNJF...

correct output
WFAHHJDEVFSGGOGMIFDEEDKPSHBBRX...

user output
WFAHHJDEVFSGGOGMIFDEEDKPSHBBRX...

Test 7

Group: 2

Verdict: ACCEPTED

input
100
UEOPTOSBCABXIPUOQRKWKMZRGRZUSS...

correct output
UEGHLIWDHDVKTECPACBJABFMBOASOF...

user output
UEGHLIWDHDVKTECPACBJABFMBOASOF...

Test 8

Group: 2

Verdict: ACCEPTED

input
100
XCKBHDFAPMFZNJANJUENHGXYBBHFJR...

correct output
XCCENJBCBUFBIOJOJDREIBGRUKVRQS...

user output
XCCENJBCBUFBIOJOJDREIBGRUKVRQS...

Test 9

Group: 2

Verdict: ACCEPTED

input
100
YEBXYYLVUDYIHNUMRCUTAYVTNLMEZL...

correct output
YDJNBALIRDOVFBKDDJDFNSSMIDMFRM...

user output
YDJNBALIRDOVFBKDDJDFNSSMIDMFRM...

Test 10

Group: 2

Verdict: ACCEPTED

input
100
MVONBCDHJUKRKDGPNYSYGRXBLZOMLD...

correct output
MMSJFIKBSFCUMBBLXJCOUIRAPOKEJS...

user output
MMSJFIKBSFCUMBBLXJCOUIRAPOKEJS...

Test 11

Group: 3

Verdict:

input
2500
LKEFOYQTRZJHADSYBRGQCUDOPMGYOF...

correct output
LDHPNOFPFOCGKPNCEQKANCJCBLGDKC...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 27, in <module>
    print(f(0, 0))
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f...

Test 12

Group: 3

Verdict:

input
2500
UGPBLFMZGVIANZLHRTPJIHMUZWOXKA...

correct output
UGLSEBMGHSONFJBGOJJAGBJCLFAHAP...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 27, in <module>
    print(f(0, 0))
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f...

Test 13

Group: 3

Verdict:

input
2500
YRUOZBRTLLMMAHNIHQLZHBYCDHTHMS...

correct output
YELLJAAKETHCOWAJNDGJBOFNTCCEDA...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 27, in <module>
    print(f(0, 0))
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f...

Test 14

Group: 3

Verdict:

input
2500
RXZEOTVYZBQUOJJFLCJCYCZDONBLUR...

correct output
RTDHUEBGLTKRHKIQLGKILATNHWPIBO...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 27, in <module>
    print(f(0, 0))
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f...

Test 15

Group: 3

Verdict:

input
2500
IOTRAMNHKWWBVPQPPWTTBHOYDFXPOX...

correct output
IOTQTIDOBFMJBDNOFEFGGIBGAGQBIC...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 27, in <module>
    print(f(0, 0))
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f(x, y+1)
  File "input/code.py", line 22, in f
    a, b = f(x+1, y), f...