█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 1001

Problema 0xf2 - Partir un arreglo grande en 2

  • Autor: juantamayo26
  • Fecha: 2020-10-06 22:00:27 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      Compilation time limit exceeded.
                    
#2
Error de compilación
                      Compilation time limit exceeded.
                    
#3
Error de compilación
                      Compilation time limit exceeded.
                    
#4
Error de compilación
                      Compilation time limit exceeded.
                    
#5
Error de compilación
                      Compilation time limit exceeded.
                    
#6
Error de compilación
                      Compilation time limit exceeded.
                    
#7
Error de compilación
                      Compilation time limit exceeded.
                    
#8
Error de compilación
                      Compilation time limit exceeded.
                    
#9
Error de compilación
                      Compilation time limit exceeded.
                    
#10
Error de compilación
                      Compilation time limit exceeded.
                    
#11
Error de compilación
                      Compilation time limit exceeded.
                    
#12
Error de compilación
                      Compilation time limit exceeded.
                    
#13
Correcto
0.005 s 10 KBi
#14
Correcto
0.646 s 7 KBi
#15
Tiempo límite excedido
0.698 s 13 KBi
#16
Tiempo límite excedido
1.015 s 21 KBi
#17
Tiempo límite excedido
0.838 s 7 KBi
#18
Correcto
0.04 s 9 KBi
#19
Tiempo límite excedido
1.07 s 32 KBi
#20
Tiempo límite excedido
0.85 s 12 KBi
Puntos totales: 15 / 100

Código

#include <bits/stdc++.h>

using namespace std;

#define endl '\n'
#define ll long long
ll a[500001];

int main(){
  ios::sync_with_stdio(0); cin.tie(0); 
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int mini=0;
  int sumi=0,sumy=0;
  sumi=a[0];
  for(int i=1; i<n;i++){
    sumy=0;
    for(int j=i; j<n; j++){
      sumy+=a[j];
    }
    if(sumi>0 && sumy<0){
      cout<<i<<endl;
      return 0;
    }else{
      sumi+=a[i];
    }
  }
  cout<<"Impossible"<<endl;
}