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<cstdio>
int a,i,u,x,l,n,c;
main()
{
scanf("%d",&a);
for(u=0;u<a;u++)
{
scanf("%d%d%d",&x,&l,&n);
int s1[100000]={},s2[100000]={},p1=0,p2=0;
c=x;
while(c)
{
s2[++p2]=s1[p1];
p1--;
for(i=0;i<=p1;i++)
{
if(s1[i]%2)s1[i]++;
else s1[i]--;
}
if(s2[p2]>l)
{
c--;
if(c==0)printf("%d",s2[p2]);
}
else
{
s2[++p2]=n;
s2[++p2]=n;
s2[p2-1]=s2[p2]+s2[p2-1];p2--;
s2[p2-1]=s2[p2]+s2[p2-1];p2--;
s1[++p1]=s2[p2];
s1[++p1]=s2[p2];
p2-=2;
}
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |