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

Envío 2042

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

  • Autor: S8Vega
  • Fecha: 2020-11-20 03:44:20 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Correcto
                      main.cpp:29:9: warning: 'dbg' macro redefined [-Wmacro-redefined]
#define dbg(...) 18
        ^
main.cpp:10:9: note: previous definition is here
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
        ^
1 warning generated.

                    
0.006 s 1 KBi
#2
Correcto
                      main.cpp:29:9: warning: 'dbg' macro redefined [-Wmacro-redefined]
#define dbg(...) 18
        ^
main.cpp:10:9: note: previous definition is here
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
        ^
1 warning generated.

                    
0.006 s 1 KBi
#3
Correcto
                      main.cpp:29:9: warning: 'dbg' macro redefined [-Wmacro-redefined]
#define dbg(...) 18
        ^
main.cpp:10:9: note: previous definition is here
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
        ^
1 warning generated.

                    
0.006 s 1 KBi
#4
Correcto
                      main.cpp:29:9: warning: 'dbg' macro redefined [-Wmacro-redefined]
#define dbg(...) 18
        ^
main.cpp:10:9: note: previous definition is here
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
        ^
1 warning generated.

                    
0.006 s 1 KBi
#5
Correcto
                      main.cpp:29:9: warning: 'dbg' macro redefined [-Wmacro-redefined]
#define dbg(...) 18
        ^
main.cpp:10:9: note: previous definition is here
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
        ^
1 warning generated.

                    
0.006 s 1 KBi
#6
Correcto
                      main.cpp:29:9: warning: 'dbg' macro redefined [-Wmacro-redefined]
#define dbg(...) 18
        ^
main.cpp:10:9: note: previous definition is here
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
        ^
1 warning generated.

                    
0.005 s 1 KBi
#7
Correcto
                      main.cpp:29:9: warning: 'dbg' macro redefined [-Wmacro-redefined]
#define dbg(...) 18
        ^
main.cpp:10:9: note: previous definition is here
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
        ^
1 warning generated.

                    
0.006 s 1 KBi
#8
Correcto
                      main.cpp:29:9: warning: 'dbg' macro redefined [-Wmacro-redefined]
#define dbg(...) 18
        ^
main.cpp:10:9: note: previous definition is here
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
        ^
1 warning generated.

                    
0.006 s 1 KBi
#9
Correcto
                      main.cpp:29:9: warning: 'dbg' macro redefined [-Wmacro-redefined]
#define dbg(...) 18
        ^
main.cpp:10:9: note: previous definition is here
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
        ^
1 warning generated.

                    
0.005 s 1 KBi
#10
Correcto
                      main.cpp:29:9: warning: 'dbg' macro redefined [-Wmacro-redefined]
#define dbg(...) 18
        ^
main.cpp:10:9: note: previous definition is here
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
        ^
1 warning generated.

                    
0.005 s 1 KBi
Puntos totales: 100 / 100

Código

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define forn(i, a, b) for (int i = a; i < b; ++i)
#define SZ(x) int(x.size())
#define pb push_back
#define F first
#define S second
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}

const int N = 110;
int n, q, a[N];

int main() {
#ifdef LOCAL
  freopen("a.txt", "r", stdin);
// freopen("main.txt", "w", stdout);
#else
  ios::sync_with_stdio(0);
  cin.tie(0);
#define endl '\n'
#define dbg(...) 18
#endif
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  cin >> q;
  int qq, id;
  while (q--) {
    cin >> qq;
    id = lower_bound(a, a + n, qq + 1) - a;
    cout << n - id << endl;
  }
  return 0;
}