답안 #22284

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
22284 2017-04-30T03:32:09 Z 퍼플달고싶다(#990, smu201111192, pce913, cokcjswo) Fully Generate (KRIII5_FG) C++14
2 / 7
500 ms 495768 KB
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define SIZE 31600000
#define BC 50
#define BS 5000
#define MOD 1000000007LL
#define MAXV 555
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef vector<vector<long long> > mat;

ll n, cnt[SIZE], chk[SIZE];

ll getPow(ll a, ll p) {
	ll b = 1;
	while(p>0) {
		if(p%2LL)	b*=a, b%=MOD;
		a*=a, p/=2LL, a%=MOD;
	}

	return b;
}

int main () {
	scanf("%lld",&n);
	ll pos = 1;
	chk[1] = 1, chk[2] = 2, chk[3] = 2;
	for(ll i=1;i<SIZE;i++) {
		for(ll j=0;j<chk[i] && j+pos<SIZE;j++)
			chk[j+pos] = i;
		pos += chk[i];
	}
	// printf("pos %lld\n",pos);
	// for(int i=0;i<100;i++)	printf("%lld ",chk[i]);

	ll p = 1, idx = 1, ret = 1;
	for(;p+chk[idx]<=n;) {
		// printf("p %lld idx %lld chkidx %lld\n",p,idx,chk[idx]);
		ret *= getPow(idx, chk[idx]), ret%=MOD;
		p += chk[idx];
		idx++;
	}
	// printf("p %lld idx %lld\n",p,idx);
	if(p <= n+1LL) {
		// printf("getpow %lld\n",getPow(idx, n-p+1LL));
		ret *= getPow(idx, n-p+1LL), ret%=MOD;
	}
	printf("%lld\n",ret);
}

Compilation message

FG.cpp: In function 'int main()':
FG.cpp:31:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
                  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 495768 KB Output is correct
2 Correct 73 ms 495768 KB Output is correct
3 Correct 83 ms 495768 KB Output is correct
4 Correct 83 ms 495768 KB Output is correct
5 Correct 93 ms 495768 KB Output is correct
6 Correct 83 ms 495768 KB Output is correct
7 Correct 89 ms 495768 KB Output is correct
8 Correct 89 ms 495768 KB Output is correct
9 Correct 89 ms 495768 KB Output is correct
10 Correct 89 ms 495768 KB Output is correct
11 Correct 76 ms 495768 KB Output is correct
12 Correct 86 ms 495768 KB Output is correct
13 Correct 106 ms 495768 KB Output is correct
14 Correct 79 ms 495768 KB Output is correct
15 Correct 96 ms 495768 KB Output is correct
16 Correct 89 ms 495768 KB Output is correct
17 Correct 76 ms 495768 KB Output is correct
18 Correct 93 ms 495768 KB Output is correct
19 Correct 93 ms 495768 KB Output is correct
20 Correct 79 ms 495768 KB Output is correct
21 Correct 89 ms 495768 KB Output is correct
22 Correct 73 ms 495768 KB Output is correct
23 Correct 103 ms 495768 KB Output is correct
24 Correct 83 ms 495768 KB Output is correct
25 Correct 79 ms 495768 KB Output is correct
26 Correct 79 ms 495768 KB Output is correct
27 Correct 86 ms 495768 KB Output is correct
28 Correct 89 ms 495768 KB Output is correct
29 Correct 79 ms 495768 KB Output is correct
30 Correct 73 ms 495768 KB Output is correct
31 Correct 83 ms 495768 KB Output is correct
32 Correct 86 ms 495768 KB Output is correct
33 Correct 96 ms 495768 KB Output is correct
34 Correct 99 ms 495768 KB Output is correct
35 Correct 103 ms 495768 KB Output is correct
36 Correct 76 ms 495768 KB Output is correct
37 Correct 113 ms 495768 KB Output is correct
38 Correct 103 ms 495768 KB Output is correct
39 Correct 83 ms 495768 KB Output is correct
40 Correct 93 ms 495768 KB Output is correct
41 Correct 99 ms 495768 KB Output is correct
42 Correct 76 ms 495768 KB Output is correct
43 Correct 86 ms 495768 KB Output is correct
44 Correct 86 ms 495768 KB Output is correct
45 Correct 79 ms 495768 KB Output is correct
46 Correct 79 ms 495768 KB Output is correct
47 Correct 69 ms 495768 KB Output is correct
48 Correct 89 ms 495768 KB Output is correct
49 Correct 106 ms 495768 KB Output is correct
50 Correct 79 ms 495768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 495768 KB Output is correct
2 Correct 73 ms 495768 KB Output is correct
3 Correct 83 ms 495768 KB Output is correct
4 Correct 83 ms 495768 KB Output is correct
5 Correct 93 ms 495768 KB Output is correct
6 Correct 83 ms 495768 KB Output is correct
7 Correct 89 ms 495768 KB Output is correct
8 Correct 89 ms 495768 KB Output is correct
9 Correct 89 ms 495768 KB Output is correct
10 Correct 89 ms 495768 KB Output is correct
11 Correct 76 ms 495768 KB Output is correct
12 Correct 86 ms 495768 KB Output is correct
13 Correct 106 ms 495768 KB Output is correct
14 Correct 79 ms 495768 KB Output is correct
15 Correct 96 ms 495768 KB Output is correct
16 Correct 89 ms 495768 KB Output is correct
17 Correct 76 ms 495768 KB Output is correct
18 Correct 93 ms 495768 KB Output is correct
19 Correct 93 ms 495768 KB Output is correct
20 Correct 79 ms 495768 KB Output is correct
21 Correct 89 ms 495768 KB Output is correct
22 Correct 73 ms 495768 KB Output is correct
23 Correct 103 ms 495768 KB Output is correct
24 Correct 83 ms 495768 KB Output is correct
25 Correct 79 ms 495768 KB Output is correct
26 Correct 79 ms 495768 KB Output is correct
27 Correct 86 ms 495768 KB Output is correct
28 Correct 89 ms 495768 KB Output is correct
29 Correct 79 ms 495768 KB Output is correct
30 Correct 73 ms 495768 KB Output is correct
31 Correct 83 ms 495768 KB Output is correct
32 Correct 86 ms 495768 KB Output is correct
33 Correct 96 ms 495768 KB Output is correct
34 Correct 99 ms 495768 KB Output is correct
35 Correct 103 ms 495768 KB Output is correct
36 Correct 76 ms 495768 KB Output is correct
37 Correct 113 ms 495768 KB Output is correct
38 Correct 103 ms 495768 KB Output is correct
39 Correct 83 ms 495768 KB Output is correct
40 Correct 93 ms 495768 KB Output is correct
41 Correct 99 ms 495768 KB Output is correct
42 Correct 76 ms 495768 KB Output is correct
43 Correct 86 ms 495768 KB Output is correct
44 Correct 86 ms 495768 KB Output is correct
45 Correct 79 ms 495768 KB Output is correct
46 Correct 79 ms 495768 KB Output is correct
47 Correct 69 ms 495768 KB Output is correct
48 Correct 89 ms 495768 KB Output is correct
49 Correct 106 ms 495768 KB Output is correct
50 Correct 79 ms 495768 KB Output is correct
51 Execution timed out 500 ms 495768 KB Execution timed out
52 Halted 0 ms 0 KB -