Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.006 s | 1 KBi |
#2 |
Correcto
|
0.003 s | 0 KBi |
#3 |
Correcto
|
0.002 s | 0 KBi |
#4 |
Correcto
|
0.002 s | 0 KBi |
#5 |
Correcto
|
0.002 s | 0 KBi |
#6 |
Correcto
|
0.002 s | 0 KBi |
#7 |
Correcto
|
0.002 s | 0 KBi |
#8 |
Correcto
|
0.002 s | 0 KBi |
#9 |
Correcto
|
0.004 s | 0 KBi |
#10 |
Correcto
|
0.001 s | 0 KBi |
// Iterate over an array and tell how many numbers are greater than x #include <bits/stdc++.h> using namespace std; int main(){ int n, c; cin >> n; int arr[n]; for (int i = 0; i < n; i++) cin >> arr[i]; cin >> c; int queries[c]; for (int i = 0; i < c; i++) cin >> queries[i]; for (int query : queries){ int counter = 0; for (int j: arr){ if (j > query) counter += 1; } cout << counter << endl; } return 0; }