| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 63638 | Bodo171 | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 803 ms | 117788 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <fstream>
using namespace std;
const int nmax=10*1000*1000+5;
const int nm=10*1000*1000;
int d[nmax],pr[nmax];
int n,m,u,q,i,j,p,x;
int main()
{
//freopen("data.in","r",stdin);
cin>>n>>q;
for(i=1;i<=n;i++)
{
cin>>p;
for(j=p;j<=nm;j+=p)
pr[j]=p;
}
pr[0]=p;
d[0]=1;
for(i=0;i<=nm;i++)
if(d[i])
{
for(j=u+1;j<min(i+pr[i],nm+1);j++)
d[j]=d[i]+1;
u=max(u,min(i+pr[i],nm+1)-1);
}
for(i=1;i<=q;i++)
{
cin>>x;
if(!d[x]) {cout<<"oo\n";continue;}
cout<<d[x]-1<<'\n';
}
return 0;
}
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
