CSES - Aalto Competitive Programming 2024 - wk2 - Wed - Results
Submission details
Task:LibBot
Sender:aalto2024b_005
Submission time:2024-09-11 17:48:06 +0300
Language:C++ (C++11)
Status:READY
Result:
Test results
testverdicttime
#10.02 sdetails
#20.02 sdetails
#30.02 sdetails
#40.02 sdetails
#50.01 sdetails
#60.02 sdetails
#70.02 sdetails
#80.02 sdetails
#90.02 sdetails
#100.02 sdetails
#110.02 sdetails
#120.02 sdetails
#130.02 sdetails
#140.02 sdetails
#150.02 sdetails
#160.02 sdetails
#170.02 sdetails
#180.02 sdetails
#190.01 sdetails
#200.01 sdetails
#210.02 sdetails
#220.02 sdetails
#230.02 sdetails
#240.02 sdetails
#250.02 sdetails
#260.02 sdetails
#270.02 sdetails
#280.01 sdetails
#290.02 sdetails
#300.02 sdetails
#310.02 sdetails
#320.02 sdetails
#330.02 sdetails
#340.02 sdetails
#350.01 sdetails
#360.02 sdetails
#370.02 sdetails
#380.02 sdetails
#390.02 sdetails
#400.02 sdetails
#410.02 sdetails

Compiler report

input/code.cpp: In function 'void Test()':
input/code.cpp:14:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     freopen("temp\\in.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
input/code.cpp: In function 'int Check(int)':
input/code.cpp:62:1: warning: control reaches end of non-void function [-Wreturn-type]
   62 | }
      | ^
input/code.cpp: In function 'int main()':
input/code.cpp:67:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   67 |     scanf("SIZE %d\n", &n);
      |     ~~~~~^~~~~~~~~~~~~~~~~
input/code.cpp: In function 'int ToNum(std::string)':
input/code.cpp:37:12: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
   37 |     return ret;
      |            ^~~

Code

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<sstream>
typedef long long LL;

using std::cin;
using std::cout;
using std::string;

void Test()
{
    freopen("temp\\in.txt", "r", stdin);
} 

int n, N;
string s, model;

void Input()
{
    cin.ignore(6);
    cin>>s;
}

int ToNum(string t)
{
    int x, ret;
    for(int i=1; i<=n; i++)
    {
        std::stringstream(t)>>x;    
        int t = 1;
        for(int j=1; j<=i; j++)
            t*=x;
        ret += t;
    }
    return ret;
}
string ToStr(int x)
{
    string ret="";
    while(x)
    {
        int t = x%n;
        ret = std::to_string(t)+"."+ret;
        x/=n;
    }
    return ret;
}

int Check(int num)
{
    cout<<"FETCH "+ToStr(num)<<std::endl;

    Input();
    if(s < model)
        return -1;
    if(s > model)
        return 1;
    if(s == model)
        return 0;
}

int main()
{
    // Test();
    scanf("SIZE %d\n", &n);
    N = 1;
    for(int i=1; i<=5; i++)
        N*=n;
    Input();
    model = s;

    int L, R;
    // find left
    int l=1, r=N;
    while(l<r)
    {
        int mid = (l+r)/2;
        if(Check(mid) == -1)
            l=mid+1;
        else
            r=mid;
    }
    L = l;

    // find right
    l=1, r=N;
    while(l<r)
    {
        int mid = (l+r)/2;
        if(Check(mid) != 1)
            l=mid+1;
        else
            r=mid;
    }
    R = l-1;

    printf("%d", R-L);

    return 0;
}

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.0.0.0.0.

Error:
1 1 0 0

Test 2

Verdict:

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

correct output
(empty)

user output
SIZE 3
COUNT irwkfl
FETCH 1.1.1.1.2.

Error:
1 1 0 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.0.0.0.0.

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 2.2.2.2.3.

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.0.0.0.0.

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 3.3.3.3.4.

Error:
1 1 0 0

Test 7

Verdict:

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

correct output
(empty)

user output
SIZE 8
COUNT djnofmgdbfj
FETCH 4.0.0.0.0.

Error:
1 1 0 0

Test 8

Verdict:

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

correct output
(empty)

user output
SIZE 9
COUNT qonvyqgibutxey
FETCH 4.4.4.4.5.

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.0.0.0.0.

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.0.0.0.0.

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 4.4.4.4.5.

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.0.0.0.0.

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 3.3.3.3.4.

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.0.0.0.0.

Error:
1 1 0 0

Test 15

Verdict:

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

