CSES - Aalto Competitive Programming 2024 - wk2 - Wed - Results
Submission details
Task:LibBot
Sender:aalto2024b_004
Submission time:2024-09-11 17:06:53 +0300
Language:CPython3
Status:READY
Result:
Test results
testverdicttime
#10.02 sdetails
#2ACCEPTED0.02 sdetails
#30.02 sdetails
#40.02 sdetails
#50.02 sdetails
#60.02 sdetails
#7ACCEPTED0.02 sdetails
#80.02 sdetails
#90.02 sdetails
#100.02 sdetails
#110.02 sdetails
#120.02 sdetails
#130.02 sdetails
#140.02 sdetails
#15ACCEPTED0.02 sdetails
#16ACCEPTED0.02 sdetails
#17ACCEPTED0.02 sdetails
#180.02 sdetails
#19ACCEPTED0.02 sdetails
#200.04 sdetails
#210.04 sdetails
#220.03 sdetails
#230.03 sdetails
#240.03 sdetails
#250.03 sdetails
#260.03 sdetails
#270.03 sdetails
#280.03 sdetails
#290.04 sdetails
#300.04 sdetails
#310.03 sdetails
#320.04 sdetails
#330.04 sdetails
#340.04 sdetails
#350.03 sdetails
#360.03 sdetails
#370.04 sdetails
#380.03 sdetails
#390.03 sdetails
#400.02 sdetails
#410.02 sdetails

Code

n = int(input().split()[1])
target = input().split()[1]
arr_size = n ** 5

def i_to_coords(i: int):
    if i == 0:
        return "1.1.1.1.1"
    places = ["0" for _ in range(5)]
    for j in range(5):
        places[j] = str((i % n) + 1)
        i //= n
    return ".".join(places[::-1])


def fetch(i: int):
    print(f"FETCH {i_to_coords(i)}", flush=True)
    return input().split()[1]


def bsearch(x: str):
    a = 0
    b = arr_size - 1
    while a <= b:
        k = (a + b) // 2
        el = fetch(k)
        if el == x:
            return k  # found x at index k
        if el > x:
            b = k - 1
        else:
            a = k + 1


def hi(loc: int, target: str):
    a = loc
    b = arr_size - 1
    while a < b:
        k = (a + b) // 2
        el = fetch(k)
        if el == target:
            a = k + 1
        else:
            b = k - 1
    return a


def lo(loc: int, target: str):
    a = 0
    b = loc
    while a < b:
        k = (a + b) // 2
        el = fetch(k)
        if el == target:
            b = k - 1
        else:
            a = k + 1
    return a


if n == 1:
    if fetch(0) == target:
        print("GOT 1", flush=True)
    else:
        print("GOT 0", flush=True)
else:
    f = bsearch(target)
    h = hi(f, target)
    l = lo(f, target)
    print(f"GOT {h - l}", flush=True)

Test details

Test 1

Verdict:

input
2 9
kdg
dl 6
kdg 3
kdgwl 1
...

correct output
(empty)

user output
SIZE 2
COUNT kdg
FETCH 1.2.2.2.2
FOUND kdgyi
FETCH 1.1.2.2.2
...

Error:
1 1 0 0

Test 2

Verdict: ACCEPTED

input
3 15
irwkfl
c 26
d 27
e 11
...

correct output
(empty)

user output
SIZE 3
COUNT irwkfl
FETCH 2.2.2.2.2
FOUND fuuics
FETCH 3.1.3.1.3
...

Error:
1 1 1 0

Test 3

Verdict:

input
4 34
gcnmkobrd
bcytu 60
bheb 64
bhebp 26
...

correct output
(empty)

user output
SIZE 4
COUNT gcnmkobrd
FETCH 2.4.4.4.4
FOUND h
FETCH 1.4.4.4.4
...

Error:
1 1 0 0

Test 4

Verdict:

input
5 52
faoluuicsn
a 1
cufqs 30
d 44
...

correct output
(empty)

user output
SIZE 5
COUNT faoluuicsn
FETCH 3.3.3.3.3
FOUND o
FETCH 2.2.2.2.1
...

Error:
1 1 0 0

Test 5

Verdict:

