CSES - HIIT Open 2024 - Results
Submission details
Task:Forgotten measurements
Sender:Tunkkari
Submission time:2024-11-16 14:32:33 +0200
Language:Python3 (PyPy3)
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.04 sdetails
#2ACCEPTED0.04 sdetails
#3ACCEPTED0.04 sdetails
#4ACCEPTED0.04 sdetails
#5ACCEPTED0.04 sdetails
#6ACCEPTED0.08 sdetails
#7ACCEPTED0.07 sdetails
#8ACCEPTED0.07 sdetails
#9ACCEPTED0.07 sdetails
#10ACCEPTED0.07 sdetails
#11ACCEPTED0.08 sdetails

Code

s = input()

ls = 0
us = 0
rs = 0
ds = 0

for c in s:
    if c == 'U': us += 1
    elif c == 'D': ds += 1
    elif c == 'L': ls += 1
    elif c == 'R': rs += 1

arr = [ls,rs,us,ds]

smallest = min(arr)
arr.remove(smallest)

smallest2 = min(arr)

print(smallest + smallest2)

Test details

Test 1

Verdict: ACCEPTED

input
ULDRUR

correct output
2

user output
2

Test 2

Verdict: ACCEPTED

input
RULD

correct output
2

user output
2

Test 3

Verdict: ACCEPTED

input
RULDRURDRURDLULD

correct output
7

user output
7

Test 4

Verdict: ACCEPTED

input
LDLDRDLULULURURURULDRDLDRDRURD...

correct output
19

user output
19

Test 5

Verdict: ACCEPTED

input
RURULDLULDRURDLULDRULURULURDLD...

correct output
470

user output
470

Test 6

Verdict: ACCEPTED

input
DRULDLULDLULDLURDRULDRURDLURDL...

correct output
499773

user output
499773

Test 7

Verdict: ACCEPTED

input
DLURDLULDLULDRULURULURURDLDLDR...

correct output
499383

user output
499383

Test 8

Verdict: ACCEPTED

input
RULDLDLDRULDLDLULURULULDLURDLU...

correct output
499622

user output
499622

Test 9

Verdict: ACCEPTED

input
RDRDRURDLDLURDRULURDLDRULDLULU...

correct output
499788

user output
499788

Test 10

Verdict: ACCEPTED

input
LDLURDRURDRULDLULDLDRURDLULDRU...

correct output
499368

user output
499368

Test 11

Verdict: ACCEPTED

input
DRULULDRDLDLDLURULDRDLURULULDR...

correct output
499790

user output
499790