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

Envío 2306

Problema 0x94 - Subarreglo de máxima suma

  • Autor: Rafael
  • Fecha: 2020-12-13 01:12:18 UTC (Hace alrededor de 4 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#2
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#3
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#4
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#5
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#6
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#7
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#8
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#9
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#10
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#11
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#12
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#13
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#14
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#15
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#16
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#17
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#18
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#19
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#20
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#21
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#22
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#23
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
#24
Error de compilación
                      main.cpp:15:23: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                      ^~~
                      nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
main.cpp:15:31: error: use of undeclared identifier 'num'; did you mean 'nums'?
    parc = max(parc + num[i], num[i]);
                              ^~~
                              nums
main.cpp:8:15: note: 'nums' declared here
  vector<int> nums(n);
              ^
2 errors generated.

                    
Puntos totales: 0 / 100

Código

#include <bits/stdc++.h>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> nums(n);
  for (int i = 0; i < n; i++) {
    cin >> nums[i];
  }
  int parc, ans;
  parc = ans = nums[0];
  for (int i = 1; i < n; i++) {
    parc = max(parc + num[i], num[i]);
    ans = max(ans, parc);
  }
  cout << ans << endl;
  return 0;
}