input
6 75
okokxlluuicsnw
a 1
b 51
bxcufq 145
...

correct output
(empty)

user output
SIZE 6
COUNT okokxlluuicsnw
FETCH 3.6.6.6.6
FOUND okhkxlluurcsnwcvbheipdry...

Error:
1 1 0 0

Test 6

Verdict:

input
7 105
jibgewnvmqnpbxvirxmgf
a 1
aqykhme 32
atusxwa 119
...

correct output
(empty)

user output
SIZE 7
COUNT jibgewnvmqnpbxvirxmgf
FETCH 4.4.4.4.4
FOUND n
FETCH 2.6.2.6.2
...

Error:
1 1 0 0

Test 7

Verdict: ACCEPTED

input
8 124
djnofmgdbfj
afpc 66
apj 204
apjgsu 105
...

correct output
(empty)

user output
SIZE 8
COUNT djnofmgdbfj
FETCH 4.8.8.8.8
FOUND mdaecaalyy
FETCH 2.8.8.8.8
...

Error:
1 1 1 0

Test 8

Verdict:

input
9 166
qonvyqgibutxey
a 94
act 683
afngrwb 20
...

correct output
(empty)

user output
SIZE 9
COUNT qonvyqgibutxey
FETCH 5.5.5.5.5
FOUND ox
FETCH 7.7.7.7.7
...

Error:
1 1 0 0

Test 9

Verdict:

input
10 211
zuek
axof 303
axofdxjyeevjxifd 397
axofvxnleg 539
...

correct output
(empty)

user output
SIZE 10
COUNT zuek
FETCH 5.10.10.10.10
FOUND moh
FETCH 8.5.10.10.10
...

Error:
1 1 0 0

Test 10

Verdict:

input
10 216
hskapswvzfrbijqwgotkothu
aayuulyq 436
aayuulyqcs 205
aayuulyqcsgjqffbfix 530
...

correct output
(empty)

user output
SIZE 10
COUNT hskapswvzfrbijqwgotkothu
FETCH 5.10.10.10.10
FOUND jogii
FETCH 3.5.10.10.10
...

Error:
1 1 0 0

Test 11

Verdict:

input
9 158
ylhjecnhgyboje
a 691
acd 241
apkcczfzzxrpvlk 88
...

correct output
(empty)

user output
SIZE 9
COUNT ylhjecnhgyboje
FETCH 5.5.5.5.5
FOUND kxtjsyjajvusmj
FETCH 7.7.7.7.7
...

Error:
1 1 0 0

Test 12

Verdict:

input
8 133
ewcm
aavhwtselm 486
aavrwtsejm 170
aayuuly 62
...

correct output
(empty)

user output
SIZE 8
COUNT ewcm
FETCH 4.8.8.8.8
FOUND kjogxxxfyzbvtqxnmiok
FETCH 2.8.8.8.8
...

Error:
1 1 0 0

Test 13

Verdict:

input
7 98
jkpxbvb
awb 326
comccswxez 114
cw 42
...

correct output
(empty)

user output
SIZE 7
COUNT jkpxbvb
FETCH 4.4.4.4.4
FOUND lqsc
FETCH 2.6.2.6.2
...

Error:
1 1 0 0

Test 14

Verdict:

input
6 70
eaymki
alkio 119
alkioruv 72
alkioruvyivod 26
...

correct output
(empty)

user output
SIZE 6
COUNT eaymki
FETCH 3.6.6.6.6
FOUND lzftwy
FETCH 2.3.6.6.6
...

Error:
1 1 0 0

Test 15

Verdict: ACCEPTED

input
4 28
unje
biybsjet 60
biybsjetnn 27
bx 45
...

correct output
(empty)

user output
SIZE 4
COUNT unje
FETCH 2.4.4.4.4
FOUND npghbml
FETCH 3.4.4.4.4
...

Error:
1 1 1 0

Test 16

Verdict: ACCEPTED

input
9 159
ckfhsouqxvv
a 373
aahay 152
asvvihxxokcevotlncilqbuvhmdkmh...

correct output
(empty)

user output
SIZE 9
COUNT ckfhsouqxvv
FETCH 5.5.5.5.5
FOUND lk
FETCH 3.3.3.3.2
...

