CSES - Aalto Competitive Programming 2024 - wk2 - Wed - Results
Submission details
Task:LibBot
Sender:aalto2024b_007
Submission time:2024-09-11 17:19:56 +0300
Language:C++ (C++17)
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#2ACCEPTED0.01 sdetails
#3ACCEPTED0.01 sdetails
#4ACCEPTED0.01 sdetails
#5ACCEPTED0.01 sdetails
#6ACCEPTED0.02 sdetails
#7ACCEPTED0.01 sdetails
#8ACCEPTED0.02 sdetails
#9ACCEPTED0.01 sdetails
#10ACCEPTED0.01 sdetails
#11ACCEPTED0.02 sdetails
#12ACCEPTED0.02 sdetails
#13ACCEPTED0.01 sdetails
#14ACCEPTED0.02 sdetails
#15ACCEPTED0.02 sdetails
#16ACCEPTED0.01 sdetails
#17ACCEPTED0.02 sdetails
#18ACCEPTED0.01 sdetails
#19ACCEPTED0.01 sdetails
#20ACCEPTED0.01 sdetails
#21ACCEPTED0.01 sdetails
#22ACCEPTED0.02 sdetails
#23ACCEPTED0.01 sdetails
#24ACCEPTED0.01 sdetails
#25ACCEPTED0.02 sdetails
#26ACCEPTED0.02 sdetails
#27ACCEPTED0.01 sdetails
#28ACCEPTED0.02 sdetails
#29ACCEPTED0.01 sdetails
#30ACCEPTED0.02 sdetails
#31ACCEPTED0.02 sdetails
#32ACCEPTED0.01 sdetails
#33ACCEPTED0.01 sdetails
#34ACCEPTED0.01 sdetails
#35ACCEPTED0.01 sdetails
#36ACCEPTED0.01 sdetails
#37ACCEPTED0.02 sdetails
#38ACCEPTED0.01 sdetails
#39ACCEPTED0.01 sdetails
#40ACCEPTED0.01 sdetails
#41ACCEPTED0.01 sdetails

Code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int n, n5;

int f(const string& s, int i) {
	if (i < 0) return -1;
	if (i >= n5) return 1;
	string msg;
	for (int j = 0; j < 5; ++j) {
		msg = to_string(i % n + 1) + msg;
		if (j != 4) msg.insert(msg.begin(), '.');
		i /= n;
	}
	cout << "FETCH " << msg << '\n';
	string s_, s2;
	cin >> s_ >> s2;
	return s2 < s ? -1 : s2 > s ? 1 : 0;
}

int count(string str) {
	int s = -1;
	for (int i = 1<<17; i >= 1; i /= 2) {
		s += i;
		int r = f(str, s);
		if (r >= 0) {
			s -= i;
		}
	}
	int s0 = s;
	s = 0;
	for (int i = 1<<17; i >= 1; i /= 2) {
		s += i;
		int r = f(str, s);
		if (r > 0) {
			s -= i;
		}
	}
	return s - s0;
}

int main() {
	while (true) {
		string type;
		cin >> type;
		if (type == "SIZE") {
			cin >> n;
			n5 = n*n*n*n*n;
		}
		if (type == "COUNT") {
			string str;
			cin >> str;
			const int c = count(str);
			cout << "GOT " << c << '\n';
			break;
		}
	}
}

Test details

Test 1

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 2
COUNT kdg
FETCH 2.2.2.2.2
FOUND zdg
FETCH 1.2.2.2.2
...
Truncated

Error:
1 1 1 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.3.1.2
FOUND fuuicsxvc
FETCH 3.2.1.1.3
...
Truncated

Error:
1 1 1 0

Test 3

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 4
COUNT gcnmkobrd
FETCH 4.4.4.4.4
FOUND zs
FETCH 2.4.4.4.4
...
Truncated

Error:
1 1 1 0

Test 4

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 5
COUNT faoluuicsn
FETCH 4.2.2.5.3
FOUND uvka
FETCH 2.4.1.5.4
...
Truncated

Error:
1 1 1 0

Test 5

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 6
COUNT okokxlluuicsnw
FETCH 4.1.6.5.4
FOUND okokxll
FETCH 5.5.3.4.6
...
Truncated

Error:
1 1 1 0

Test 6

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 7
COUNT jibgewnvmqnpbxvirxmgf
FETCH 7.6.6.3.4
FOUND zeduteacnbnhogwo
FETCH 4.3.7.2.2
...
Truncated

Error:
1 1 1 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 8.8.8.8.8
FOUND zvxet
FETCH 4.8.8.8.8
...
Truncated

Error:
1 1 1 0

Test 8

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 9
COUNT qonvyqgibutxey
FETCH 5.9.9.5.8
FOUND pboopgsgcnk
FETCH 8.5.4.8.3
...
Truncated

Error:
1 1 1 0

Test 9

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 10
COUNT zuek
FETCH 7.6.6.4.6
FOUND nsvpnqeezmylims
FETCH 10.9.4.1.4
...
Truncated

Error:
1 1 1 0

Test 10

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 10
COUNT hskapswvzfrbijqwgotkothu
FETCH 7.6.6.4.6
FOUND pwcw
FETCH 4.3.8.7.8
...
Truncated

Error:
1 1 1 0

Test 11

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 9
COUNT ylhjecnhgyboje
FETCH 5.9.9.5.8
FOUND m
FETCH 8.5.4.8.3
...
Truncated

Error:
1 1 1 0

Test 12

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 8
COUNT ewcm
FETCH 8.8.8.8.8
FOUND zsclgdhgnu
FETCH 4.8.8.8.8
...
Truncated

Error:
1 1 1 0

