Submission #31878

# Submission time Handle Problem Language Result Execution time Memory
31878 2017-09-11T08:35:46 Z Kanvie Brunhilda’s Birthday (BOI13_brunhilda) C++14
5.55556 / 100
419 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;
    }
    for(int i=0;i<=M;++i)
    {
        while(i<=p)
        {
            if(d[i]!=0)pp=max(pp,i+d[i]-1);
            d[i]=cnt;
            if(i==p)break;
            i++;
        }
        if(i==pp){mx=i;break;}
        p=pp;
        ++cnt;
    }
    while(q--)
    {
        cin>>x;
        if(mx<x)cout<<"oo\n";
        else cout<<d[x]<<"\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 16 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 Runtime error 43 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Incorrect 93 ms 41076 KB Output isn't correct
6 Correct 26 ms 41076 KB Output is correct
7 Correct 33 ms 41076 KB Output is correct
8 Correct 43 ms 41076 KB Output is correct
9 Incorrect 119 ms 41076 KB Output isn't correct
10 Incorrect 133 ms 41076 KB Output isn't correct
11 Incorrect 146 ms 41076 KB Output isn't correct
12 Runtime error 36 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 289 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 293 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Incorrect 109 ms 41076 KB Output isn't correct
16 Incorrect 89 ms 41076 KB Output isn't correct
17 Runtime error 89 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 33 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 76 ms 41216 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 143 ms 41928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 379 ms 41928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 133 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 286 ms 41544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 86 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 73 ms 41216 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 143 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 286 ms 41928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 416 ms 41928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 369 ms 41544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 169 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 53 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 143 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 299 ms 41544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 139 ms 41928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 266 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 319 ms 41928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 269 ms 41544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 376 ms 41544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 379 ms 41544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 179 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 173 ms 41928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 263 ms 41216 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 319 ms 41928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 286 ms 41544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 293 ms 41544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 239 ms 41216 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 223 ms 41216 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 279 ms 41216 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 356 ms 41348 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 263 ms 41076 KB Execution timed out (wall clock limit exceeded)
15 Runtime error 279 ms 41216 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 319 ms 41216 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 323 ms 41544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 393 ms 41544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 73 ms 41216 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 399 ms 41544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 213 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 406 ms 41928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 126 ms 41348 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 63 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 209 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 176 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 419 ms 41928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 79 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 373 ms 41928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 336 ms 41928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 123 ms 41216 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 153 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 43 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 309 ms 41928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 103 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 376 ms 41928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 156 ms 41928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 283 ms 41216 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 89 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 223 ms 41216 KB Execution killed with signal 11 (could be triggered by violating memory limits)
41 Runtime error 243 ms 41928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
42 Runtime error 313 ms 41076 KB Execution killed with signal 11 (could be triggered by violating memory limits)