Submission #493698

# Submission time Handle Problem Language Result Execution time Memory
493698 2021-12-12T15:31:28 Z _Monkey_ Brunhilda’s Birthday (BOI13_brunhilda) C++17
13.6508 / 100
37 ms 1348 KB
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define el '\n'
#define ld long double
const int maxn=1e5+1;

ll a[maxn],n,m,q,p,oo,ans,k;
ll t;
bool ok;
void check(){
    t=1;
    ok=0;
    for(int i=0;i<m;++i){
        k=t*a[i];
        if(t*a[i]<t || t*a[i]>oo || k/a[i]!=t){
            ok=1;
            return;
        }
        t=t*a[i];
    }
}
void sol(){
    ans=n/a[m-1];
    ans*=2;
    if(n%a[m-1]!=0 && (m>=2 && (n-n%a[m-1]<=(n-n%a[m-2])))) ans++;
    cout << ans;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin >> m >> q;
    for(int i=0;i<m;++i) cin >> a[i];
    sort(a+0,a+m);
    oo=1e8;
    check();
    while(q--){
        cin >> n;
        if(ok){
            sol();
        } else {
            if(n>=t){
                cout << "oo";
            } else {
                sol();
            }
        }
        cout << el;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Incorrect 2 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 1 ms 204 KB Output isn't correct
8 Incorrect 0 ms 204 KB Output isn't correct
9 Correct 1 ms 204 KB Output is correct
10 Incorrect 1 ms 204 KB Output isn't correct
11 Incorrect 1 ms 204 KB Output isn't correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 2 ms 348 KB Output is 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
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Correct 9 ms 972 KB Output is correct
3 Correct 6 ms 844 KB Output is correct
4 Incorrect 1 ms 332 KB Output isn't correct
5 Correct 5 ms 716 KB Output is correct
6 Incorrect 1 ms 332 KB Output isn't correct
7 Incorrect 2 ms 332 KB Output isn't correct
8 Incorrect 1 ms 332 KB Output isn't correct
9 Correct 8 ms 844 KB Output is correct
10 Correct 8 ms 844 KB Output is correct
11 Incorrect 5 ms 588 KB Output isn't correct
12 Incorrect 1 ms 332 KB Output isn't correct
13 Incorrect 1 ms 332 KB Output isn't correct
14 Incorrect 1 ms 332 KB Output isn't correct
15 Incorrect 5 ms 588 KB Output isn't correct
16 Correct 9 ms 972 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Incorrect 12 ms 1056 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 716 KB Output isn't correct
2 Incorrect 9 ms 716 KB Output isn't correct
3 Incorrect 19 ms 844 KB Output isn't correct
4 Incorrect 16 ms 564 KB Output isn't correct
5 Incorrect 29 ms 1256 KB Output isn't correct
6 Incorrect 18 ms 588 KB Output isn't correct
7 Incorrect 19 ms 1100 KB Output isn't correct
8 Incorrect 11 ms 716 KB Output isn't correct
9 Incorrect 13 ms 716 KB Output isn't correct
10 Incorrect 3 ms 332 KB Output isn't correct
11 Incorrect 4 ms 332 KB Output isn't correct
12 Incorrect 5 ms 332 KB Output isn't correct
13 Incorrect 18 ms 768 KB Output isn't correct
14 Incorrect 15 ms 844 KB Output isn't correct
15 Incorrect 5 ms 460 KB Output isn't correct
16 Incorrect 4 ms 456 KB Output isn't correct
17 Incorrect 7 ms 716 KB Output isn't correct
18 Incorrect 10 ms 716 KB Output isn't correct
19 Incorrect 4 ms 332 KB Output isn't correct
20 Incorrect 14 ms 856 KB Output isn't correct
21 Incorrect 17 ms 908 KB Output isn't correct
22 Incorrect 28 ms 1300 KB Output isn't correct
23 Incorrect 22 ms 844 KB Output isn't correct
24 Incorrect 20 ms 632 KB Output isn't correct
25 Incorrect 24 ms 672 KB Output isn't correct
26 Incorrect 17 ms 560 KB Output isn't correct
27 Incorrect 19 ms 1100 KB Output isn't correct
28 Incorrect 18 ms 652 KB Output isn't correct
29 Incorrect 28 ms 1348 KB Output isn't correct
30 Incorrect 24 ms 1100 KB Output isn't correct
31 Incorrect 15 ms 588 KB Output isn't correct
32 Incorrect 18 ms 604 KB Output isn't correct
33 Incorrect 15 ms 476 KB Output isn't correct
34 Incorrect 19 ms 1100 KB Output isn't correct
35 Incorrect 17 ms 716 KB Output isn't correct
36 Incorrect 37 ms 1208 KB Output isn't correct
37 Incorrect 26 ms 1268 KB Output isn't correct
38 Incorrect 17 ms 688 KB Output isn't correct
39 Incorrect 19 ms 584 KB Output isn't correct
40 Incorrect 18 ms 656 KB Output isn't correct
41 Correct 21 ms 1092 KB Output is correct
42 Incorrect 17 ms 716 KB Output isn't correct