Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.007 s | 4 KBi |
#2 |
Correcto
|
0.005 s | 4 KBi |
#3 |
Correcto
|
0.004 s | 4 KBi |
#4 |
Incorrecto
|
0.004 s | 5 KBi |
#5 |
Correcto
|
0.005 s | 8 KBi |
#6 |
Incorrecto
|
0.004 s | 6 KBi |
#7 |
Incorrecto
|
0.006 s | 7 KBi |
#8 |
Incorrecto
|
0.005 s | 3 KBi |
#9 |
Incorrecto
|
0.005 s | 10 KBi |
#10 |
Correcto
|
0.005 s | 7 KBi |
#11 |
Correcto
|
0.004 s | 14 KBi |
#12 |
Correcto
|
0.004 s | 14 KBi |
#13 |
Correcto
|
0.004 s | 14 KBi |
#14 |
Correcto
|
0.03 s | 8 KBi |
#15 |
Correcto
|
0.023 s | 9 KBi |
#16 |
Incorrecto
|
0.024 s | 5 KBi |
#17 |
Correcto
|
0.032 s | 7 KBi |
#18 |
Correcto
|
0.022 s | 9 KBi |
#19 |
Correcto
|
0.023 s | 7 KBi |
#20 |
Correcto
|
0.053 s | 5 KBi |
// Made by Daniel Diaz (@Danidiaztech) #include <bits/stdc++.h> using namespace std; #define endl '\n' #define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); #define forn(i, n) for (int i = 0; i < n; i++) // for in range in python #define FOR(i, a, b) for (int i = a; i < b; i++) // for in range in python #define int long long int #define double long double #define pb push_back #define ff first #define ss second #define mk make_pair typedef pair<int, int> pii; const int MAX = 1e6; const int MIN = -MAX; const int INF = LLONG_MAX; const int MINF = LLONG_MIN; const int MOD = 1e9 + 7; // int arr[MAX]; void solve(){ int n; cin >> n; int a[n]; int s= 0; forn(i,n){ cin >> a[i]; s+=a[i]; } int right = s, left = 0; for (int i = 0; i < n; i++){ left += a[i]; right -= a[i]; if (left > 0 && right < 0){ cout << i + 1 << endl; return; } } cout << "IMPOSSIBLE" << endl; } int32_t main() { fastInp; #if LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int tc = 1; // cin >> tc; for (int t = 1; t <= tc; t++){ // cout << "Case #" << t << ": "; solve(); } return 0; }