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

Envío 3006

Problema 0x94 - Subarreglo de máxima suma

Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#2
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#3
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#4
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#5
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#6
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#7
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#8
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#9
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#10
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#11
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#12
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#13
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#14
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#15
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#16
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#17
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#18
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#19
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#20
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#21
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#22
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#23
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
#24
Error de compilación
                      main.cpp:21:13: error: no matching function for call to 'max'
                current = max(current+a[i], a[i]);
                          ^~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:219:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long long' vs. 'int')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:265:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

                    
Puntos totales: 0 / 100

Código

#include <iostream>
#include <map>

using namespace std;

#define ll long long

const int N = 80000+10;
int a[N];

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	ll global = a[0];
	ll current = a[0];
	for(int i=1;i<n;i++){
		current = max(current+a[i], a[i]);
		global = max(global, current);
	}
	cout<<global<<endl;
	return 0;
}