#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;
ll n, q;
ll p[100009];
ll pre[100009];
ll inf = 10000005LL;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
cin >> n >> q;
ll tot = 1;
for(ll i = 0; i < n; ++i){
cin >> p[i];
}
reverse(p, p+n);
for(ll i = 1; i < n; ++i){
p[i] *= p[i-1];
p[i] = min(p[i], inf);
}
while(q--){
ll x;
cin >> x;
ll l = 0, r = n;
while(l < r){
ll mid = (l+r)/2;
if(p[mid] > x)
r = mid;
else
l = mid+1;
}
if(l == n)
cout << "oo\n";
else
cout << l+2 << "\n";
}
}
Compilation message
brunhilda.cpp: In function 'int main()':
brunhilda.cpp:27:8: warning: unused variable 'tot' [-Wunused-variable]
27 | ll tot = 1;
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
14 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
16 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
17 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
18 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
512 KB |
Output isn't correct |
2 |
Incorrect |
12 ms |
1792 KB |
Output isn't correct |
3 |
Correct |
7 ms |
1408 KB |
Output is correct |
4 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
5 |
Correct |
6 ms |
1152 KB |
Output is correct |
6 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
512 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
9 |
Incorrect |
8 ms |
1408 KB |
Output isn't correct |
10 |
Correct |
8 ms |
1408 KB |
Output is correct |
11 |
Incorrect |
4 ms |
896 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
15 |
Incorrect |
7 ms |
920 KB |
Output isn't correct |
16 |
Incorrect |
10 ms |
1792 KB |
Output isn't correct |
17 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
18 |
Incorrect |
12 ms |
1792 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
14 ms |
1536 KB |
Output isn't correct |
2 |
Incorrect |
13 ms |
1280 KB |
Output isn't correct |
3 |
Incorrect |
16 ms |
1664 KB |
Output isn't correct |
4 |
Incorrect |
18 ms |
1264 KB |
Output isn't correct |
5 |
Correct |
35 ms |
2176 KB |
Output is correct |
6 |
Incorrect |
25 ms |
1408 KB |
Output isn't correct |
7 |
Incorrect |
22 ms |
2176 KB |
Output isn't correct |
8 |
Incorrect |
15 ms |
1408 KB |
Output isn't correct |
9 |
Incorrect |
13 ms |
1408 KB |
Output isn't correct |
10 |
Incorrect |
4 ms |
512 KB |
Output isn't correct |
11 |
Incorrect |
5 ms |
640 KB |
Output isn't correct |
12 |
Incorrect |
5 ms |
640 KB |
Output isn't correct |
13 |
Incorrect |
23 ms |
1640 KB |
Output isn't correct |
14 |
Incorrect |
19 ms |
1280 KB |
Output isn't correct |
15 |
Incorrect |
6 ms |
640 KB |
Output isn't correct |
16 |
Incorrect |
7 ms |
640 KB |
Output isn't correct |
17 |
Incorrect |
7 ms |
1152 KB |
Output isn't correct |
18 |
Incorrect |
11 ms |
1280 KB |
Output isn't correct |
19 |
Incorrect |
6 ms |
640 KB |
Output isn't correct |
20 |
Incorrect |
20 ms |
1536 KB |
Output isn't correct |
21 |
Incorrect |
19 ms |
1280 KB |
Output isn't correct |
22 |
Incorrect |
35 ms |
2168 KB |
Output isn't correct |
23 |
Incorrect |
23 ms |
1664 KB |
Output isn't correct |
24 |
Incorrect |
20 ms |
1408 KB |
Output isn't correct |
25 |
Incorrect |
20 ms |
1408 KB |
Output isn't correct |
26 |
Incorrect |
22 ms |
1272 KB |
Output isn't correct |
27 |
Incorrect |
22 ms |
2152 KB |
Output isn't correct |
28 |
Incorrect |
20 ms |
1280 KB |
Output isn't correct |
29 |
Incorrect |
36 ms |
2168 KB |
Output isn't correct |
30 |
Incorrect |
29 ms |
2040 KB |
Output isn't correct |
31 |
Incorrect |
18 ms |
1280 KB |
Output isn't correct |
32 |
Incorrect |
19 ms |
1280 KB |
Output isn't correct |
33 |
Incorrect |
18 ms |
1280 KB |
Output isn't correct |
34 |
Incorrect |
23 ms |
2168 KB |
Output isn't correct |
35 |
Incorrect |
24 ms |
1408 KB |
Output isn't correct |
36 |
Incorrect |
30 ms |
2168 KB |
Output isn't correct |
37 |
Correct |
33 ms |
2168 KB |
Output is correct |
38 |
Incorrect |
20 ms |
1440 KB |
Output isn't correct |
39 |
Incorrect |
23 ms |
1280 KB |
Output isn't correct |
40 |
Incorrect |
21 ms |
1400 KB |
Output isn't correct |
41 |
Incorrect |
33 ms |
2172 KB |
Output isn't correct |
42 |
Incorrect |
21 ms |
1408 KB |
Output isn't correct |