█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 3984

Problema 0xc9 - Substring más corta con mínimo K caracteres diferentes

  • Autor: bryancalisto
  • Fecha: 2021-04-27 12:49:14 UTC (Hace alrededor de 3 años)
Caso # Resultado Tiempo Memoria
#1
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.004 s 4 KBi
#2
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.004 s 2 KBi
#3
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.006 s 2 KBi
#4
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.003 s 0 KBi
#5
Correcto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.004 s 1 KBi
#6
Correcto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.004 s 2 KBi
#7
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.004 s 1 KBi
#8
Correcto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.005 s 2 KBi
#9
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.005 s 0 KBi
#10
Correcto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.006 s 2 KBi
#11
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.019 s 2 KBi
#12
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.045 s 2 KBi
#13
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.016 s 0 KBi
#14
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.121 s 2 KBi
#15
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.04 s 14 KBi
#16
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.019 s 2 KBi
#17
Correcto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.007 s 2 KBi
#18
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.071 s 2 KBi
#19
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.067 s 2 KBi
#20
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.018 s 7 KBi
#21
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.082 s 2 KBi
#22
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.081 s 2 KBi
#23
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.081 s 2 KBi
#24
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.069 s 1 KBi
#25
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.096 s 2 KBi
#26
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.065 s 2 KBi
#27
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.093 s 2 KBi
#28
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.058 s 0 KBi
#29
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.065 s 3 KBi
#30
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.02 s 2 KBi
#31
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.02 s 2 KBi
#32
Incorrecto
                      main.cpp:65:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  cout << (minLen == 100000) ? -1 : minLen;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
main.cpp:65:30: note: place parentheses around the '<<' expression to silence this warning
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
  (                         )
main.cpp:65:30: note: place parentheses around the '?:' expression to evaluate it first
  cout << (minLen == 100000) ? -1 : minLen;
                             ^
          (                               )
main.cpp:65:32: warning: expression result unused [-Wunused-value]
  cout << (minLen == 100000) ? -1 : minLen;
                               ^~
2 warnings generated.

                    
0.023 s 2 KBi
Puntos totales: 16 / 100

Código

#include <bits/stdc++.h>

using namespace std;

int main()
{
  string str;
  int k, i = 0, j = 0, l = 0, minLen = 100000, len;
  map<char, int> tabla;

  cin >> str;
  cin >> k;
  if (k == 1)
  {
    cout << 1;
    return 0;
  }

  while (i < str.length() && j < str.length())
  {
    tabla[str[j]]++;
    // printf("despues de while.. len: %d  size: %d\n", j - i + 1, tabla.size());
    if (j - i + 1 >= k && tabla.size() >= k)
    {
      l = i;
      // printf("tabla[%c]: %d     str[l] == str[l + 1]  ... %c == %c\n", str[l], tabla[str[l]], str[l], str[l + 1]);
      if (tabla[str[l]] > 1 && str[l] != str[l + 1])
      {
        tabla[str[l]]--;
        i++;
      }
      else if (tabla[str[l]] > 1)
      {
        while (tabla[str[l]] > 1)
        {
          tabla[str[l]]--;
          i++;
        }
      }

      // DEBUG
      // printf("substring => ");
      // for (int m = i; m <= j; m++)
      // {
      //   printf("%c", str[m]);
      // }
      // printf("\n");

      minLen = min(minLen, j - i + 1);
    }

    while (tabla.size() >= k && j - i + 1 > k)
    {
      tabla[str[i]]--;
      if (tabla[str[i]] == 0)
      {
        tabla.erase(str[i]);
      }
      i++;
    }

    j++;
  }

  cout << (minLen == 100000) ? -1 : minLen;
  return 0;
}