Error:
1 1 1 0

Test 17

Verdict: ACCEPTED

input
8 117
h
aaha 262
anmuhfjbetlfzdbns 107
awhfbhdbjbuexgbwl 226
...

correct output
(empty)

user output
SIZE 8
COUNT h
FETCH 4.8.8.8.8
FOUND ns
FETCH 2.8.8.8.8
...

Error:
1 1 1 0

Test 18

Verdict:

input
7 106
m
aezpq 42
aokpn 7
aqfkfe 86
...

correct output
(empty)

user output
SIZE 7
COUNT m
FETCH 4.4.4.4.4
FOUND mljjsrvri
FETCH 2.6.2.6.2
...

Error:
1 1 0 0

Test 19

Verdict: ACCEPTED

input
7 101
kvtwj
appvlr 240
bguzpylrzkwon 78
bofd 2
...

correct output
(empty)

user output
SIZE 7
COUNT kvtwj
FETCH 4.4.4.4.4
FOUND oekjahqd
FETCH 2.6.2.6.2
...

Error:
1 1 1 0

Test 20

Verdict:

input
2 9
fu
dl 6
kdg 3
kdgwl 1
...

correct output
(empty)

user output
SIZE 2
COUNT fu
FETCH 1.2.2.2.2
FOUND kdgyi
FETCH 1.1.2.2.2
...

Error:
1 1 0 1

Test 21

Verdict:

input
3 15
uvk
c 26
d 27
e 11
...

correct output
(empty)

user output
SIZE 3
COUNT uvk
FETCH 2.2.2.2.2
FOUND fuuics
FETCH 3.1.3.1.3
...

Error:
1 1 0 1

Test 22

Verdict:

input
4 34
jgtx
bcytu 60
bheb 64
bhebp 26
...

correct output
(empty)

user output
SIZE 4
COUNT jgtx
FETCH 2.4.4.4.4
FOUND h
FETCH 3.4.4.4.4
...

Error:
1 1 0 1

Test 23

Verdict:

input
5 52
ghmfq
a 1
cufqs 30
d 44
...

correct output
(empty)

user output
SIZE 5
COUNT ghmfq
FETCH 3.3.3.3.3
FOUND o
FETCH 2.2.2.2.1
...

Error:
1 1 0 1

Test 24

Verdict:

input
6 75
ojuphd
a 1
b 51
bxcufq 145
...

correct output
(empty)

user output
SIZE 6
COUNT ojuphd
FETCH 3.6.6.6.6
FOUND okhkxlluurcsnwcvbheipdry...

Error:
1 1 0 1

Test 25

Verdict:

input
7 105
kzzqfzz
a 1
aqykhme 32
atusxwa 119
...

correct output
(empty)

user output
SIZE 7
COUNT kzzqfzz
FETCH 4.4.4.4.4
FOUND n
FETCH 2.6.2.6.2
...

Error:
1 1 0 1

Test 26

Verdict:

input
8 124
emdxvwdw
afpc 66
apj 204
apjgsu 105
...

correct output
(empty)

user output
SIZE 8
COUNT emdxvwdw
FETCH 4.8.8.8.8
FOUND mdaecaalyy
FETCH 2.8.8.8.8
...

Error:
1 1 0 1

Test 27

Verdict:

input
9 166
pkhsbasuj
a 94
act 683
afngrwb 20
...

correct output
(empty)

user output
SIZE 9
COUNT pkhsbasuj
FETCH 5.5.5.5.5
FOUND ox
FETCH 7.7.7.7.7
...

Error:
1 1 0 1

Test 28

Verdict:

input
10 211
zypqadmqoo
axof 303
axofdxjyeevjxifd 397
axofvxnleg 539
...

correct output
(empty)

user output
SIZE 10
COUNT zypqadmqoo
FETCH 5.10.10.10.10
FOUND moh
FETCH 8.5.10.10.10
...

Error:
1 1 0 1

Test 29

Verdict:

input
10 216
jhagispreh
aayuulyq 436
aayuulyqcs 205
aayuulyqcsgjqffbfix 530
...

correct output
(empty)

