# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31883 | Kanvie | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 479 ms | 79628 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<stdio.h>
#include<algorithm>
using namespace std;
const int M=10000000;
int x,m,q,d[M+5],a[100001],b[M+5],p,pp,cnt;
int main()
{
scanf("%d%d",&m,&q);
for(int i=1;i<=m;++i)scanf("%d",&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&&i<=M)
{
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--)
{
scanf("%d",&x);
if(b[x]==0&&x!=0)printf("oo\n");
else printf("%d\n",b[x]);
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |