# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
548367 | Amylopectin | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 35 ms | 2752 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <stdio.h>
using namespace std;
const long long mxn = 2e5 + 10,mxm = 1e7 + 10;
long long pri[mxn] = {},nli[mxm] = {};
long long fima(long long l,long long r)
{
if(l > r)
return l;
return r;
}
int main()
{
long long i,j,n,m,cou = 0,cn,fn,cma,mu = 1,cl,cr,mid,p;
scanf("%lld %lld",&n,&m);
for(i=0; i<n; i++)
{
scanf("%lld",&pri[i]);
mu *= pri[i];
if(mu > 10000000)
mu = 10000001;
}
nli[0] = 0;
for(i=1; 1; i++)
{
cma = nli[i-1];
for(j=n-1; j>=0; j--)
{
if(pri[j] <= cma - nli[i-1])
break;
cn = pri[j] - (nli[i-1] % pri[j]) - 1 + nli[i-1];
if(cn > cma)
{
cma = cn;
fn = pri[j];
}
// cma = fima(cma,);
}
nli[i] = cma;
// if(i<100)
// printf("%lld %lld %lld\n",i,fn,cma);
if(cma >= mu-1)
break;
}
p = i;
// for(j=0; j<=i; j++)
// {
// printf("%d\n",nli[j]);
// }
for(i=0; i<m; i++)
{
scanf("%lld",&cn);
if(cn >= mu)
{
printf("oo\n");
continue;
}
cl = 0;
cr = p;
while(cl < cr)
{
mid = (cl+cr)/2;
if(nli[mid] >= cn)
{
cr = mid;
}
else
cl = mid+1;
}
printf("%lld\n",cl);
}
return 0;
}
컴파일 시 표준 에러 (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... |