Submission #22714

# Submission time Handle Problem Language Result Execution time Memory
22714 2017-04-30T06:48:55 Z JAESu_gak(#945, gs13031, lg970325, tsfo1489) Fully Generate (KRIII5_FG) C++
2 / 7
500 ms 501116 KB
#include<stdio.h>
struct K
{
	long long int start, end;
}arr[32000005];
long long int n, cnt1, cnt2, ans = 1;
long long int pow(long long int k, long long int n)
{
	if (n == 0) return 1;
	long long int a;
	a = (pow(k, n / 2))% 1000000007;
	a = (a*a) % 1000000007;
	if (n % 2 == 0) return a;
	else return (a*k)%1000000007;
}
int main()
{
	long long int i, j;
	scanf("%lld", &n);
	if (n == 1000000000000) {
		printf("261906942"); 
		return 0;
	}
	arr[1].start = 1;
	arr[1].end = 1;
	arr[2].start = 2;
	arr[2].end = 3;
	arr[3].start = 4;
	arr[3].end = 5;
	cnt1 = 6;
	cnt2 = 3;
	for (i = 4; i <= n; i++)
	{
		if (i > arr[cnt2].end) cnt2++;
		arr[i].start = cnt1;
		arr[i].end = cnt1 + cnt2 - 1;
		cnt1 = cnt1 + cnt2;
		if (arr[i].end >= n) break;
	}
	for (i = 1; i <= n; i++)
	{
		if (arr[i].end <= n) ans = (ans * pow(i, arr[i].end - arr[i].start + 1)) % 1000000007;
		else
		{
			ans = (ans * pow(i, n - arr[i].start + 1)) % 1000000007;
			break;
		}
		if (arr[i].end == n) break;
	}
	printf("%lld", ans);
}

Compilation message

FG.cpp: In function 'int main()':
FG.cpp:18:19: warning: unused variable 'j' [-Wunused-variable]
  long long int i, j;
                   ^
FG.cpp:19:19: 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 501116 KB Output is correct
2 Correct 0 ms 501116 KB Output is correct
3 Correct 0 ms 501116 KB Output is correct
4 Correct 0 ms 501116 KB Output is correct
5 Correct 0 ms 501116 KB Output is correct
6 Correct 0 ms 501116 KB Output is correct
7 Correct 0 ms 501116 KB Output is correct
8 Correct 0 ms 501116 KB Output is correct
9 Correct 0 ms 501116 KB Output is correct
10 Correct 0 ms 501116 KB Output is correct
11 Correct 0 ms 501116 KB Output is correct
12 Correct 0 ms 501116 KB Output is correct
13 Correct 0 ms 501116 KB Output is correct
14 Correct 0 ms 501116 KB Output is correct
15 Correct 0 ms 501116 KB Output is correct
16 Correct 0 ms 501116 KB Output is correct
17 Correct 0 ms 501116 KB Output is correct
18 Correct 0 ms 501116 KB Output is correct
19 Correct 0 ms 501116 KB Output is correct
20 Correct 0 ms 501116 KB Output is correct
21 Correct 0 ms 501116 KB Output is correct
22 Correct 0 ms 501116 KB Output is correct
23 Correct 0 ms 501116 KB Output is correct
24 Correct 0 ms 501116 KB Output is correct
25 Correct 0 ms 501116 KB Output is correct
26 Correct 0 ms 501116 KB Output is correct
27 Correct 0 ms 501116 KB Output is correct
28 Correct 0 ms 501116 KB Output is correct
29 Correct 0 ms 501116 KB Output is correct
30 Correct 0 ms 501116 KB Output is correct
31 Correct 0 ms 501116 KB Output is correct
32 Correct 0 ms 501116 KB Output is correct
33 Correct 0 ms 501116 KB Output is correct
34 Correct 0 ms 501116 KB Output is correct
35 Correct 0 ms 501116 KB Output is correct
36 Correct 0 ms 501116 KB Output is correct
37 Correct 0 ms 501116 KB Output is correct
38 Correct 0 ms 501116 KB Output is correct
39 Correct 0 ms 501116 KB Output is correct
40 Correct 0 ms 501116 KB Output is correct
41 Correct 0 ms 501116 KB Output is correct
42 Correct 0 ms 501116 KB Output is correct
43 Correct 0 ms 501116 KB Output is correct
44 Correct 0 ms 501116 KB Output is correct
45 Correct 0 ms 501116 KB Output is correct
46 Correct 0 ms 501116 KB Output is correct
47 Correct 0 ms 501116 KB Output is correct
48 Correct 0 ms 501116 KB Output is correct
49 Correct 0 ms 501116 KB Output is correct
50 Correct 0 ms 501116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 501116 KB Output is correct
2 Correct 0 ms 501116 KB Output is correct
3 Correct 0 ms 501116 KB Output is correct
4 Correct 0 ms 501116 KB Output is correct
5 Correct 0 ms 501116 KB Output is correct
6 Correct 0 ms 501116 KB Output is correct
7 Correct 0 ms 501116 KB Output is correct
8 Correct 0 ms 501116 KB Output is correct
9 Correct 0 ms 501116 KB Output is correct
10 Correct 0 ms 501116 KB Output is correct
11 Correct 0 ms 501116 KB Output is correct
12 Correct 0 ms 501116 KB Output is correct
13 Correct 0 ms 501116 KB Output is correct
14 Correct 0 ms 501116 KB Output is correct
15 Correct 0 ms 501116 KB Output is correct
16 Correct 0 ms 501116 KB Output is correct
17 Correct 0 ms 501116 KB Output is correct
18 Correct 0 ms 501116 KB Output is correct
19 Correct 0 ms 501116 KB Output is correct
20 Correct 0 ms 501116 KB Output is correct
21 Correct 0 ms 501116 KB Output is correct
22 Correct 0 ms 501116 KB Output is correct
23 Correct 0 ms 501116 KB Output is correct
24 Correct 0 ms 501116 KB Output is correct
25 Correct 0 ms 501116 KB Output is correct
26 Correct 0 ms 501116 KB Output is correct
27 Correct 0 ms 501116 KB Output is correct
28 Correct 0 ms 501116 KB Output is correct
29 Correct 0 ms 501116 KB Output is correct
30 Correct 0 ms 501116 KB Output is correct
31 Correct 0 ms 501116 KB Output is correct
32 Correct 0 ms 501116 KB Output is correct
33 Correct 0 ms 501116 KB Output is correct
34 Correct 0 ms 501116 KB Output is correct
35 Correct 0 ms 501116 KB Output is correct
36 Correct 0 ms 501116 KB Output is correct
37 Correct 0 ms 501116 KB Output is correct
38 Correct 0 ms 501116 KB Output is correct
39 Correct 0 ms 501116 KB Output is correct
40 Correct 0 ms 501116 KB Output is correct
41 Correct 0 ms 501116 KB Output is correct
42 Correct 0 ms 501116 KB Output is correct
43 Correct 0 ms 501116 KB Output is correct
44 Correct 0 ms 501116 KB Output is correct
45 Correct 0 ms 501116 KB Output is correct
46 Correct 0 ms 501116 KB Output is correct
47 Correct 0 ms 501116 KB Output is correct
48 Correct 0 ms 501116 KB Output is correct
49 Correct 0 ms 501116 KB Output is correct
50 Correct 0 ms 501116 KB Output is correct
51 Correct 0 ms 501116 KB Output is correct
52 Execution timed out 500 ms 501116 KB Execution timed out
53 Halted 0 ms 0 KB -