Submission details
Task:Broken backspace
Sender:aalto25j_003
Submission time:2025-11-05 16:30:48 +0200
Language:C++ (C++17)
Status:READY
Result:
Test results
testverdicttime
#10.00 sdetails
#20.00 sdetails
#30.00 sdetails
#40.00 sdetails
#50.00 sdetails
#60.00 sdetails
#70.00 sdetails
#80.00 sdetails
#90.00 sdetails
#100.00 sdetails
#110.00 sdetails
#120.00 sdetails
#130.00 sdetails
#140.00 sdetails
#150.00 sdetails
#160.00 sdetails
#170.00 sdetails
#180.00 sdetails
#190.00 sdetails
#200.00 sdetails
#210.00 sdetails
#220.00 sdetails
#230.00 sdetails
#240.00 sdetails
#250.00 sdetails
#260.00 sdetails
#270.00 sdetails
#280.00 sdetails
#290.00 sdetails
#300.00 sdetails
#310.00 sdetails
#320.00 sdetails
#330.00 sdetails
#340.00 sdetails
#350.00 sdetails
#360.00 sdetails
#370.00 sdetails
#380.00 sdetails
#390.00 sdetails
#400.00 sdetails
#410.00 sdetails
#420.00 sdetails
#430.00 sdetails
#440.00 sdetails
#450.01 sdetails
#460.01 sdetails
#470.01 sdetails
#480.01 sdetails
#490.01 sdetails
#500.03 sdetails
#510.02 sdetails
#520.03 sdetails
#530.02 sdetails
#540.02 sdetails
#550.03 sdetails
#560.03 sdetails
#570.03 sdetails
#580.03 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:50:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |   for (int ii = 0; ii < clev.size() - 1; ii++) {
      |                    ~~~^~~~~~~~~~~~~~~~~

Code

#include <bits/stdc++.h>
#define ll long long

std::vector<ll> brute(std::string &stri) {
  ll le = stri.size();
  std::vector<ll> ret(le, 0);
  ret[0] = le;

  for (ll ii = 0; ii < le; ii++) {
    ll counter = 0;
    for (ll jj = 0; jj < le - ii; jj++) {
      if (stri[ii + jj] != stri[jj]) {
        break;
      }
      counter++;
    }
    ret[ii] = counter;
  }
  return ret;
}

std::vector<ll> clever(std::string &stri) {
  ll le = stri.size();
  std::vector<ll> ret(le, 0);
  ret[0] = le;

  ll xx = 0;
  ll yy = 0;
  for (ll ii = 0; ii < le; ii++) {
    ret[ii] = std::max(0LL, std::min(yy - ii + 1, ret[ii - xx]));
    while (ii + ret[ii] < le && stri[ret[ii]] == stri[ii + ret[ii]]) {
      xx = ii;
      yy = ii + ret[ii];
      ret[ii]++;
    }
  }
  return ret;
  return std::vector<ll>();
}

int main() {
  std::string input;
  std::cin >> input;

  // std::vector<ll> brut = brute(input);
  std::vector<ll> clev = clever(input);
  // if (brut != clev) {
  //   std::cout << "WRÖNG" << std::endl;
  // }
  for (int ii = 0; ii < clev.size() - 1; ii++) {
    std::cout << clev[ii] << " ";
  }
  std::cout << clev[clev.size() - 1] << std::endl;
  return 0;
}

Test details

Test 1

Verdict:

input
y
a

correct output
No

user output
1

Feedback: Incorrect character on line 1 col 1: expected "No", got "1"

Test 2

Verdict:

input
y
o

correct output
No

user output
1

Feedback: Incorrect character on line 1 col 1: expected "No", got "1"

Test 3

Verdict:

input
bs
bs

correct output
Yes

user output
2 0

Feedback: Output is longer than expected

Test 4

Verdict:

input
vfj
xz

correct output
No

user output
3 0 0

Feedback: Output is longer than expected

Test 5

Verdict:

input
yif
yi

correct output
Yes

user output
3 0 0

Feedback: Output is longer than expected

Test 6

Verdict:

input
ilzsl
zio

correct output
No

user output
5 0 0 0 0

Feedback: Output is longer than expected

Test 7

Verdict:

input
azg
a

correct output
Yes

user output
3 0 0

Feedback: Output is longer than expected

Test 8

Verdict:

input
mmad
ida

correct output
No

user output
4 1 0 0

Feedback: Output is longer than expected

Test 9

Verdict:

input
rmfs
ykcm

correct output
No

user output
4 0 0 0

Feedback: Output is longer than expected

Test 10

Verdict:

input
skqwu
ewix

correct output
No

user output
5 0 0 0 0

Feedback: Output is longer than expected

Test 11

Verdict:

input
rkxgc
wtep

correct output
No

user output
5 0 0 0 0

Feedback: Output is longer than expected

Test 12

Verdict:

input
lcat
lce

correct output
No

user output
4 0 0 0

Feedback: Output is longer than expected

Test 13

Verdict:

input
zmggznshn
wibfc

correct output
No

user output
9 0 0 0 1 0 0 0 0

Feedback: Output is longer than expected

Test 14

Verdict:

input
hjgri
fxgxt

correct output
No

user output
5 0 0 0 0

Feedback: Output is longer than expected

Test 15

Verdict:

input
aqjtb
ci

correct output
No

user output
5 0 0 0 0

Feedback: Output is longer than expected

Test 16

Verdict:

input
pnxnq
pnxnq

correct output
Yes

user output
5 0 0 0 0

Feedback: Output is longer than expected

Test 17

Verdict:

input
smvvt
s

correct output
Yes

user output
5 0 0 0 0

Feedback: Output is longer than expected

Test 18

Verdict:

input
dehlwu
de

correct output
Yes

user output
6 0 0 0 0 0

Feedback: Output is longer than expected

Test 19

Verdict:

input
frovxqt
f

correct output
Yes

user output
7 0 0 0 0 0 0

Feedback: Output is longer than expected

Test 20

Verdict:

input
isnaiipj
isnai

correct output
Yes

user output
8 0 0 0 1 1 0 0

Feedback: Output is longer than expected

Test 21

Verdict:

input
tvfqorxbf
hsiaf

correct output
No

user output
9 0 0 0 0 0 0 0 0

Feedback: Output is longer than expected

Test 22

Verdict:

input
hbeyzrmpxd
hbeyzrm

correct output
Yes

user output
10 0 0 0 0 0 0 0 0 0

Feedback: Output is longer than expected

Test 23

Verdict:

input
cvfrdstyia
cvf

correct output
Yes

user output
10 0 0 0 0 0 0 0 0 0

Feedback: Output is longer than expected

Test 24

Verdict:

input
fbqlgvoypsttw
gkqjckcnpk

correct output
No

user output
13 0 0 0 0 0 0 0 0 0 0 0 0

Feedback: Output is longer than expected

Test 25

Verdict:

input
qetmuxclwb
grkdwns

correct output
No

user output
10 0 0 0 0 0 0 0 0 0

Feedback: Output is longer than expected

Test 26

Verdict:

input
dnzdfqccei
toeqt

correct output
No

user output
10 0 0 1 0 0 0 0 0 0

Feedback: Output is longer than expected

Test 27

Verdict:

input
gigitadgqgktnmlucdrpjmfgzlugaj...

correct output
No

user output
192 0 2 0 0 0 0 1 0 1 0 0 0 0 ...
Truncated

Feedback: Output is longer than expected

Test 28

Verdict:

input
xhhwpsrfrqywdwqzzgdamkmrgutkys...

correct output
No

user output
100 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
Truncated

Feedback: Output is longer than expected

Test 29

Verdict:

input
kczmpmbrcgapydtsdjmnhgdqjlmfiw...

correct output
Yes

user output
100 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
Truncated

Feedback: Output is longer than expected

Test 30

Verdict:

input
kdolwqxnrxoguefenlghfehedsiypn...

correct output
No

user output
100 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
Truncated

Feedback: Output is longer than expected

Test 31

Verdict:

input
eonoxjbddvetnyzwrscrakqugzyzut...

correct output
No

user output
100 0 0 0 0 0 0 0 0 0 1 0 0 0 ...
Truncated

Feedback: Output is longer than expected

Test 32

Verdict:

input
noytqcblxxegczpwfbcfazouiidlvi...

correct output
Yes

user output
100 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
Truncated

Feedback: Output is longer than expected

Test 33

Verdict:

input
fsnlwzwzhhnnxopbmalxpghzqqhdsg...

correct output
No

user output
100 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
Truncated

Feedback: Output is longer than expected

Test 34

Verdict:

input
vsylfagbpuzphnpddomopbxpjvhzyc...

correct output
No

user output
100 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
Truncated

Feedback: Output is longer than expected

Test 35

Verdict:

input
uftadotelejkwprmhqvxquphskiibj...

correct output
No

user output
100 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
Truncated

Feedback: Output is longer than expected

Test 36

Verdict:

input
wmykhkomvlbaxmocfcdvkcnaqsuyeu...

correct output
No

user output
1000 0 0 0 0 0 0 0 0 0 0 0 0 0...
Truncated

Feedback: Output is longer than expected

Test 37

Verdict:

input
bfvdgidzpdbtkomnsdssudrgesexai...

correct output
No

user output
1312 0 0 0 0 0 0 0 0 0 1 0 0 0...
Truncated

Feedback: Output is longer than expected

Test 38

Verdict:

input
epehugfuqusovmdehqiyoefztwalqj...

correct output
Yes

user output
1000 0 1 0 0 0 0 0 0 0 0 0 0 0...
Truncated