correct output
(empty)

user output
SIZE 4
COUNT unje
FETCH 2.0.0.0.0.

Error:
1 1 0 0

Test 16

Verdict:

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

correct output
(empty)

user output
SIZE 9
COUNT ckfhsouqxvv
FETCH 4.4.4.4.5.

Error:
1 1 0 0

Test 17

Verdict:

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

correct output
(empty)

user output
SIZE 8
COUNT h
FETCH 4.0.0.0.0.

Error:
1 1 0 0

Test 18

Verdict:

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

correct output
(empty)

user output
SIZE 7
COUNT m
FETCH 3.3.3.3.4.

Error:
1 1 0 0

Test 19

Verdict:

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

correct output
(empty)

user output
SIZE 7
COUNT kvtwj
FETCH 3.3.3.3.4.

Error:
1 1 0 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.0.0.0.0.

Error:
1 1 0 0

Test 21

Verdict:

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

correct output
(empty)

user output
SIZE 3
COUNT uvk
FETCH 1.1.1.1.2.

Error:
1 1 0 0

Test 22

Verdict:

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

correct output
(empty)

user output
SIZE 4
COUNT jgtx
FETCH 2.0.0.0.0.

Error:
1 1 0 0

Test 23

Verdict:

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

correct output
(empty)

user output
SIZE 5
COUNT ghmfq
FETCH 2.2.2.2.3.

Error:
1 1 0 0

Test 24

Verdict:

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

correct output
(empty)

user output
SIZE 6
COUNT ojuphd
FETCH 3.0.0.0.0.

Error:
1 1 0 0

Test 25

Verdict:

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

correct output
(empty)

user output
SIZE 7
COUNT kzzqfzz
FETCH 3.3.3.3.4.

Error:
1 1 0 0

Test 26

Verdict:

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

correct output
(empty)

user output
SIZE 8
COUNT emdxvwdw
FETCH 4.0.0.0.0.

Error:
1 1 0 0

Test 27

Verdict:

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

correct output
(empty)

user output
SIZE 9
COUNT pkhsbasuj
FETCH 4.4.4.4.5.

Error:
1 1 0 0

Test 28

Verdict:

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

correct output
(empty)

user output
SIZE 10
COUNT zypqadmqoo
FETCH 5.0.0.0.0.

Error:
1 1 0 0

Test 29

Verdict:

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

correct output
(empty)

user output
SIZE 10
COUNT jhagispreh
FETCH 5.0.0.0.0.

Error:
1 1 0 0

Test 30

Verdict:

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

correct output
(empty)

user output
SIZE 9
COUNT zfkmqpzht
FETCH 4.4.4.4.5.

Error:
1 1 0 0

Test 31

Verdict:

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

correct output
(empty)

user output
SIZE 8
COUNT dogiavnu
FETCH 4.0.0.0.0.

Error:
1 1 0 0

Test 32

Verdict:

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

correct output
(empty)

user output
SIZE 7
COUNT kihqiff
FETCH 3.3.3.3.4.

Error:
1 1 0 0

Test 33

Verdict:

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

correct output
(empty)

user output
SIZE 6
COUNT eszubi
FETCH 3.0.0.0.0.

Error:
1 1 0 0

Test 34

Verdict:

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

correct output
(empty)

user output
SIZE 4
COUNT vyta
FETCH 2.0.0.0.0.

Error:
1 1 0 0

Test 35

Verdict:

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

correct output
(empty)

user output
SIZE 9
COUNT ctohjykey
FETCH 4.4.4.4.5.

Error:
1 1 0 0

Test 36

Verdict:

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

correct output
(empty)

user output
SIZE 8
COUNT igjxpndn
FETCH 4.0.0.0.0.

Error:
1 1 0 0

Test 37

Verdict:

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

correct output
(empty)

user output
SIZE 7
COUNT lslhnht
FETCH 3.3.3.3.4.

Error:
1 1 0 0

Test 38

Verdict:

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

correct output
(empty)

user output
SIZE 7
COUNT hxliesh
FETCH 3.3.3.3.4.

Error:
1 1 0 0

Test 39

Verdict:

input
2 1
fu
dl 32

correct output
(empty)

user output
SIZE 2
COUNT fu
FETCH 1.0.0.0.0.

Error:
1 1 0 0

Test 40

Verdict:

input
3 1
fuuicsxvc
fuuicsxvc 243

correct output
(empty)

user output
SIZE 3
COUNT fuuicsxvc
FETCH 1.1.1.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.0.0.0.0.

Error:
1 1 0 0