Submission #31880

# Submission time Handle Problem Language Result Execution time Memory
31880 2017-09-11T08:47:05 Z Kanvie Brunhilda’s Birthday (BOI13_brunhilda) C++14
22.2222 / 100
396 ms 80532 KB
#include<bits/stdc++.h>
using namespace std;
const int M=10000000;
int x,m,q,d[M+1],a[100001],b[M+1],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);
            b[i]=cnt;
            if(i==p)break;
            i++;
        }
        if(i==pp)break;
        p=pp;
        ++cnt;
    }
    while(q--)
    {
        cin>>x;
        if(b[x]==0&&x!=0)cout<<"oo\n";
        else cout<<b[x]<<"\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 26 ms 80532 KB Output is correct
2 Correct 66 ms 80532 KB Output is correct
3 Correct 46 ms 80532 KB Output is correct
4 Correct 79 ms 80532 KB Output is correct
5 Correct 86 ms 80532 KB Output is correct
6 Correct 16 ms 80532 KB Output is correct
7 Correct 33 ms 80532 KB Output is correct
8 Correct 39 ms 80532 KB Output is correct
9 Correct 116 ms 80532 KB Output is correct
10 Correct 153 ms 80532 KB Output is correct
11 Correct 126 ms 80532 KB Output is correct
12 Correct 33 ms 80532 KB Output is correct
13 Correct 256 ms 80532 KB Output is correct
14 Correct 313 ms 80532 KB Output is correct
15 Correct 96 ms 80532 KB Output is correct
16 Correct 76 ms 80532 KB Output is correct
17 Correct 106 ms 80532 KB Output is correct
18 Correct 79 ms 80532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 83 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 129 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 346 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 133 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 216 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 89 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 79 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 146 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 313 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 316 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 329 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Correct 156 ms 80532 KB Output is correct
13 Runtime error 56 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 129 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 246 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 116 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Correct 256 ms 80532 KB Output is correct
18 Runtime error 279 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 256 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 336 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 349 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 346 ms 80532 KB Execution timed out (wall clock limit exceeded)
5 Runtime error 163 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 259 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 269 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 289 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 263 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 219 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 196 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 249 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 339 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 279 ms 80532 KB Execution timed out (wall clock limit exceeded)
15 Runtime error 279 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 303 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 266 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 356 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 73 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 363 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 333 ms 80532 KB Execution timed out (wall clock limit exceeded)
22 Runtime error 389 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 136 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 83 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 183 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 359 ms 80532 KB Execution timed out (wall clock limit exceeded)
27 Runtime error 396 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 116 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 349 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 329 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 106 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 153 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 56 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 296 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 89 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 333 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 159 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 286 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 93 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 233 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
41 Runtime error 209 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
42 Runtime error 286 ms 80532 KB Execution killed with signal 11 (could be triggered by violating memory limits)