Feedback: Output is longer than expected

Test 39

Verdict:

input
xtsdkcvujwifgijwhrxjyiepwhbmpd...

correct output
Yes

user output
1000 0 0 0 0 0 0 0 0 0 0 0 0 0...
Truncated

Feedback: Output is longer than expected

Test 40

Verdict:

input
suawolvogvzwqdpxqxjttthrtbhnqg...

correct output
No

user output
1872 0 0 0 0 0 0 0 0 0 0 0 0 0...
Truncated

Feedback: Output is longer than expected

Test 41

Verdict:

input
vupolhhxbovznwfxdpftypuarxylzk...

correct output
No

user output
1311 0 0 0 0 0 0 0 0 0 1 0 0 0...
Truncated

Feedback: Output is longer than expected

Test 42

Verdict:

input
pnrxvijvmrczriritjrreqdtlmvtsj...

correct output
No

user output
1636 0 0 0 0 0 0 0 0 0 0 0 0 0...
Truncated

Feedback: Output is longer than expected

Test 43

Verdict:

input
nquhecwwloskilrbxfiqlzxyhggmim...

correct output
Yes

user output
1000 0 0 0 0 0 0 0 0 0 0 0 0 0...
Truncated

Feedback: Output is longer than expected

Test 44

Verdict:

input
yvzchujqnoihsrlbogoecilotaepru...

correct output
No

user output
1988 0 0 0 0 0 0 0 0 0 0 0 0 0...
Truncated

Feedback: Output is longer than expected

Test 45

Verdict:

input
bkbntccvyxeaqspsxlnqgybjhvkyno...

correct output
Yes

user output
10000 0 1 0 0 0 0 0 0 0 0 0 0 ...
Truncated

Feedback: Output is longer than expected

Test 46

Verdict:

input
pycbqedrafcfqifliujkykggxrusll...

correct output
Yes

user output
10000 0 0 0 0 0 0 0 0 0 0 0 0 ...
Truncated

Feedback: Output is longer than expected

Test 47

Verdict:

input
ntuyzptgfhnqgsicdshcwhcravwemj...

correct output
Yes

user output
10000 0 0 0 0 0 0 0 0 0 1 0 0 ...
Truncated

Feedback: Output is longer than expected

Test 48

Verdict:

input
mwdrtpocarqfmmrhlnrmaqlqkmwcwb...

correct output
No

user output
10000 0 0 0 0 0 0 0 0 0 0 0 1 ...
Truncated

Feedback: Output is longer than expected

Test 49

Verdict:

input
ylqvocuyflcqydkppyrmygbopzaciy...

correct output
No

user output
10000 0 0 0 0 0 0 1 0 0 0 0 1 ...
Truncated

Feedback: Output is longer than expected

Test 50

Verdict:

input
bcfrdxcxwypdknwsnsheysairkjruu...

correct output
No

user output
170108 0 0 0 0 0 0 0 0 0 0 0 0...
Truncated

Feedback: Output is longer than expected

Test 51

Verdict:

input
luqybuerbcnshnudgittqrpncjmhjk...

correct output
Yes

user output
100000 0 0 0 0 0 0 0 0 0 0 0 0...
Truncated

Feedback: Output is longer than expected

Test 52

Verdict:

input
izamctfueldbjhauzhxhdvbaiedkxc...

correct output
No

user output
169136 0 0 0 0 0 0 0 0 0 0 0 0...
Truncated

Feedback: Output is longer than expected

Test 53

Verdict:

input
xxuxrrtdpvefxgxikyxvzvjjlnrnzv...

correct output
No

user output
122594 1 0 1 0 0 0 0 0 0 0 0 1...
Truncated

Feedback: Output is longer than expected

Test 54

Verdict:

input
vzckilqzoxmcrupzvrkqtjjokjcyeo...

correct output
No

user output
101499 0 0 0 0 0 0 0 0 0 0 0 0...
Truncated

Feedback: Output is longer than expected

Test 55

Verdict:

input
elesagcjlrhfflaqxsmukgbjiiyyyd...

correct output
Yes

user output
200000 0 1 0 0 0 0 0 0 0 0 0 0...
Truncated

Feedback: Output is longer than expected

Test 56

Verdict:

input
ydbfkccnflhkevsfnhrsgfisocskfs...

correct output
Yes

user output
200000 0 0 0 0 0 0 0 0 0 0 0 0...
Truncated

Feedback: Output is longer than expected

Test 57

Verdict:

input
implxialwixramglvesaxoulttxcij...

correct output
No

user output
200000 0 0 0 0 1 0 0 0 1 0 0 0...
Truncated

Feedback: Output is longer than expected

Test 58

Verdict:

input
uarjxljelkshogcskndxmcouwesvrt...

correct output
No

user output
200000 0 0 0 0 0 0 0 0 0 0 0 0...
Truncated

Feedback: Output is longer than expected