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

Envío 2630

Problema 0x94 - Subarreglo de máxima suma

  • Autor: DanielP
  • Fecha: 2021-01-16 21:10:21 UTC (Hace casi 4 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#2
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#3
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#4
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#5
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#6
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#7
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#8
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#9
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#10
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#11
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#12
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#13
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#14
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#15
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#16
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#17
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#18
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#19
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#20
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#21
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#22
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#23
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
#24
Error de compilación
                      main.cpp:20:10: error: use of undeclared identifier 'suma'
        int ans=suma=v[0];
                ^
main.cpp:22:6: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
            ^
main.cpp:22:15: error: use of undeclared identifier 'suma'
            suma=max(suma+v[i],v[i]);
                     ^
main.cpp:23:14: error: use of undeclared identifier 'suma'; did you mean 'fma'?
            ans=max(suma,ans);
                    ^~~~
                    fma
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:335:13: note: 'fma' declared here
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
            ^
4 errors generated.

                    
Puntos totales: 0 / 100

Código

/// Write by Daniel Perez .PERAPRO
#include<bits/stdc++.h>

using namespace std;
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using vi=vector<int>;
#define pb push_back
typedef long long ll;



int main(){
	fast_io;
	int n;
	cin>>n;
	vi v(n);
	for(int i=0;i<n;i++){
	    cin>>v[i];
	}
	int ans=suma=v[0];
	for(int i=0;i<n;i++){
	    suma=max(suma+v[i],v[i]);
	    ans=max(suma,ans);
	}
	cout<<ans<<endl;
}