Submission details
Task:Merkkijonot
Sender:Lieska
Submission time:2025-11-09 22:51:19 +0200
Language:C++ (C++20)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
#40
#50
Test results
testverdicttimegroup
#1ACCEPTED0.00 s1, 2, 3, 4, 5details
#2ACCEPTED0.00 s2, 3, 4, 5details
#3ACCEPTED0.00 s1, 2, 3, 4, 5details
#40.01 s1, 2, 3, 4, 5details
#5ACCEPTED0.01 s1, 2, 3, 4, 5details
#6ACCEPTED0.01 s1, 2, 3, 4, 5details
#7--1, 2, 3, 4, 5details
#8ACCEPTED0.01 s1, 2, 3, 4, 5details
#9ACCEPTED0.04 s1, 2, 3, 4, 5details
#10ACCEPTED0.01 s1, 2, 3, 4, 5details
#11ACCEPTED0.02 s2, 3, 4, 5details
#12--2, 3, 4, 5details
#13--2, 3, 4, 5details
#14--2, 3, 4, 5details
#15--2, 3, 4, 5details
#16--2, 3, 4, 5details
#17--2, 3, 4, 5details
#18--2, 3, 4, 5details
#19--3, 4, 5details
#20--3, 4, 5details
#21--3, 4, 5details
#22--3, 4, 5details
#23--3, 4, 5details
#24--3, 4, 5details
#25--3, 4, 5details
#26--3, 4, 5details
#270.48 s4, 5details
#280.48 s4, 5details
#290.48 s4, 5details
#300.48 s4, 5details
#310.48 s4, 5details
#320.48 s4, 5details
#330.48 s4, 5details
#340.48 s4, 5details
#35--5details
#36--5details
#37--5details
#38--5details
#39--5details
#40--5details
#41--5details
#42--5details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:79:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   79 |     for (int i=0; i<results.size(); ++i){
      |                   ~^~~~~~~~~~~~~~~

Code

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

int n,m;
string s, test;

//map<pair<string, int>, bool> ma;
//map<pair<string, int>, bool> ma1;
unordered_map<string, bool> ma, ma1;

int test_cnt=0;

vector<string> results;

void g(int pos, int st_cnt){
    test_cnt++;
    //cout << "g " << pos << " " << st_cnt << " " << test << "\n";
    if (pos < 0) {
        for (int i=0; i<n; ++i) if (test[i]=='-') return;
        results.push_back(test);
        return;
    }

    for (int i = pos+m; i<n; ++i) if (test[i]=='-') return;
    //if (ma1[{test, pos}]) return;
    //ma1[{test,pos}] = true;

    string copy_test = test;
    
    for (int i=0; i<m; ++i){
        test[pos+i] = s[i];
    }
    
    if (ma1[test]==false) g(pos-1, st_cnt+1);
    ma1[test]=true;
    
    test = copy_test;
    g(pos-1, st_cnt);
    
}

void f(int pos, int st_cnt){
    if (pos + m > n) {
        g(pos-1, st_cnt);
        return;
    }
    
    //cout << pos << " " << st_cnt << " " << test << "\n";
        
    string copy_test = test;
    
    for (int i=0; i<m; ++i){
        test[pos+i] = s[i];
    }
    if (ma[test]==false) f(pos+1, st_cnt+1);
    ma[test] = true;
    
    test = copy_test;
    
    //cout << "here " << pos << " " << st_cnt << " " << test << "\n";
    f(pos+1, st_cnt);

}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m;
    cin >> s;
    for (int i=0; i<n; ++i) test.push_back('-');
    
    f(0,1);
    //cout << "hereeee!! " << results.size() << "\n";
    sort(results.begin(), results.end());
    int ans = 0;
    string prev = "";
    for (int i=0; i<results.size(); ++i){
        if (results[i] != prev){
            ans++;
            prev = results[i];
        }
    }
    //cout << test_cnt << "\n";
    cout << ans << "\n";
}
 

Test details

Test 1

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
1 1
a

correct output
1

user output
1

Test 2

Group: 2, 3, 4, 5

Verdict: ACCEPTED

input
20 20
ssxfykmuzljmwgyvldnu

correct output
1

user output
1

Test 3

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
20 10
aaaaaaaaaa

correct output
1

user output
1

Test 4

Group: 1, 2, 3, 4, 5

Verdict:

input
20 10
aabbbaaaab

correct output
1532

user output
1511

Feedback: Incorrect character on line 1 col 3: expected "1532", got "1511"

Test 5

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
20 10
aabbacbdca

correct output
1542

user output
1542

Test 6

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
20 10
ztknszhrby

correct output
3261

user output
3261

Test 7

Group: 1, 2, 3, 4, 5

Verdict:

input
20 1
a

correct output
1

user output
(empty)

Test 8

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
20 10
aabbbbbbba

correct output
1689

user output
1689

Test 9

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
20 8
abxabyab

correct output
8619

user output
8619

Test 10

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
20 10
ababababab

correct output
509

