Submission #331142

# Submission time Handle Problem Language Result Execution time Memory
331142 2020-11-27T14:09:09 Z Sho10 Brunhilda’s Birthday (BOI13_brunhilda) C++14
0 / 100
558 ms 81024 KB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long
#define double long double
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000007
#define PI 3.14159265359
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005ll
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int n,m,ans[20000005],a[20000005];
int32_t main(){
CODE_START
n=2e7;
cin>>m;
int q;
cin>>q;
for(int i=1;i<=m;i++)
{
    int x;
    cin>>x;
    for(int j=x;j<=n;j+=x){
        a[j-1]=max(a[j-1],x-1);
    }
}
for(int i=n;i>=1;i--)
{
    a[i]=max(a[i],a[i+1]-1);
}
for(int i=1;i<=m;i++)
{
    if(a[i]&&(ans[i-a[i]]||i-a[i]==0)){
        ans[i]=ans[i-a[i]]+1;
    }
}
while(q--){
    int x;
    cin>>x;
    if(ans[x]){
        cout<<ans[x]<<endl;
    }else cout<<"oo"<<endl;
}
}

# Verdict Execution time Memory Grader output
1 Incorrect 100 ms 78572 KB Output isn't correct
2 Incorrect 152 ms 78716 KB Output isn't correct
3 Incorrect 123 ms 78572 KB Output isn't correct
4 Incorrect 99 ms 78700 KB Output isn't correct
5 Incorrect 127 ms 78700 KB Output isn't correct
6 Incorrect 98 ms 78572 KB Output isn't correct
7 Incorrect 120 ms 78572 KB Output isn't correct
8 Incorrect 129 ms 78572 KB Output isn't correct
9 Incorrect 162 ms 78572 KB Output isn't correct
10 Incorrect 209 ms 78572 KB Output isn't correct
11 Incorrect 186 ms 78700 KB Output isn't correct
12 Incorrect 98 ms 78572 KB Output isn't correct
13 Incorrect 391 ms 78700 KB Output isn't correct
14 Incorrect 383 ms 78700 KB Output isn't correct
15 Incorrect 171 ms 78572 KB Output isn't correct
16 Incorrect 152 ms 78940 KB Output isn't correct
17 Incorrect 154 ms 78700 KB Output isn't correct
18 Incorrect 100 ms 78700 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 138 ms 78828 KB Output isn't correct
2 Incorrect 154 ms 79724 KB Output isn't correct
3 Incorrect 505 ms 79468 KB Output isn't correct
4 Incorrect 173 ms 78888 KB Output isn't correct
5 Incorrect 314 ms 79212 KB Output isn't correct
6 Incorrect 145 ms 78700 KB Output isn't correct
7 Incorrect 139 ms 78700 KB Output isn't correct
8 Incorrect 173 ms 78700 KB Output isn't correct
9 Incorrect 387 ms 79340 KB Output isn't correct
10 Incorrect 492 ms 79340 KB Output isn't correct
11 Incorrect 488 ms 79084 KB Output isn't correct
12 Incorrect 244 ms 78696 KB Output isn't correct
13 Incorrect 112 ms 78700 KB Output isn't correct
14 Incorrect 176 ms 78828 KB Output isn't correct
15 Incorrect 382 ms 79084 KB Output isn't correct
16 Incorrect 162 ms 79724 KB Output isn't correct
17 Incorrect 402 ms 78700 KB Output isn't correct
18 Incorrect 378 ms 79724 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 388 ms 79724 KB Output isn't correct
2 Incorrect 511 ms 79596 KB Output isn't correct
3 Incorrect 512 ms 79944 KB Output isn't correct
4 Incorrect 282 ms 79980 KB Output isn't correct
5 Incorrect 186 ms 80876 KB Output isn't correct
6 Incorrect 404 ms 79852 KB Output isn't correct
7 Incorrect 339 ms 80364 KB Output isn't correct
8 Incorrect 380 ms 79596 KB Output isn't correct
9 Incorrect 377 ms 79596 KB Output isn't correct
10 Incorrect 304 ms 78924 KB Output isn't correct
11 Incorrect 251 ms 78956 KB Output isn't correct
12 Incorrect 363 ms 79216 KB Output isn't correct
13 Incorrect 480 ms 79980 KB Output isn't correct
14 Incorrect 245 ms 79852 KB Output isn't correct
15 Incorrect 388 ms 79008 KB Output isn't correct
16 Incorrect 447 ms 78956 KB Output isn't correct
17 Incorrect 389 ms 79340 KB Output isn't correct
18 Incorrect 505 ms 79468 KB Output isn't correct
19 Incorrect 131 ms 78956 KB Output isn't correct
20 Incorrect 516 ms 79724 KB Output isn't correct
21 Incorrect 292 ms 79724 KB Output isn't correct
22 Incorrect 514 ms 80876 KB Output isn't correct
23 Incorrect 188 ms 80108 KB Output isn't correct
24 Incorrect 152 ms 79772 KB Output isn't correct
25 Incorrect 313 ms 79852 KB Output isn't correct
26 Incorrect 270 ms 79724 KB Output isn't correct
27 Incorrect 558 ms 80364 KB Output isn't correct
28 Incorrect 152 ms 79852 KB Output isn't correct
29 Incorrect 478 ms 80876 KB Output isn't correct
30 Incorrect 429 ms 80492 KB Output isn't correct
31 Incorrect 183 ms 79724 KB Output isn't correct
32 Incorrect 223 ms 79852 KB Output isn't correct
33 Incorrect 122 ms 79724 KB Output isn't correct
34 Incorrect 345 ms 80364 KB Output isn't correct
35 Incorrect 171 ms 79852 KB Output isn't correct
36 Incorrect 483 ms 80748 KB Output isn't correct
37 Incorrect 205 ms 81024 KB Output isn't correct
38 Incorrect 402 ms 79852 KB Output isn't correct
39 Incorrect 172 ms 79724 KB Output isn't correct
40 Incorrect 333 ms 79980 KB Output isn't correct
41 Incorrect 294 ms 80364 KB Output isn't correct
42 Incorrect 434 ms 79852 KB Output isn't correct