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

Envío 1048

Problema 0xf2 - Partir un arreglo grande en 2

  • Autor: juantamayo26
  • Fecha: 2020-10-09 14:12:35 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#2
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#3
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#4
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#5
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#6
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#7
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#8
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#9
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#10
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#11
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#12
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#13
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#14
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#15
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#16
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#17
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#18
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#19
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#20
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
Puntos totales: 0 / 100

Código

#include <bits/stdc++.h>

using namespace std;

#define endl '\n'
#define ll long long
const int maxi = 500001;
ll a[maxi];
ll prefix[maxi];

int main(){
  ios::sync_with_stdio(0); cin.tie(0); 
  int n;
  cin>>n;
  for(int i=0;i<n; i++){
    cin>>a[i];
  }
  for(int i=n; i>=0; i--){
    prefix[i]=(prefix[i+1]+a[i]);
  }
  if(prefix[0]<0){
    cout<<"Impossible"<<endl;
    return 0;
  }
  for(int i=0;i<=n; i++){
    if(prefix[i]<0){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<"Impossible"<<endl;
  return 0;
  
}