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

Envío 5474

Problema 0x62 - Contar elementos mayores a X en un arreglo pequeño

  • Autor: nivalderramas
  • Fecha: 2021-12-22 12:57:01 UTC (Hace más de 2 años)
Caso # Resultado Tiempo Memoria
#1
Incorrecto
0.006 s 1 KBi
#2
Incorrecto
0.004 s 0 KBi
#3
Incorrecto
0.004 s 1 KBi
#4
Incorrecto
0.004 s 0 KBi
#5
Esperando resultado...
#6
Esperando resultado...
#7
Incorrecto
0.003 s 0 KBi
#8
Error en tiempo de ejecución (NZEC)
Exited with error status 139
run: line 1:     3 Segmentation fault      (core dumped) ./a.out
0.006 s 1 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 139
run: line 1:     3 Segmentation fault      (core dumped) ./a.out
0.004 s 0 KBi
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 139
run: line 1:     3 Segmentation fault      (core dumped) ./a.out
0.005 s 0 KBi
Puntos totales: 0 / 100

Código

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<n;i++)
#define pb push_back
#define ff first
#define ss second
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define lli long long int
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
ostream& operator<<(ostream& os, const vector<int> &v){
    for(auto const &i: v){
        os<<i<<" ";
    }
    os<<endl;
    return os;
}
const lli mod=(1e9)+7;
const int N = 1e4+1;
int main(){
    fast_io;
    int n;
    int nums[n];
    cin>>n;
    REP(i,n)cin>>nums[i];
    int c;cin>>c;
    while(c--){
        int x;cin>>x;
        int ans = 0;
        REP(i,n){
            if(nums[i]>x)ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}