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

Envío 3880

Problema 0x94 - Subarreglo de máxima suma

  • Autor: Jhon_z09
  • Fecha: 2021-04-20 19:33:32 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#2
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#3
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#4
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#5
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#6
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#7
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#8
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#9
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#10
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#11
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#12
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#13
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#14
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#15
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#16
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#17
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#18
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#19
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#20
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#21
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#22
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#23
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
#24
Error de compilación
                      main.cpp:13:14: error: use of undeclared identifier 'bes'; did you mean 'best'?
                best = max(bes, curr);
                           ^~~
                           best
main.cpp:10:5: note: 'best' declared here
        ll best = -10e10, curr = -10e10;
           ^
1 error generated.

                    
Puntos totales: 0 / 100

Código

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

int main(){
	int n; cin >> n;
	vector<ll> arr(n);
	for(int i = 0; i < n; ++i) cin >> arr[i];
	
	ll best = -10e10, curr = -10e10;
	for(ll i: arr){
		curr = max(curr, curr + i);
		best = max(bes, curr);
	}
	
	cout << best;

	return 0;
}