Submission #923235

# Submission time Handle Problem Language Result Execution time Memory
923235 2024-02-07T02:38:13 Z ttamx Brunhilda’s Birthday (BOI13_brunhilda) C++14
100 / 100
258 ms 79724 KB
#include<bits/stdc++.h>

using namespace std;

const int N=1e7+5;

int m,q;
int mx;
int p[N],dp[N];

int main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    cin >> m >> q;
    for(int i=0;i<m;i++){
        int x;
        cin >> x;
        for(int i=0;i<N;i+=x)p[i]=max(p[i],x);
    }
    for(int l=0,r=0,cnt=0;l<N&&l<=r;l=r+1,r=min(mx,N),cnt++){
        for(int i=l;i<=r;i++){
            dp[i]=cnt;
            mx=max(mx,i+p[i]-1);
        }
    }
    while(q--){
        int n;
        cin >> n;
        if(n>mx)cout << "oo\n";
        else cout << dp[n] << "\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 24 ms 39516 KB Output is correct
2 Correct 55 ms 78500 KB Output is correct
3 Correct 38 ms 41808 KB Output is correct
4 Correct 39 ms 78676 KB Output is correct
5 Correct 47 ms 78676 KB Output is correct
6 Correct 23 ms 39516 KB Output is correct
7 Correct 33 ms 41820 KB Output is correct
8 Correct 38 ms 43688 KB Output is correct
9 Correct 62 ms 78492 KB Output is correct
10 Correct 83 ms 78512 KB Output is correct
11 Correct 69 ms 78676 KB Output is correct
12 Correct 38 ms 78492 KB Output is correct
13 Correct 141 ms 78492 KB Output is correct
14 Correct 139 ms 78496 KB Output is correct
15 Correct 66 ms 78672 KB Output is correct
16 Correct 58 ms 78672 KB Output is correct
17 Correct 57 ms 78672 KB Output is correct
18 Correct 48 ms 78676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 78760 KB Output is correct
2 Correct 66 ms 78636 KB Output is correct
3 Correct 193 ms 78676 KB Output is correct
4 Correct 83 ms 78668 KB Output is correct
5 Correct 137 ms 78496 KB Output is correct
6 Correct 56 ms 78688 KB Output is correct
7 Correct 53 ms 78676 KB Output is correct
8 Correct 71 ms 78672 KB Output is correct
9 Correct 160 ms 78492 KB Output is correct
10 Correct 197 ms 78676 KB Output is correct
11 Correct 188 ms 78512 KB Output is correct
12 Correct 93 ms 78496 KB Output is correct
13 Correct 44 ms 78704 KB Output is correct
14 Correct 70 ms 78496 KB Output is correct
15 Correct 174 ms 78676 KB Output is correct
16 Correct 70 ms 78512 KB Output is correct
17 Correct 156 ms 78492 KB Output is correct
18 Correct 163 ms 78496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 160 ms 78932 KB Output is correct
2 Correct 209 ms 78748 KB Output is correct
3 Correct 212 ms 79024 KB Output is correct
4 Correct 119 ms 78752 KB Output is correct
5 Correct 94 ms 79440 KB Output is correct
6 Correct 155 ms 79440 KB Output is correct
7 Correct 144 ms 79012 KB Output is correct
8 Correct 166 ms 78768 KB Output is correct
9 Correct 158 ms 78932 KB Output is correct
10 Correct 119 ms 78768 KB Output is correct
11 Correct 105 ms 78676 KB Output is correct
12 Correct 133 ms 78756 KB Output is correct
13 Correct 179 ms 79520 KB Output is correct
14 Correct 103 ms 79264 KB Output is correct
15 Correct 139 ms 78752 KB Output is correct
16 Correct 165 ms 78752 KB Output is correct
17 Correct 155 ms 78504 KB Output is correct
18 Correct 218 ms 78752 KB Output is correct
19 Correct 53 ms 78672 KB Output is correct
20 Correct 199 ms 79008 KB Output is correct
21 Correct 109 ms 79272 KB Output is correct
22 Correct 218 ms 79524 KB Output is correct
23 Correct 91 ms 79532 KB Output is correct
24 Correct 73 ms 79536 KB Output is correct
25 Correct 138 ms 79532 KB Output is correct
26 Correct 122 ms 78756 KB Output is correct
27 Correct 239 ms 78976 KB Output is correct
28 Correct 69 ms 79640 KB Output is correct
29 Correct 258 ms 79516 KB Output is correct
30 Correct 182 ms 79520 KB Output is correct
31 Correct 87 ms 79444 KB Output is correct
32 Correct 95 ms 79444 KB Output is correct
33 Correct 77 ms 79608 KB Output is correct
34 Correct 155 ms 79012 KB Output is correct
35 Correct 73 ms 79520 KB Output is correct
36 Correct 253 ms 79228 KB Output is correct
37 Correct 89 ms 79440 KB Output is correct
38 Correct 155 ms 79324 KB Output is correct
39 Correct 83 ms 79500 KB Output is correct
40 Correct 151 ms 79444 KB Output is correct
41 Correct 128 ms 79028 KB Output is correct
42 Correct 180 ms 79724 KB Output is correct