Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.005 s | 1 KBi |
#2 |
Incorrecto
|
0.005 s | 1 KBi |
#3 |
Incorrecto
|
0.005 s | 1 KBi |
#4 |
Incorrecto
|
0.005 s | 1 KBi |
#5 |
Incorrecto
|
0.004 s | 1 KBi |
#6 |
Incorrecto
|
0.008 s | 1 KBi |
#7 |
Incorrecto
|
0.032 s | 1 KBi |
#8 |
Incorrecto
|
0.031 s | 1 KBi |
#9 |
Incorrecto
|
0.043 s | 1 KBi |
#10 |
Incorrecto
|
0.037 s | 1 KBi |
#include <iostream> #include <vector> using namespace std; int main() { // read initial array int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } // Read queries int c; cin >> c; vector<int> q(c); for (int i = 0; i < c; i++) { cin >> q[i]; } // Count items, all counters start at 0 vector<int> r(c, 0); for (int i = 0; i < c; i++) { cout << "query: " << q[i] << endl; for (int j = 0; j < n; j++) { cout << " against: " << a[j] << endl; if (a[j] > q[i]) { r[i] = r[i] + 1; cout << " incrementing " << q[i] << " is now " << r[i] << endl; } } } for (int i = 0; i < c; i++) { cout << r[i] << endl; } return 0; }