Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.007 s | 3 KBi |
#2 |
Correcto
|
0.007 s | 4 KBi |
#3 |
Correcto
|
0.006 s | 3 KBi |
#4 |
Correcto
|
0.007 s | 3 KBi |
#5 |
Correcto
|
0.006 s | 3 KBi |
#6 |
Correcto
|
0.006 s | 3 KBi |
#7 |
Correcto
|
0.007 s | 3 KBi |
#8 |
Correcto
|
0.007 s | 3 KBi |
#9 |
Correcto
|
0.007 s | 9 KBi |
#10 |
Correcto
|
0.007 s | 13 KBi |
#11 |
Correcto
|
0.006 s | 12 KBi |
#12 |
Correcto
|
0.007 s | 3 KBi |
#13 |
Correcto
|
0.007 s | 9 KBi |
#14 |
Correcto
|
0.088 s | 3 KBi |
#15 |
Correcto
|
0.089 s | 5 KBi |
#16 |
Correcto
|
0.091 s | 3 KBi |
#17 |
Correcto
|
0.102 s | 5 KBi |
#18 |
Correcto
|
0.087 s | 3 KBi |
#19 |
Correcto
|
0.086 s | 3 KBi |
#20 |
Correcto
|
0.12 s | 3 KBi |
#include <iostream> #include <cstring> #include <cstdio> using namespace std; typedef long long ll; const int MAXN = 500005; int n, sum[MAXN]; int main() { cin >> n; memset(sum, 0, sizeof(sum)); for (int i = 0; i < n; ++i) { cin >> sum[i]; if (i > 0) sum[i] += sum[i - 1]; } int left = 0, right = 0; for (int i = 1; i < n; ++i) { left = sum[i - 1]; right = sum[n - 1] - sum[i - 1]; if (left > 0 && right < 0) { cout << i << endl; return 0; } } cout << "Impossible" << endl; return 0; }