Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.006 s | 1 KBi |
#2 |
Correcto
|
0.006 s | 1 KBi |
#3 |
Correcto
|
0.006 s | 3 KBi |
#4 |
Incorrecto
|
0.007 s | 9 KBi |
#5 |
Correcto
|
0.006 s | 1 KBi |
#6 |
Correcto
|
0.006 s | 1 KBi |
#7 |
Correcto
|
0.006 s | 1 KBi |
#8 |
Correcto
|
0.006 s | 1 KBi |
#9 |
Incorrecto
|
0.005 s | 1 KBi |
#10 |
Correcto
|
0.006 s | 2 KBi |
#11 |
Correcto
|
0.005 s | 2 KBi |
#12 |
Incorrecto
|
0.007 s | 1 KBi |
#13 |
Incorrecto
|
0.007 s | 10 KBi |
#14 |
Incorrecto
|
0.115 s | 3 KBi |
#15 |
Correcto
|
0.094 s | 3 KBi |
#16 |
Correcto
|
0.129 s | 3 KBi |
#17 |
Correcto
|
0.1 s | 3 KBi |
#18 |
Correcto
|
0.096 s | 3 KBi |
#19 |
Correcto
|
0.09 s | 3 KBi |
#20 |
Incorrecto
|
0.16 s | 3 KBi |
// https://codeo.app/problemas/0xf2-partir-un-arreglo-en-2 #include <iostream> #include <vector> using namespace std; int main() { int n, partitionIndex, sum; vector<int> arr; // Read inputs cin >> n; arr = vector<int>(n); for (int i = 0; i < n; i++) { cin >> arr[i]; } // Calculate index to which array is split and right part sum is negative partitionIndex = n; sum = 0; for (int i = n - 1; i >= 0; i--) { sum += arr[i]; // ignores first element to make partition possible if (sum < 0) { partitionIndex = i; } } // Output if (partitionIndex == n) { cout << "Impossible" << endl; } else { cout << partitionIndex << endl; } return 0; }