Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#2 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#3 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#4 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#5 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#6 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#7 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#8 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#9 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#10 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#11 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#12 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#13 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#14 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#15 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#16 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#17 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#18 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#19 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#20 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#21 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#22 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#23 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
||
#24 |
Error de compilación
main.cpp:45:13: error: no matching function for call to 'kadane' cout << kadane(a, n); ^~~~~~ main.cpp:9:5: note: candidate function not viable: no known conversion from 'vector<int>' to 'int *' for 1st argument int kadane(int arr[], int n) ^ 1 error generated. |
#include <iostream> #include <vector> using namespace std; int kadane(int arr[], int n); // Function to find the maximum sum of a contiguous subarray // in a given integer array int kadane(int arr[], int n) { // stores the maximum sum subarray found so far int max_so_far = 0; // stores the maximum sum of subarray ending at the current position int max_ending_here = 0; // traverse the given array for (int i = 0; i < n; i++) { // update the maximum sum of subarray "ending" at index `i` (by adding the // current element to maximum sum ending at previous index `i-1`) max_ending_here = max_ending_here + arr[i]; // if the maximum sum is negative, set it to 0 (which represents // an empty subarray) max_ending_here = max(max_ending_here, 0); // update the result if the current subarray sum is found to be greater max_so_far = max(max_so_far, max_ending_here); } return max_so_far; } int main() { int n; cin >> n; vector<int> a(n); for(int i =0;i<n;++i){ cin >> a[i]; } cout << kadane(a, n); return 0; }