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

Envío 6431

Problema 0x9d - ¿Está ordenado?

  • Autor: bernalcodes
  • Fecha: 2022-07-06 16:49:33 UTC (Hace más de 2 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.cpp:9:15: error: unknown type name 'n'
        vector<int>a(n);
                     ^
main.cpp:9:14: warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
        vector<int>a(n);
                    ^~~
main.cpp:9:15: note: add a pair of parentheses to declare a variable
        vector<int>a(n);
                     ^
                     (
main.cpp:10:8: error: subscripted value is not an array, pointer, or vector
        cin>>a[0];
             ~^~
main.cpp:14:22: error: use of undeclared identifier 'n'
        for (int i = 1; i < n -1; ++i) {
                            ^
main.cpp:15:9: error: subscripted value is not an array, pointer, or vector
                cin>>a[i];
                     ~^~
main.cpp:16:8: error: subscripted value is not an array, pointer, or vector
                if (a[i]] < a[i - 1]]) {
                    ~^~
1 warning and 5 errors generated.

                    
#2
Error de compilación
                      main.cpp:9:15: error: unknown type name 'n'
        vector<int>a(n);
                     ^
main.cpp:9:14: warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
        vector<int>a(n);
                    ^~~
main.cpp:9:15: note: add a pair of parentheses to declare a variable
        vector<int>a(n);
                     ^
                     (
main.cpp:10:8: error: subscripted value is not an array, pointer, or vector
        cin>>a[0];
             ~^~
main.cpp:14:22: error: use of undeclared identifier 'n'
        for (int i = 1; i < n -1; ++i) {
                            ^
main.cpp:15:9: error: subscripted value is not an array, pointer, or vector
                cin>>a[i];
                     ~^~
main.cpp:16:8: error: subscripted value is not an array, pointer, or vector
                if (a[i]] < a[i - 1]]) {
                    ~^~
1 warning and 5 errors generated.

                    
#3
Error de compilación
                      main.cpp:9:15: error: unknown type name 'n'
        vector<int>a(n);
                     ^
main.cpp:9:14: warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
        vector<int>a(n);
                    ^~~
main.cpp:9:15: note: add a pair of parentheses to declare a variable
        vector<int>a(n);
                     ^
                     (
main.cpp:10:8: error: subscripted value is not an array, pointer, or vector
        cin>>a[0];
             ~^~
main.cpp:14:22: error: use of undeclared identifier 'n'
        for (int i = 1; i < n -1; ++i) {
                            ^
main.cpp:15:9: error: subscripted value is not an array, pointer, or vector
                cin>>a[i];
                     ~^~
main.cpp:16:8: error: subscripted value is not an array, pointer, or vector
                if (a[i]] < a[i - 1]]) {
                    ~^~
1 warning and 5 errors generated.

                    
#4
Error de compilación
                      main.cpp:9:15: error: unknown type name 'n'
        vector<int>a(n);
                     ^
main.cpp:9:14: warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
        vector<int>a(n);
                    ^~~
main.cpp:9:15: note: add a pair of parentheses to declare a variable
        vector<int>a(n);
                     ^
                     (
main.cpp:10:8: error: subscripted value is not an array, pointer, or vector
        cin>>a[0];
             ~^~
main.cpp:14:22: error: use of undeclared identifier 'n'
        for (int i = 1; i < n -1; ++i) {
                            ^
main.cpp:15:9: error: subscripted value is not an array, pointer, or vector
                cin>>a[i];
                     ~^~
main.cpp:16:8: error: subscripted value is not an array, pointer, or vector
                if (a[i]] < a[i - 1]]) {
                    ~^~
1 warning and 5 errors generated.

                    
#5
Error de compilación
                      main.cpp:9:15: error: unknown type name 'n'
        vector<int>a(n);
                     ^
main.cpp:9:14: warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
        vector<int>a(n);
                    ^~~
main.cpp:9:15: note: add a pair of parentheses to declare a variable
        vector<int>a(n);
                     ^
                     (
main.cpp:10:8: error: subscripted value is not an array, pointer, or vector
        cin>>a[0];
             ~^~
main.cpp:14:22: error: use of undeclared identifier 'n'
        for (int i = 1; i < n -1; ++i) {
                            ^
main.cpp:15:9: error: subscripted value is not an array, pointer, or vector
                cin>>a[i];
                     ~^~
main.cpp:16:8: error: subscripted value is not an array, pointer, or vector
                if (a[i]] < a[i - 1]]) {
                    ~^~
1 warning and 5 errors generated.

                    
#6
Error de compilación
                      main.cpp:9:15: error: unknown type name 'n'
        vector<int>a(n);
                     ^
main.cpp:9:14: warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
        vector<int>a(n);
                    ^~~
main.cpp:9:15: note: add a pair of parentheses to declare a variable
        vector<int>a(n);
                     ^
                     (
main.cpp:10:8: error: subscripted value is not an array, pointer, or vector
        cin>>a[0];
             ~^~
main.cpp:14:22: error: use of undeclared identifier 'n'
        for (int i = 1; i < n -1; ++i) {
                            ^
main.cpp:15:9: error: subscripted value is not an array, pointer, or vector
                cin>>a[i];
                     ~^~
main.cpp:16:8: error: subscripted value is not an array, pointer, or vector
                if (a[i]] < a[i - 1]]) {
                    ~^~
1 warning and 5 errors generated.

                    
#7
Error de compilación
                      main.cpp:9:15: error: unknown type name 'n'
        vector<int>a(n);
                     ^
main.cpp:9:14: warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
        vector<int>a(n);
                    ^~~
main.cpp:9:15: note: add a pair of parentheses to declare a variable
        vector<int>a(n);
                     ^
                     (
main.cpp:10:8: error: subscripted value is not an array, pointer, or vector
        cin>>a[0];
             ~^~
main.cpp:14:22: error: use of undeclared identifier 'n'
        for (int i = 1; i < n -1; ++i) {
                            ^
main.cpp:15:9: error: subscripted value is not an array, pointer, or vector
                cin>>a[i];
                     ~^~
main.cpp:16:8: error: subscripted value is not an array, pointer, or vector
                if (a[i]] < a[i - 1]]) {
                    ~^~
1 warning and 5 errors generated.

                    
#8
Error de compilación
                      main.cpp:9:15: error: unknown type name 'n'
        vector<int>a(n);
                     ^
main.cpp:9:14: warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
        vector<int>a(n);
                    ^~~
main.cpp:9:15: note: add a pair of parentheses to declare a variable
        vector<int>a(n);
                     ^
                     (
main.cpp:10:8: error: subscripted value is not an array, pointer, or vector
        cin>>a[0];
             ~^~
main.cpp:14:22: error: use of undeclared identifier 'n'
        for (int i = 1; i < n -1; ++i) {
                            ^
main.cpp:15:9: error: subscripted value is not an array, pointer, or vector
                cin>>a[i];
                     ~^~
main.cpp:16:8: error: subscripted value is not an array, pointer, or vector
                if (a[i]] < a[i - 1]]) {
                    ~^~
1 warning and 5 errors generated.

                    
#9
Error de compilación
                      main.cpp:9:15: error: unknown type name 'n'
        vector<int>a(n);
                     ^
main.cpp:9:14: warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
        vector<int>a(n);
                    ^~~
main.cpp:9:15: note: add a pair of parentheses to declare a variable
        vector<int>a(n);
                     ^
                     (
main.cpp:10:8: error: subscripted value is not an array, pointer, or vector
        cin>>a[0];
             ~^~
main.cpp:14:22: error: use of undeclared identifier 'n'
        for (int i = 1; i < n -1; ++i) {
                            ^
main.cpp:15:9: error: subscripted value is not an array, pointer, or vector
                cin>>a[i];
                     ~^~
main.cpp:16:8: error: subscripted value is not an array, pointer, or vector
                if (a[i]] < a[i - 1]]) {
                    ~^~
1 warning and 5 errors generated.

                    
#10
Error de compilación
                      main.cpp:9:15: error: unknown type name 'n'
        vector<int>a(n);
                     ^
main.cpp:9:14: warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
        vector<int>a(n);
                    ^~~
main.cpp:9:15: note: add a pair of parentheses to declare a variable
        vector<int>a(n);
                     ^
                     (
main.cpp:10:8: error: subscripted value is not an array, pointer, or vector
        cin>>a[0];
             ~^~
main.cpp:14:22: error: use of undeclared identifier 'n'
        for (int i = 1; i < n -1; ++i) {
                            ^
main.cpp:15:9: error: subscripted value is not an array, pointer, or vector
                cin>>a[i];
                     ~^~
main.cpp:16:8: error: subscripted value is not an array, pointer, or vector
                if (a[i]] < a[i - 1]]) {
                    ~^~
1 warning and 5 errors generated.

                    
#11
Error de compilación
                      main.cpp:9:15: error: unknown type name 'n'
        vector<int>a(n);
                     ^
main.cpp:9:14: warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
        vector<int>a(n);
                    ^~~
main.cpp:9:15: note: add a pair of parentheses to declare a variable
        vector<int>a(n);
                     ^
                     (
main.cpp:10:8: error: subscripted value is not an array, pointer, or vector
        cin>>a[0];
             ~^~
main.cpp:14:22: error: use of undeclared identifier 'n'
        for (int i = 1; i < n -1; ++i) {
                            ^
main.cpp:15:9: error: subscripted value is not an array, pointer, or vector
                cin>>a[i];
                     ~^~
main.cpp:16:8: error: subscripted value is not an array, pointer, or vector
                if (a[i]] < a[i - 1]]) {
                    ~^~
1 warning and 5 errors generated.

                    
#12
Error de compilación
                      main.cpp:9:15: error: unknown type name 'n'
        vector<int>a(n);
                     ^
main.cpp:9:14: warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
        vector<int>a(n);
                    ^~~
main.cpp:9:15: note: add a pair of parentheses to declare a variable
        vector<int>a(n);
                     ^
                     (
main.cpp:10:8: error: subscripted value is not an array, pointer, or vector
        cin>>a[0];
             ~^~
main.cpp:14:22: error: use of undeclared identifier 'n'
        for (int i = 1; i < n -1; ++i) {
                            ^
main.cpp:15:9: error: subscripted value is not an array, pointer, or vector
                cin>>a[i];
                     ~^~
main.cpp:16:8: error: subscripted value is not an array, pointer, or vector
                if (a[i]] < a[i - 1]]) {
                    ~^~
1 warning and 5 errors generated.

                    
Puntos totales: 0 / 100

Código

#include <iostream>
#include <vector>
using namespace std;

int main(void) {
	int a;
	cin>>a;
	
	vector<int>a(n);
	cin>>a[0];
	
	bool sorted = true;
	
	for (int i = 1; i < n -1; ++i) {
		cin>>a[i];
		if (a[i]] < a[i - 1]]) {
			sorted = false;
			break;
		}
	}
	
	if (sorted) {
		cout<<"Ordernado\n";
	} else {
		cout<<"Desordenado\n";
	}
	return 0;
}