#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define el '\n'
#define ld long double
const int maxn=1e5+1;
int a[maxn],n,m,q,p,oo,ans;
ll t;
bool ok;
void check(){
t=1;
ok=0;
for(int i=0;i<m;++i){
if(t*a[i]<t || t*a[i]>oo){
ok=1;
return;
}
t=t*a[i];
}
}
void sol(){
ans=(n/a[m-1])*2;
if(n%a[m-1]!=0) ans++;
cout << ans;
}
int main(){
//freopen("T.INP","r",stdin);
//freopen("T.OUT","w",stdout);
ios_base::sync_with_stdio(0);cin.tie(0);
cin >> m >> q;
for(int i=0;i<m;++i) cin >> a[i];
sort(a,a+m);
oo=1e7;
check();
while(q--){
cin >> n;
if(ok){
sol();
} else {
if(n>=t){
cout << 'o' << 'o';
} else {
sol();
}
}
cout << el;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
216 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
4 |
Incorrect |
3 ms |
332 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
14 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
16 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
17 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
18 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
2 |
Correct |
10 ms |
568 KB |
Output is correct |
3 |
Correct |
6 ms |
588 KB |
Output is correct |
4 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
5 |
Correct |
5 ms |
460 KB |
Output is correct |
6 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
9 |
Incorrect |
9 ms |
588 KB |
Output isn't correct |
10 |
Correct |
7 ms |
588 KB |
Output is correct |
11 |
Incorrect |
4 ms |
460 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
15 |
Incorrect |
4 ms |
468 KB |
Output isn't correct |
16 |
Correct |
9 ms |
676 KB |
Output is correct |
17 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
18 |
Incorrect |
12 ms |
704 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
14 ms |
876 KB |
Output isn't correct |
2 |
Incorrect |
10 ms |
596 KB |
Output isn't correct |
3 |
Incorrect |
14 ms |
956 KB |
Output isn't correct |
4 |
Incorrect |
16 ms |
1228 KB |
Output isn't correct |
5 |
Incorrect |
31 ms |
1348 KB |
Output isn't correct |
6 |
Incorrect |
20 ms |
1240 KB |
Output isn't correct |
7 |
Incorrect |
20 ms |
1032 KB |
Output isn't correct |
8 |
Incorrect |
19 ms |
872 KB |
Output isn't correct |
9 |
Incorrect |
16 ms |
852 KB |
Output isn't correct |
10 |
Incorrect |
4 ms |
332 KB |
Output isn't correct |
11 |
Incorrect |
6 ms |
460 KB |
Output isn't correct |
12 |
Incorrect |
5 ms |
596 KB |
Output isn't correct |
13 |
Incorrect |
20 ms |
1228 KB |
Output isn't correct |
14 |
Incorrect |
19 ms |
1484 KB |
Output isn't correct |
15 |
Incorrect |
5 ms |
460 KB |
Output isn't correct |
16 |
Incorrect |
4 ms |
460 KB |
Output isn't correct |
17 |
Incorrect |
6 ms |
572 KB |
Output isn't correct |
18 |
Incorrect |
8 ms |
588 KB |
Output isn't correct |
19 |
Incorrect |
5 ms |
460 KB |
Output isn't correct |
20 |
Incorrect |
15 ms |
1000 KB |
Output isn't correct |
21 |
Incorrect |
25 ms |
1624 KB |
Output isn't correct |
22 |
Incorrect |
40 ms |
1504 KB |
Output isn't correct |
23 |
Incorrect |
27 ms |
1228 KB |
Output isn't correct |
24 |
Incorrect |
17 ms |
1292 KB |
Output isn't correct |
25 |
Incorrect |
18 ms |
1228 KB |
Output isn't correct |
26 |
Incorrect |
16 ms |
1100 KB |
Output isn't correct |
27 |
Incorrect |
20 ms |
1064 KB |
Output isn't correct |
28 |
Incorrect |
18 ms |
1356 KB |
Output isn't correct |
29 |
Incorrect |
28 ms |
1528 KB |
Output isn't correct |
30 |
Incorrect |
25 ms |
1476 KB |
Output isn't correct |
31 |
Incorrect |
22 ms |
1144 KB |
Output isn't correct |
32 |
Incorrect |
17 ms |
1228 KB |
Output isn't correct |
33 |
Incorrect |
16 ms |
1160 KB |
Output isn't correct |
34 |
Incorrect |
21 ms |
956 KB |
Output isn't correct |
35 |
Incorrect |
25 ms |
1360 KB |
Output isn't correct |
36 |
Incorrect |
26 ms |
1388 KB |
Output isn't correct |
37 |
Incorrect |
27 ms |
1404 KB |
Output isn't correct |
38 |
Incorrect |
18 ms |
1188 KB |
Output isn't correct |
39 |
Incorrect |
18 ms |
1228 KB |
Output isn't correct |
40 |
Incorrect |
17 ms |
1064 KB |
Output isn't correct |
41 |
Correct |
20 ms |
960 KB |
Output is correct |
42 |
Incorrect |
20 ms |
1404 KB |
Output isn't correct |