user output
509

Test 11

Group: 2, 3, 4, 5

Verdict: ACCEPTED

input
100 50
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

correct output
1

user output
1

Test 12

Group: 2, 3, 4, 5

Verdict:

input
100 50
bbaaabbbbbabbbbabababababbbaab...

correct output
511493117

user output
(empty)

Test 13

Group: 2, 3, 4, 5

Verdict:

input
100 50
addabbbbbadddccadcabaacbbbaabd...

correct output
618572722

user output
(empty)

Test 14

Group: 2, 3, 4, 5

Verdict:

input
100 50
rrdumiqrjewanjplbyvkaytbcyzbyl...

correct output
35126431

user output
(empty)

Test 15

Group: 2, 3, 4, 5

Verdict:

input
100 1
a

correct output
1

user output
(empty)

Test 16

Group: 2, 3, 4, 5

Verdict:

input
100 50
aabbbbbbbbbbbbbbbbbbbbbbbbbbbb...

correct output
460606355

user output
(empty)

Test 17

Group: 2, 3, 4, 5

Verdict:

input
100 23
aybabtuxaybabtuyaybabtu

correct output
342213037

user output
(empty)

Test 18

Group: 2, 3, 4, 5

Verdict:

input
100 50
ababababababababababababababab...

correct output
775006564

user output
(empty)

Test 19

Group: 3, 4, 5

Verdict:

input
1000 50
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

correct output
1

user output
(empty)

Test 20

Group: 3, 4, 5

Verdict:

input
1000 50
bbabaabbabbbaaaaaaaaaababaabbb...

correct output
911592620

user output
(empty)

Test 21

Group: 3, 4, 5

Verdict:

input
1000 50
cacabdddcbdadabdcbdddbdddbaccb...

correct output
12869296

user output
(empty)

Test 22

Group: 3, 4, 5

Verdict:

input
1000 50
tqoyadbshyehwcwaxbtbsqtaswkyet...

correct output
741984969

user output
(empty)

Test 23

Group: 3, 4, 5

Verdict:

input
1000 1
a

correct output
1

user output
(empty)

Test 24

Group: 3, 4, 5

Verdict:

input
1000 50
aabbbbbbbbbbbbbbbbbbbbbbbbbbbb...

correct output
599950419

user output
(empty)

Test 25

Group: 3, 4, 5

Verdict:

input
1000 23
aybabtuxaybabtuyaybabtu

correct output
548809016

user output
(empty)

Test 26

Group: 3, 4, 5

Verdict:

input
1000 50
ababababababababababababababab...

correct output
765799780

user output
(empty)

Test 27

Group: 4, 5

Verdict:

input
1000000 50
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

correct output
1

user output
(empty)

Test 28

Group: 4, 5

Verdict:

input
1000000 50
bbaababbaaabbabababbaaaaaabbaa...

correct output
514073453

user output
(empty)

Test 29

Group: 4, 5

Verdict:

input
1000000 50
aabccabbbbabccabcdcdadbcdccdac...

correct output
438094288

user output
(empty)

Test 30

Group: 4, 5

Verdict:

input
1000000 50
yzfzimxrxfukhlkrtaylohyuqkupsn...

correct output
905445077

user output
(empty)

Test 31

Group: 4, 5

Verdict:

input
1000000 1
a

correct output
1

user output
(empty)

Test 32

Group: 4, 5

Verdict:

input
1000000 50
aabbbbbbbbbbbbbbbbbbbbbbbbbbbb...

correct output
280596224

user output
(empty)

Test 33

Group: 4, 5

Verdict:

input
1000000 23
aybabtuxaybabtuyaybabtu

correct output
268144314

user output
(empty)

Test 34

Group: 4, 5

Verdict:

input
1000000 50
ababababababababababababababab...

correct output
655244665

user output
(empty)

Test 35

Group: 5

Verdict:

input
1000000000 50
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

correct output
1

user output
(empty)

Test 36

Group: 5

Verdict:

input
1000000000 50
abbbaabbaaaaabbbbabbabbaaaaaba...

correct output
911059863

user output
(empty)

Test 37

Group: 5

Verdict:

input
1000000000 50
cbabbcaadabbcabbdbdabbbcccbdca...

correct output
994268014

user output
(empty)

Test 38

Group: 5

Verdict:

input
1000000000 50
pehyicejeninplaczwezhahmbhwfwi...

correct output
837165971

user output
(empty)

Test 39

Group: 5

Verdict:

input
1000000000 1
a

correct output
1

user output
(empty)

Test 40

Group: 5

Verdict:

input
1000000000 50
aabbbbbbbbbbbbbbbbbbbbbbbbbbbb...

correct output
114333489

user output
(empty)

Test 41

Group: 5

Verdict:

input
1000000000 23
aybabtuxaybabtuyaybabtu

correct output
628064772

user output
(empty)

Test 42

Group: 5

Verdict:

input
1000000000 50
ababababababababababababababab...

correct output
802946327

user output
(empty)