답안 #331145

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
331145 2020-11-27T14:11:32 Z Sho10 Brunhilda’s Birthday (BOI13_brunhilda) C++14
0 / 100
711 ms 158188 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;
ll n,m,ans[20000001],a[20000001];
int32_t main(){
CODE_START
n=2e7;
cin>>m;
ll q;
cin>>q;
for(ll i=1;i<=m;i++)
{
    ll x;
    cin>>x;
    for(ll j=x;j<=n;j+=x){
        a[j-1]=max(a[j-1],x-1);
    }
}
for(ll i=n;i>=1;i--)
{
    a[i]=max(a[i],a[i+1]-1);
}
for(ll 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--){
    ll x;
    cin>>x;
    if(ans[x]){
        cout<<ans[x]<<endl;
    }else cout<<"oo"<<endl;
}
}

# 결과 실행 시간 메모리 Grader output
1 Incorrect 176 ms 157036 KB Output isn't correct
2 Incorrect 231 ms 157040 KB Output isn't correct
3 Incorrect 231 ms 156888 KB Output isn't correct
4 Incorrect 171 ms 156908 KB Output isn't correct
5 Incorrect 196 ms 156908 KB Output isn't correct
6 Incorrect 174 ms 157036 KB Output isn't correct
7 Incorrect 325 ms 156908 KB Output isn't correct
8 Incorrect 227 ms 156908 KB Output isn't correct
9 Incorrect 285 ms 157060 KB Output isn't correct
10 Incorrect 396 ms 156956 KB Output isn't correct
11 Incorrect 290 ms 156908 KB Output isn't correct
12 Incorrect 169 ms 156908 KB Output isn't correct
13 Incorrect 547 ms 156988 KB Output isn't correct
14 Incorrect 546 ms 156908 KB Output isn't correct
15 Incorrect 273 ms 156908 KB Output isn't correct
16 Incorrect 244 ms 156908 KB Output isn't correct
17 Incorrect 222 ms 156908 KB Output isn't correct
18 Incorrect 164 ms 156908 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 217 ms 156996 KB Output isn't correct
2 Incorrect 235 ms 157676 KB Output isn't correct
3 Incorrect 684 ms 157468 KB Output isn't correct
4 Incorrect 264 ms 156956 KB Output isn't correct
5 Incorrect 456 ms 157412 KB Output isn't correct
6 Incorrect 230 ms 156888 KB Output isn't correct
7 Incorrect 222 ms 156996 KB Output isn't correct
8 Incorrect 237 ms 157040 KB Output isn't correct
9 Incorrect 491 ms 157468 KB Output isn't correct
10 Incorrect 682 ms 157424 KB Output isn't correct
11 Incorrect 629 ms 157296 KB Output isn't correct
12 Incorrect 344 ms 156908 KB Output isn't correct
13 Incorrect 190 ms 157036 KB Output isn't correct
14 Incorrect 253 ms 157036 KB Output isn't correct
15 Incorrect 514 ms 157260 KB Output isn't correct
16 Incorrect 212 ms 157676 KB Output isn't correct
17 Incorrect 526 ms 156984 KB Output isn't correct
18 Incorrect 507 ms 157724 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 555 ms 157568 KB Output isn't correct
2 Incorrect 656 ms 157548 KB Output isn't correct
3 Incorrect 643 ms 157420 KB Output isn't correct
4 Incorrect 376 ms 157420 KB Output isn't correct
5 Incorrect 252 ms 158060 KB Output isn't correct
6 Incorrect 526 ms 157548 KB Output isn't correct
7 Incorrect 439 ms 157932 KB Output isn't correct
8 Incorrect 552 ms 157656 KB Output isn't correct
9 Incorrect 529 ms 157548 KB Output isn't correct
10 Incorrect 409 ms 157292 KB Output isn't correct
11 Incorrect 340 ms 157420 KB Output isn't correct
12 Incorrect 504 ms 157420 KB Output isn't correct
13 Incorrect 624 ms 157676 KB Output isn't correct
14 Incorrect 344 ms 157356 KB Output isn't correct
15 Incorrect 519 ms 157340 KB Output isn't correct
16 Incorrect 604 ms 157444 KB Output isn't correct
17 Incorrect 483 ms 157676 KB Output isn't correct
18 Incorrect 676 ms 157632 KB Output isn't correct
19 Incorrect 197 ms 157420 KB Output isn't correct
20 Incorrect 662 ms 157548 KB Output isn't correct
21 Incorrect 431 ms 157292 KB Output isn't correct
22 Incorrect 657 ms 158188 KB Output isn't correct
23 Incorrect 259 ms 157548 KB Output isn't correct
24 Incorrect 226 ms 157420 KB Output isn't correct
25 Incorrect 422 ms 157528 KB Output isn't correct
26 Incorrect 394 ms 157400 KB Output isn't correct
27 Incorrect 711 ms 157804 KB Output isn't correct
28 Incorrect 219 ms 157292 KB Output isn't correct
29 Incorrect 595 ms 158188 KB Output isn't correct
30 Incorrect 539 ms 157932 KB Output isn't correct
31 Incorrect 259 ms 157420 KB Output isn't correct
32 Incorrect 289 ms 157376 KB Output isn't correct
33 Incorrect 185 ms 157292 KB Output isn't correct
34 Incorrect 440 ms 157804 KB Output isn't correct
35 Incorrect 232 ms 157292 KB Output isn't correct
36 Incorrect 658 ms 158188 KB Output isn't correct
37 Incorrect 258 ms 158060 KB Output isn't correct
38 Incorrect 534 ms 157612 KB Output isn't correct
39 Incorrect 254 ms 157356 KB Output isn't correct
40 Incorrect 452 ms 157420 KB Output isn't correct
41 Incorrect 389 ms 157932 KB Output isn't correct
42 Incorrect 605 ms 157420 KB Output isn't correct