Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.006 s | 1 KBi |
#2 |
Correcto
|
0.007 s | 59 KBi |
#3 |
Correcto
|
0.006 s | 1 KBi |
#4 |
Correcto
|
0.005 s | 5 KBi |
#5 |
Correcto
|
0.005 s | 2 KBi |
#6 |
Correcto
|
0.006 s | 1 KBi |
#7 |
Correcto
|
0.007 s | 1 KBi |
#8 |
Correcto
|
0.006 s | 2 KBi |
#9 |
Correcto
|
0.005 s | 8 KBi |
#10 |
Correcto
|
0.006 s | 1 KBi |
#11 |
Correcto
|
0.005 s | 1 KBi |
#12 |
Correcto
|
0.006 s | 2 KBi |
#13 |
Correcto
|
0.005 s | 3 KBi |
#14 |
Correcto
|
0.1 s | 5 KBi |
#15 |
Correcto
|
0.1 s | 5 KBi |
#16 |
Correcto
|
0.104 s | 5 KBi |
#17 |
Correcto
|
0.096 s | 5 KBi |
#18 |
Correcto
|
0.089 s | 5 KBi |
#19 |
Correcto
|
0.116 s | 5 KBi |
#20 |
Correcto
|
0.119 s | 6 KBi |
#include <iostream> #include <vector> #include <algorithm> using namespace std; #define ll long long #define D(x) cout << #x << " " << x << endl int main() { ll n, right = 0, left = 0, ans = -1; cin >> n; vector<ll> a(n); for(int i = 0; i < n; ++i) { cin >> a[i]; right += a[i]; } for(int i = 0; i < n && ans == -1; ++i) { if(left > 0 && right < 0) ans = i; left += a[i]; right -= a[i]; } if(ans == -1) cout << "Impossible" << endl; else cout << ans << endl; return 0; }