Test 13

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 7
COUNT jkpxbvb
FETCH 7.6.6.3.4
FOUND zyznusp
FETCH 4.3.7.2.2
...
Truncated

Error:
1 1 1 0

Test 14

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 6
COUNT eaymki
FETCH 4.1.6.5.4
FOUND m
FETCH 2.4.3.6.2
...
Truncated

Error:
1 1 1 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 4.4.4.4.4
FOUND yugojuynkfa
FETCH 2.4.4.4.4
...
Truncated

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.9.9.5.8
FOUND mhf
FETCH 3.5.5.3.4
...
Truncated

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 8.8.8.8.8
FOUND zpksskp
FETCH 4.8.8.8.8
...
Truncated

Error:
1 1 1 0

Test 18

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 7
COUNT m
FETCH 7.6.6.3.4
FOUND zf
FETCH 4.3.7.2.2
...
Truncated

Error:
1 1 1 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 7.6.6.3.4
FOUND zdltz
FETCH 4.3.7.2.2
...
Truncated

Error:
1 1 1 0

Test 20

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 2
COUNT fu
FETCH 2.2.2.2.2
FOUND zdg
FETCH 1.2.2.2.2
...
Truncated

Error:
1 1 1 0

Test 21

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 3
COUNT uvk
FETCH 2.2.3.1.2
FOUND fuuicsxvc
FETCH 3.2.1.1.3
...
Truncated

Error:
1 1 1 0

Test 22

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 4
COUNT jgtx
FETCH 4.4.4.4.4
FOUND zs
FETCH 2.4.4.4.4
...
Truncated

Error:
1 1 1 0

Test 23

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 5
COUNT ghmfq
FETCH 4.2.2.5.3
FOUND uvka
FETCH 2.4.1.5.4
...
Truncated

Error:
1 1 1 0

Test 24

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 6
COUNT ojuphd
FETCH 4.1.6.5.4
FOUND okokxll
FETCH 2.4.3.6.2
...
Truncated

Error:
1 1 1 0

Test 25

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 7
COUNT kzzqfzz
FETCH 7.6.6.3.4
FOUND zeduteacnbnhogwo
FETCH 4.3.7.2.2
...
Truncated

Error:
1 1 1 0

Test 26

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 8
COUNT emdxvwdw
FETCH 8.8.8.8.8
FOUND zvxet
FETCH 4.8.8.8.8
...
Truncated

Error:
1 1 1 0

Test 27

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 9
COUNT pkhsbasuj
FETCH 5.9.9.5.8
FOUND pboopgsgcnk
FETCH 8.5.4.8.3
...
Truncated

Error:
1 1 1 0

Test 28

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 10
COUNT zypqadmqoo
FETCH 7.6.6.4.6
FOUND nsvpnqeezmylims
FETCH 10.9.4.1.4
...
Truncated

Error:
1 1 1 0

Test 29

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 10
COUNT jhagispreh
FETCH 7.6.6.4.6
FOUND pwcw
FETCH 4.3.8.7.8
...
Truncated

Error:
1 1 1 0

Test 30

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 9
COUNT zfkmqpzht
FETCH 5.9.9.5.8
FOUND m
FETCH 8.5.4.8.3
...
Truncated

Error:
1 1 1 0

Test 31

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 8
COUNT dogiavnu
FETCH 8.8.8.8.8
FOUND zsclgdhgnu
FETCH 4.8.8.8.8
...
Truncated

Error:
1 1 1 0

Test 32

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 7
COUNT kihqiff
FETCH 7.6.6.3.4
FOUND zyznusp
FETCH 4.3.7.2.2
...
Truncated

Error:
1 1 1 0

Test 33

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 6
COUNT eszubi
FETCH 4.1.6.5.4
FOUND m
FETCH 2.4.3.6.2
...
Truncated

Error:
1 1 1 0

Test 34

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 4
COUNT vyta
FETCH 4.4.4.4.4
FOUND yugojuynkfa
FETCH 2.4.4.4.4
...
Truncated

Error:
1 1 1 0

Test 35

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 9
COUNT ctohjykey
FETCH 5.9.9.5.8
FOUND mhf
FETCH 3.5.5.3.4
...
Truncated

Error:
1 1 1 0

Test 36

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 8
COUNT igjxpndn
FETCH 8.8.8.8.8
FOUND zpksskp
FETCH 4.8.8.8.8
...
Truncated

Error:
1 1 1 0

Test 37

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 7
COUNT lslhnht
FETCH 7.6.6.3.4
FOUND zf
FETCH 4.3.7.2.2
...
Truncated

Error:
1 1 1 0

Test 38

Verdict: ACCEPTED

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

correct output
(empty)

user output
SIZE 7
COUNT hxliesh
FETCH 7.6.6.3.4
FOUND zdltz
FETCH 4.3.7.2.2
...
Truncated

Error:
1 1 1 0

Test 39

Verdict: ACCEPTED

input
2 1
fu
dl 32

correct output
(empty)

user output
SIZE 2
COUNT fu
FETCH 2.2.2.2.2
FOUND dl
FETCH 2.1.1.1.1
...
Truncated

Error:
1 1 1 0

Test 40

Verdict: ACCEPTED

input
3 1
fuuicsxvc
fuuicsxvc 243

correct output
(empty)

user output
SIZE 3
COUNT fuuicsxvc
FETCH 2.2.3.1.2
FOUND fuuicsxvc
FETCH 1.3.2.1.1
...
Truncated

Error:
1 1 1 0

Test 41

Verdict: ACCEPTED

input
4 1
bcytu
bcytu 1024

correct output
(empty)

user output
SIZE 4
COUNT bcytu
FETCH 4.4.4.4.4
FOUND bcytu
FETCH 2.4.4.4.4
...
Truncated

Error:
1 1 1 0