Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.006 s | 7 KBi |
#2 |
Correcto
|
0.005 s | 9 KBi |
#3 |
Correcto
|
0.005 s | 4 KBi |
#4 |
Correcto
|
0.005 s | 1 KBi |
#5 |
Correcto
|
0.005 s | 1 KBi |
#6 |
Correcto
|
0.005 s | 9 KBi |
#7 |
Correcto
|
0.005 s | 14 KBi |
#8 |
Correcto
|
0.005 s | 2 KBi |
#9 |
Correcto
|
0.005 s | 1 KBi |
#10 |
Correcto
|
0.005 s | 2 KBi |
#11 |
Correcto
|
0.005 s | 2 KBi |
#12 |
Correcto
|
0.005 s | 2 KBi |
#13 |
Correcto
|
0.005 s | 1 KBi |
#14 |
Correcto
|
0.101 s | 5 KBi |
#15 |
Correcto
|
0.098 s | 5 KBi |
#16 |
Correcto
|
0.091 s | 5 KBi |
#17 |
Correcto
|
0.114 s | 5 KBi |
#18 |
Correcto
|
0.091 s | 5 KBi |
#19 |
Correcto
|
0.092 s | 5 KBi |
#20 |
Correcto
|
0.122 s | 5 KBi |
#include <iostream> #include <list> #include <vector> using namespace std; vector<int> processLine(int N) { vector<int> elements(N); for (int i=0; i < N; i++) { cin >> elements[i]; } return elements; } string solve(int N, vector<int> elements) { int total, left; left = 0; total = 0; for (int i=0; i < N;i++) { total += elements[i]; } for (int i=0; i < N;i++) { left += elements[i]; total -= elements[i]; if (left > 0 && total < 0) { return to_string(i+1); } } return "Impossible"; } int main() { int N; vector<int> elements; string solution; cin >> N; elements = processLine(N); solution = solve(N, elements); cout << solution << endl; }