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

Envío 5329

Problema 0x9d - ¿Está ordenado?

  • Autor: tille
  • Fecha: 2021-11-09 00:15:56 UTC (Hace alrededor de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.cpp:7:27: error: void function 'solve' should not return a value [-Wreturn-type]
   if (arr[i] > arr[i+1]) return false;
                          ^      ~~~~~
main.cpp:8:2: error: void function 'solve' should not return a value [-Wreturn-type]
 return true;
 ^      ~~~~
main.cpp:16:10: error: value of type 'void' is not contextually convertible to 'bool'
cout << (solve(arr) ? "Ordenado" : "Desordenado") << endl;
         ^~~~~~~~~~
3 errors generated.

                    
#2
Error de compilación
                      main.cpp:7:27: error: void function 'solve' should not return a value [-Wreturn-type]
   if (arr[i] > arr[i+1]) return false;
                          ^      ~~~~~
main.cpp:8:2: error: void function 'solve' should not return a value [-Wreturn-type]
 return true;
 ^      ~~~~
main.cpp:16:10: error: value of type 'void' is not contextually convertible to 'bool'
cout << (solve(arr) ? "Ordenado" : "Desordenado") << endl;
         ^~~~~~~~~~
3 errors generated.

                    
#3
Error de compilación
                      main.cpp:7:27: error: void function 'solve' should not return a value [-Wreturn-type]
   if (arr[i] > arr[i+1]) return false;
                          ^      ~~~~~
main.cpp:8:2: error: void function 'solve' should not return a value [-Wreturn-type]
 return true;
 ^      ~~~~
main.cpp:16:10: error: value of type 'void' is not contextually convertible to 'bool'
cout << (solve(arr) ? "Ordenado" : "Desordenado") << endl;
         ^~~~~~~~~~
3 errors generated.

                    
#4
Error de compilación
                      main.cpp:7:27: error: void function 'solve' should not return a value [-Wreturn-type]
   if (arr[i] > arr[i+1]) return false;
                          ^      ~~~~~
main.cpp:8:2: error: void function 'solve' should not return a value [-Wreturn-type]
 return true;
 ^      ~~~~
main.cpp:16:10: error: value of type 'void' is not contextually convertible to 'bool'
cout << (solve(arr) ? "Ordenado" : "Desordenado") << endl;
         ^~~~~~~~~~
3 errors generated.

                    
#5
Error de compilación
                      main.cpp:7:27: error: void function 'solve' should not return a value [-Wreturn-type]
   if (arr[i] > arr[i+1]) return false;
                          ^      ~~~~~
main.cpp:8:2: error: void function 'solve' should not return a value [-Wreturn-type]
 return true;
 ^      ~~~~
main.cpp:16:10: error: value of type 'void' is not contextually convertible to 'bool'
cout << (solve(arr) ? "Ordenado" : "Desordenado") << endl;
         ^~~~~~~~~~
3 errors generated.

                    
#6
Error de compilación
                      main.cpp:7:27: error: void function 'solve' should not return a value [-Wreturn-type]
   if (arr[i] > arr[i+1]) return false;
                          ^      ~~~~~
main.cpp:8:2: error: void function 'solve' should not return a value [-Wreturn-type]
 return true;
 ^      ~~~~
main.cpp:16:10: error: value of type 'void' is not contextually convertible to 'bool'
cout << (solve(arr) ? "Ordenado" : "Desordenado") << endl;
         ^~~~~~~~~~
3 errors generated.

                    
#7
Error de compilación
                      main.cpp:7:27: error: void function 'solve' should not return a value [-Wreturn-type]
   if (arr[i] > arr[i+1]) return false;
                          ^      ~~~~~
main.cpp:8:2: error: void function 'solve' should not return a value [-Wreturn-type]
 return true;
 ^      ~~~~
main.cpp:16:10: error: value of type 'void' is not contextually convertible to 'bool'
cout << (solve(arr) ? "Ordenado" : "Desordenado") << endl;
         ^~~~~~~~~~
3 errors generated.

                    
#8
Error de compilación
                      main.cpp:7:27: error: void function 'solve' should not return a value [-Wreturn-type]
   if (arr[i] > arr[i+1]) return false;
                          ^      ~~~~~
main.cpp:8:2: error: void function 'solve' should not return a value [-Wreturn-type]
 return true;
 ^      ~~~~
main.cpp:16:10: error: value of type 'void' is not contextually convertible to 'bool'
cout << (solve(arr) ? "Ordenado" : "Desordenado") << endl;
         ^~~~~~~~~~
3 errors generated.

                    
#9
Error de compilación
                      main.cpp:7:27: error: void function 'solve' should not return a value [-Wreturn-type]
   if (arr[i] > arr[i+1]) return false;
                          ^      ~~~~~
main.cpp:8:2: error: void function 'solve' should not return a value [-Wreturn-type]
 return true;
 ^      ~~~~
main.cpp:16:10: error: value of type 'void' is not contextually convertible to 'bool'
cout << (solve(arr) ? "Ordenado" : "Desordenado") << endl;
         ^~~~~~~~~~
3 errors generated.

                    
#10
Error de compilación
                      main.cpp:7:27: error: void function 'solve' should not return a value [-Wreturn-type]
   if (arr[i] > arr[i+1]) return false;
                          ^      ~~~~~
main.cpp:8:2: error: void function 'solve' should not return a value [-Wreturn-type]
 return true;
 ^      ~~~~
main.cpp:16:10: error: value of type 'void' is not contextually convertible to 'bool'
cout << (solve(arr) ? "Ordenado" : "Desordenado") << endl;
         ^~~~~~~~~~
3 errors generated.

                    
#11
Error de compilación
                      main.cpp:7:27: error: void function 'solve' should not return a value [-Wreturn-type]
   if (arr[i] > arr[i+1]) return false;
                          ^      ~~~~~
main.cpp:8:2: error: void function 'solve' should not return a value [-Wreturn-type]
 return true;
 ^      ~~~~
main.cpp:16:10: error: value of type 'void' is not contextually convertible to 'bool'
cout << (solve(arr) ? "Ordenado" : "Desordenado") << endl;
         ^~~~~~~~~~
3 errors generated.

                    
#12
Error de compilación
                      main.cpp:7:27: error: void function 'solve' should not return a value [-Wreturn-type]
   if (arr[i] > arr[i+1]) return false;
                          ^      ~~~~~
main.cpp:8:2: error: void function 'solve' should not return a value [-Wreturn-type]
 return true;
 ^      ~~~~
main.cpp:16:10: error: value of type 'void' is not contextually convertible to 'bool'
cout << (solve(arr) ? "Ordenado" : "Desordenado") << endl;
         ^~~~~~~~~~
3 errors generated.

                    
Puntos totales: 0 / 100

Código

#include <bits/stdc++.h>

using namespace std;

void solve(vector<int> &arr) {
 for (int i = 0; i < arr.size()-1; ++i)
   if (arr[i] > arr[i+1]) return false;
 return true;
}

int main() {
int n; cin >> n;
vector<int> arr(n);
for (auto &num : arr) cin >> num;

cout << (solve(arr) ? "Ordenado" : "Desordenado") << endl;
return 0;
}