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

Envío 5841

Problema 0xf2 - Partir un arreglo grande en 2

  • Autor: slash
  • Fecha: 2022-03-10 20:37:06 UTC (Hace casi 3 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#2
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#3
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#4
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#5
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#6
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#7
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#8
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#9
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#10
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#11
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#12
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#13
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#14
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#15
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#16
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#17
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#18
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#19
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
#20
Error de compilación
                      main.cpp:7:2: error: use of undeclared identifier 'vector'
        vector<int> in;
        ^
main.cpp:7:12: error: expected '(' for function-style cast or type construction
        vector<int> in;
               ~~~^
main.cpp:7:14: error: use of undeclared identifier 'in'
        vector<int> in;
                    ^
main.cpp:13:3: error: use of undeclared identifier 'in'
                in.push_back(k);
                ^
main.cpp:17:11: error: use of undeclared identifier 'in'
                left += in[i];
                        ^
main.cpp:18:12: error: use of undeclared identifier 'in'
                right -= in[i];
                         ^
main.cpp:32:22: error: use of undeclared identifier 'i'
        if (possible) cout<<i<<'\n';
                            ^
7 errors generated.

                    
Puntos totales: 0 / 100

Código

#include<iostream>

using namespace std;

int main(){

	vector<int> in;
	int left = 0, act_left, right = 0, n, idx;
	bool possible = false;
	cin >> n;
	for (int i = 0; i < n; i ++){
		int k; cin>>k;
		in.push_back(k);
		right += k;
	}
	for (int i = 0; i < n; i ++){
		left += in[i];
		right -= in[i];
		if (!possible && left > 0 && right < 0) {
			possible = true;
			idx = i;
			act_left = left;
		}
		else if(possible && left > 0 && right < 0){
			if (left < act_left) {
				act_left = left;
				idx = i;
			}		
			
		}
	}
	if (possible) cout<<i<<'\n';
	else cout<<"Impossible\n";



}