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

Envío 3953

Problema 0x9d - ¿Está ordenado?

  • Autor: williamzborja
  • Fecha: 2021-04-24 22:38:14 UTC (Hace alrededor de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error en tiempo de ejecución (NZEC)
                      main.cpp:13:11: warning: if statement has empty body [-Wempty-body]
        if(n < 0);
                 ^
main.cpp:13:11: note: put the semicolon on a separate line to silence this warning
1 warning generated.

                    
Exited with error status 1
0.004 s 2 KBi
#2
Error en tiempo de ejecución (NZEC)
                      main.cpp:13:11: warning: if statement has empty body [-Wempty-body]
        if(n < 0);
                 ^
main.cpp:13:11: note: put the semicolon on a separate line to silence this warning
1 warning generated.

                    
Exited with error status 1
0.003 s 1 KBi
#3
Error en tiempo de ejecución (NZEC)
                      main.cpp:13:11: warning: if statement has empty body [-Wempty-body]
        if(n < 0);
                 ^
main.cpp:13:11: note: put the semicolon on a separate line to silence this warning
1 warning generated.

                    
Exited with error status 1
0.003 s 2 KBi
#4
Error en tiempo de ejecución (NZEC)
                      main.cpp:13:11: warning: if statement has empty body [-Wempty-body]
        if(n < 0);
                 ^
main.cpp:13:11: note: put the semicolon on a separate line to silence this warning
1 warning generated.

                    
Exited with error status 1
0.003 s 2 KBi
#5
Error en tiempo de ejecución (NZEC)
                      main.cpp:13:11: warning: if statement has empty body [-Wempty-body]
        if(n < 0);
                 ^
main.cpp:13:11: note: put the semicolon on a separate line to silence this warning
1 warning generated.

                    
Exited with error status 1
0.004 s 2 KBi
#6
Error en tiempo de ejecución (NZEC)
                      main.cpp:13:11: warning: if statement has empty body [-Wempty-body]
        if(n < 0);
                 ^
main.cpp:13:11: note: put the semicolon on a separate line to silence this warning
1 warning generated.

                    
Exited with error status 1
0.004 s 1 KBi
#7
Error en tiempo de ejecución (NZEC)
                      main.cpp:13:11: warning: if statement has empty body [-Wempty-body]
        if(n < 0);
                 ^
main.cpp:13:11: note: put the semicolon on a separate line to silence this warning
1 warning generated.

                    
Exited with error status 1
0.004 s 2 KBi
#8
Error en tiempo de ejecución (NZEC)
                      main.cpp:13:11: warning: if statement has empty body [-Wempty-body]
        if(n < 0);
                 ^
main.cpp:13:11: note: put the semicolon on a separate line to silence this warning
1 warning generated.

                    
Exited with error status 1
0.003 s 2 KBi
#9
Error en tiempo de ejecución (NZEC)
                      main.cpp:13:11: warning: if statement has empty body [-Wempty-body]
        if(n < 0);
                 ^
main.cpp:13:11: note: put the semicolon on a separate line to silence this warning
1 warning generated.

                    
Exited with error status 1
0.002 s 1 KBi
#10
Error en tiempo de ejecución (NZEC)
                      main.cpp:13:11: warning: if statement has empty body [-Wempty-body]
        if(n < 0);
                 ^
main.cpp:13:11: note: put the semicolon on a separate line to silence this warning
1 warning generated.

                    
Exited with error status 1
0.005 s 2 KBi
#11
Error en tiempo de ejecución (NZEC)
                      main.cpp:13:11: warning: if statement has empty body [-Wempty-body]
        if(n < 0);
                 ^
main.cpp:13:11: note: put the semicolon on a separate line to silence this warning
1 warning generated.

                    
Exited with error status 1
0.005 s 1 KBi
#12
Error en tiempo de ejecución (NZEC)
                      main.cpp:13:11: warning: if statement has empty body [-Wempty-body]
        if(n < 0);
                 ^
main.cpp:13:11: note: put the semicolon on a separate line to silence this warning
1 warning generated.

                    
Exited with error status 1
0.004 s 2 KBi
Puntos totales: 0 / 100

Código

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

int main(void)
{
	int previous, current, n;
	size_t i;
	bool sorted = true;

	cin >> n;

	if(n < 0);
	{
		cout << "Desordenado" << endl;
		return (1);
	}

	cin >> previous;
	for (i = 0; i + 1 < n; ++i)
	{
		cin >> current;
		if (previous > current)
		{
			sorted = false;
			break;
		}
	}
	if (sorted)
		cout << "Ordenado" << endl;
	else
		cout << "Desordenado" << endl;
	return 0;
}