user output
SIZE 10
COUNT jhagispreh
FETCH 5.10.10.10.10
FOUND jogii
FETCH 3.5.10.10.10
...

Error:
1 1 0 1

Test 30

Verdict:

input
9 158
zfkmqpzht
a 691
acd 241
apkcczfzzxrpvlk 88
...

correct output
(empty)

user output
SIZE 9
COUNT zfkmqpzht
FETCH 5.5.5.5.5
FOUND kxtjsyjajvusmj
FETCH 7.7.7.7.7
...

Error:
1 1 0 1

Test 31

Verdict:

input
8 133
dogiavnu
aavhwtselm 486
aavrwtsejm 170
aayuuly 62
...

correct output
(empty)

user output
SIZE 8
COUNT dogiavnu
FETCH 4.8.8.8.8
FOUND kjogxxxfyzbvtqxnmiok
FETCH 2.8.8.8.8
...

Error:
1 1 0 1

Test 32

Verdict:

input
7 98
kihqiff
awb 326
comccswxez 114
cw 42
...

correct output
(empty)

user output
SIZE 7
COUNT kihqiff
FETCH 4.4.4.4.4
FOUND lqsc
FETCH 2.6.2.6.2
...

Error:
1 1 0 1

Test 33

Verdict:

input
6 70
eszubi
alkio 119
alkioruv 72
alkioruvyivod 26
...

correct output
(empty)

user output
SIZE 6
COUNT eszubi
FETCH 3.6.6.6.6
FOUND lzftwy
FETCH 2.3.6.6.6
...

Error:
1 1 0 1

Test 34

Verdict:

input
4 28
vyta
biybsjet 60
biybsjetnn 27
bx 45
...

correct output
(empty)

user output
SIZE 4
COUNT vyta
FETCH 2.4.4.4.4
FOUND npghbml
FETCH 3.4.4.4.4
...

Error:
1 1 0 1

Test 35

Verdict:

input
9 159
ctohjykey
a 373
aahay 152
asvvihxxokcevotlncilqbuvhmdkmh...

correct output
(empty)

user output
SIZE 9
COUNT ctohjykey
FETCH 5.5.5.5.5
FOUND lk
FETCH 3.3.3.3.2
...

Error:
1 1 0 1

Test 36

Verdict:

input
8 117
igjxpndn
aaha 262
anmuhfjbetlfzdbns 107
awhfbhdbjbuexgbwl 226
...

correct output
(empty)

user output
SIZE 8
COUNT igjxpndn
FETCH 4.8.8.8.8
FOUND ns
FETCH 2.8.8.8.8
...

Error:
1 1 0 1

Test 37

Verdict:

input
7 106
lslhnht
aezpq 42
aokpn 7
aqfkfe 86
...

correct output
(empty)

user output
SIZE 7
COUNT lslhnht
FETCH 4.4.4.4.4
FOUND mljjsrvri
FETCH 2.6.2.6.2
...

Error:
1 1 0 1

Test 38

Verdict:

input
7 101
hxliesh
appvlr 240
bguzpylrzkwon 78
bofd 2
...

correct output
(empty)

user output
SIZE 7
COUNT hxliesh
FETCH 4.4.4.4.4
FOUND oekjahqd
FETCH 2.6.2.6.2
...

Error:
1 1 0 1

Test 39

Verdict:

input
2 1
fu
dl 32

correct output
(empty)

user output
SIZE 2
COUNT fu
FETCH 1.2.2.2.2
FOUND dl
FETCH 2.1.2.2.2
...

Error:
1 1 0 1

Test 40

Verdict:

input
3 1
fuuicsxvc
fuuicsxvc 243

correct output
(empty)

user output
SIZE 3
COUNT fuuicsxvc
FETCH 2.2.2.2.2
FOUND fuuicsxvc
FETCH 3.1.3.1.2
...

Error:
1 1 0 0

Test 41

Verdict:

input
4 1
bcytu
bcytu 1024

correct output
(empty)

user output
SIZE 4
COUNT bcytu
FETCH 2.4.4.4.4
FOUND bcytu
FETCH 3.4.4.4.4
...

Error:
1 1 0 0