Submission #22688

# Submission time Handle Problem Language Result Execution time Memory
22688 2017-04-30T06:34:38 Z PurpleNoon backward compatibility(#974, ainch, semteo) Fully Generate (KRIII5_FG) C++
0 / 7
0 ms 626896 KB
#include<stdio.h>
long long int b[80000000];
long long int cnt=1,bb[100000],t=0,j;
long long int asd(long long int i,long long int y){
	t=0; cnt=1;
	while(y!=0){t++; bb[t]=y%2; y/=2;}
	for(j=t;j>=1;j--){
		if(bb[j]==1) cnt*=i;
		cnt%=1000000007;
		if(j!=1) cnt*=cnt;
		cnt%=1000000007;
	}
	return cnt;
}
int main(){
	long long int n,i,x,y,t,f=0,cnt=0,count=0;
	scanf("%lld",&n);
	t=1;
	if(n==1){printf("1"); return 0;}
	x=1; y=1;
	cnt=1;
	while(t<=n){
		x++;
		if(f%2==0) y++;
		t+=x*y;
		f++;
		cnt+=y;
	}
	t-=(x*y);
	cnt-=y;
	count=1;
	for(i=cnt;i>=1;i--) {count*=i; count%=1000000007;b[i]=count;}
	long long int xx=1,ccount=1,yy=1,flag=0;
	while(xx<=cnt){
		flag++;
		ccount*=b[xx];
		ccount%=1000000007;
		if(flag%2==0) yy++;
		xx+=yy;
	}
	n-=t;
	i=cnt+1;
	while(1){
		if(n<=0) break;
		if(n>x) ccount*=asd(i,x); else ccount*=asd(i,n);
		ccount%=1000000007;
		n-=x;
		i++;
	}
	printf("%lld",ccount);
	return 0;
}

Compilation message

FG.cpp: In function 'int main()':
FG.cpp:17:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
                  ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 626896 KB Output is correct
2 Correct 0 ms 626896 KB Output is correct
3 Correct 0 ms 626896 KB Output is correct
4 Correct 0 ms 626896 KB Output is correct
5 Correct 0 ms 626896 KB Output is correct
6 Correct 0 ms 626896 KB Output is correct
7 Correct 0 ms 626896 KB Output is correct
8 Correct 0 ms 626896 KB Output is correct
9 Correct 0 ms 626896 KB Output is correct
10 Correct 0 ms 626896 KB Output is correct
11 Incorrect 0 ms 626896 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 626896 KB Output is correct
2 Correct 0 ms 626896 KB Output is correct
3 Correct 0 ms 626896 KB Output is correct
4 Correct 0 ms 626896 KB Output is correct
5 Correct 0 ms 626896 KB Output is correct
6 Correct 0 ms 626896 KB Output is correct
7 Correct 0 ms 626896 KB Output is correct
8 Correct 0 ms 626896 KB Output is correct
9 Correct 0 ms 626896 KB Output is correct
10 Correct 0 ms 626896 KB Output is correct
11 Incorrect 0 ms 626896 KB Output isn't correct
12 Halted 0 ms 0 KB -