Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.005 s | 0 KBi |
#2 |
Incorrecto
|
0.004 s | 0 KBi |
#3 |
Correcto
|
0.005 s | 1 KBi |
#4 |
Correcto
|
0.005 s | 0 KBi |
#5 |
Correcto
|
0.004 s | 0 KBi |
#6 |
Incorrecto
|
0.005 s | 1 KBi |
#7 |
Incorrecto
|
0.007 s | 1 KBi |
#8 |
Correcto
|
0.004 s | 0 KBi |
#9 |
Incorrecto
|
0.003 s | 0 KBi |
#10 |
Incorrecto
|
0.005 s | 0 KBi |
#11 |
Incorrecto
|
0.003 s | 0 KBi |
#12 |
Tiempo límite excedido
|
1.052 s | 1 KBi |
#13 |
Tiempo límite excedido
|
1.039 s | 1 KBi |
#14 |
Incorrecto
|
0.191 s | 1 KBi |
#15 |
Tiempo límite excedido
|
1.075 s | 1 KBi |
#16 |
Correcto
|
0.14 s | 1 KBi |
#17 |
Correcto
|
0.198 s | 1 KBi |
#include <iostream> #include <bits/stdc++.h> using namespace std; int Search(int arr[], int num, int n){ int ind=0; int aux; if(arr[n-2] >= num){ aux=n-2; }else{ aux=0; } for(int j=aux; j<n; j++){ if(num < arr[j]){ return ind; } ind++; } return n; } int main() { int n, x; cin >> n; int arr[n]; for (int i=0; i<n; i++){ cin >> arr[i]; } cin >> x; for(int i=0; i<x; i++){ int num; cin >> num; cout << Search(arr, num, n) << endl; } }