Submission #31879

# Submission time Handle Problem Language Result Execution time Memory
31879 2017-09-11T08:38:05 Z Kanvie Brunhilda’s Birthday (BOI13_brunhilda) C++14
5.55556 / 100
409 ms 41468 KB
#include<bits/stdc++.h>
using namespace std;
const int M=10000000;
int x,m,q,d[M+1],a[100001],mx,p,pp,cnt;
int main()
{
    cin>>m>>q;
    for(int i=1;i<=m;++i)cin>>a[i];
    for(int i=1;i<=m;++i)
        for(int j=0;j<=M;j+=a[i])d[j]=max(d[j],a[i]);
    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 19 ms 41468 KB Output is correct
2 Incorrect 73 ms 41468 KB Output isn't correct
3 Correct 36 ms 41468 KB Output is correct
4 Runtime error 39 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Incorrect 83 ms 41468 KB Output isn't correct
6 Correct 13 ms 41468 KB Output is correct
7 Correct 39 ms 41468 KB Output is correct
8 Correct 39 ms 41468 KB Output is correct
9 Incorrect 123 ms 41468 KB Output isn't correct
10 Incorrect 163 ms 41468 KB Output isn't correct
11 Incorrect 149 ms 41468 KB Output isn't correct
12 Runtime error 39 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 273 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 259 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Incorrect 96 ms 41468 KB Output isn't correct
16 Incorrect 83 ms 41468 KB Output isn't correct
17 Runtime error 93 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 43 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 86 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 126 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 333 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 143 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 233 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 76 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 93 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 126 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 286 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 323 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 309 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 159 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 69 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 129 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 279 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 123 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 269 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 319 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 249 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 359 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 336 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 169 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 149 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 243 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 266 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 249 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 256 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 246 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 196 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 233 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 299 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 319 ms 41468 KB Execution timed out (wall clock limit exceeded)
15 Runtime error 296 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 293 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 259 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 339 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 69 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 359 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 263 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 346 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 126 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 69 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 196 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 179 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 409 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 79 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 356 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 319 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 123 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 143 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 46 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 296 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 96 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 359 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 143 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 249 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 99 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 216 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
41 Runtime error 209 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
42 Runtime error 299 ms 41468 KB Execution killed with signal 11 (could be triggered by violating memory limits)