Submission #31872

# Submission time Handle Problem Language Result Execution time Memory
31872 2017-09-11T08:20:48 Z Kanvie Brunhilda’s Birthday (BOI13_brunhilda) C++14
5.55556 / 100
649 ms 41928 KB
#include<bits/stdc++.h>
using namespace std;
const int M=10000000;
int x,m,q,d[M+1],mx,p,pp,cnt;
vector<int>v;
int main()
{
    cin>>m>>q;
    while(m--)
    {
        cin>>x;
        v.push_back(x);
    }
    sort(v.begin(),v.end());
    m=v.size();
    for(int i=0;i<m;++i)
    {
        x=v[i];
        for(int j=0;j<=M;j+=x)d[j]=x;
    }
    p=v[v.size()-1]-1;
    pp=v[v.size()-1]-1;
    cnt=1;
    for(int i=1;i<=M;++i)
    {
        if(i<=p)
        {
            if(d[i]!=0)pp=max(pp,i+d[i]-1);
            d[i]=cnt;
            if(i==p)
            {
                p=pp;
                cnt++;
            }
        }
        else {mx=i-1;break;}
    }
    while(q--)
    {
        cin>>x;
        if(mx<x)cout<<"oo\n";
        else cout<<d[x]<<"\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 23 ms 41076 KB Output is correct
2 Incorrect 83 ms 41076 KB Output isn't correct
3 Correct 29 ms 41076 KB Output is correct
4 Incorrect 69 ms 41076 KB Output isn't correct
5 Incorrect 83 ms 41076 KB Output isn't correct
6 Correct 19 ms 41076 KB Output is correct
7 Correct 26 ms 41076 KB Output is correct
8 Correct 43 ms 41076 KB Output is correct
9 Incorrect 106 ms 41076 KB Output isn't correct
10 Incorrect 139 ms 41076 KB Output isn't correct
11 Incorrect 146 ms 41076 KB Output isn't correct
12 Incorrect 36 ms 41076 KB Output isn't correct
13 Incorrect 293 ms 41076 KB Output isn't correct
14 Incorrect 329 ms 41076 KB Output isn't correct
15 Incorrect 99 ms 41076 KB Output isn't correct
16 Incorrect 66 ms 41076 KB Output isn't correct
17 Incorrect 166 ms 41076 KB Output isn't correct
18 Incorrect 63 ms 41076 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 89 ms 41216 KB Output isn't correct
2 Incorrect 136 ms 41928 KB Output isn't correct
3 Incorrect 416 ms 41928 KB Output isn't correct
4 Incorrect 143 ms 41076 KB Output isn't correct
5 Incorrect 246 ms 41544 KB Output isn't correct
6 Incorrect 79 ms 41076 KB Output isn't correct
7 Incorrect 86 ms 41216 KB Output isn't correct
8 Incorrect 146 ms 41076 KB Output isn't correct
9 Incorrect 376 ms 41928 KB Output isn't correct
10 Incorrect 456 ms 41928 KB Output isn't correct
11 Incorrect 419 ms 41544 KB Output isn't correct
12 Incorrect 203 ms 41076 KB Output isn't correct
13 Incorrect 69 ms 41076 KB Output isn't correct
14 Incorrect 163 ms 41076 KB Output isn't correct
15 Incorrect 313 ms 41544 KB Output isn't correct
16 Incorrect 149 ms 41928 KB Output isn't correct
17 Incorrect 309 ms 41076 KB Output isn't correct
18 Incorrect 336 ms 41928 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 323 ms 41544 KB Output isn't correct
2 Incorrect 449 ms 41544 KB Output isn't correct
3 Runtime error 589 ms 41544 KB Execution timed out (wall clock limit exceeded)
4 Runtime error 383 ms 41076 KB Execution timed out (wall clock limit exceeded)
5 Runtime error 329 ms 41928 KB Execution timed out (wall clock limit exceeded)
6 Incorrect 506 ms 41216 KB Output isn't correct
7 Incorrect 429 ms 41928 KB Output isn't correct
8 Incorrect 449 ms 41544 KB Output isn't correct
9 Runtime error 476 ms 41544 KB Execution timed out (wall clock limit exceeded)
10 Incorrect 349 ms 41216 KB Output isn't correct
11 Incorrect 319 ms 41216 KB Output isn't correct
12 Incorrect 356 ms 41216 KB Output isn't correct
13 Runtime error 446 ms 41348 KB Execution timed out (wall clock limit exceeded)
14 Runtime error 299 ms 41076 KB Execution timed out (wall clock limit exceeded)
15 Incorrect 369 ms 41216 KB Output isn't correct
16 Incorrect 416 ms 41216 KB Output isn't correct
17 Incorrect 316 ms 41544 KB Output isn't correct
18 Incorrect 526 ms 41544 KB Output isn't correct
19 Incorrect 119 ms 41216 KB Output isn't correct
20 Runtime error 536 ms 41544 KB Execution timed out (wall clock limit exceeded)
21 Runtime error 339 ms 41076 KB Execution timed out (wall clock limit exceeded)
22 Runtime error 579 ms 41928 KB Execution timed out (wall clock limit exceeded)
23 Runtime error 266 ms 41348 KB Execution timed out (wall clock limit exceeded)
24 Incorrect 276 ms 41076 KB Output isn't correct
25 Runtime error 303 ms 41076 KB Execution timed out (wall clock limit exceeded)
26 Runtime error 349 ms 41076 KB Execution timed out (wall clock limit exceeded)
27 Runtime error 649 ms 41928 KB Execution timed out (wall clock limit exceeded)
28 Runtime error 226 ms 41076 KB Execution timed out (wall clock limit exceeded)
29 Runtime error 576 ms 41928 KB Execution timed out (wall clock limit exceeded)
30 Runtime error 549 ms 41928 KB Execution timed out (wall clock limit exceeded)
31 Incorrect 246 ms 41216 KB Output isn't correct
32 Runtime error 316 ms 41076 KB Execution timed out (wall clock limit exceeded)
33 Runtime error 183 ms 41076 KB Execution timed out (wall clock limit exceeded)
34 Runtime error 556 ms 41928 KB Execution timed out (wall clock limit exceeded)
35 Incorrect 349 ms 41076 KB Output isn't correct
36 Runtime error 559 ms 41928 KB Execution timed out (wall clock limit exceeded)
37 Runtime error 303 ms 41928 KB Execution timed out (wall clock limit exceeded)
38 Incorrect 503 ms 41216 KB Output isn't correct
39 Runtime error 226 ms 41076 KB Execution timed out (wall clock limit exceeded)
40 Runtime error 429 ms 41216 KB Execution timed out (wall clock limit exceeded)
41 Runtime error 439 ms 41928 KB Execution timed out (wall clock limit exceeded)
42 Runtime error 493 ms 41076 KB Execution timed out (wall clock limit exceeded)