답안 #22308

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
22308 2017-04-30T03:46:42 Z - - - - - - - List of honorable mention follows - - - - - - -(#999, xhae, ainu7, littlesheep) Fully Generate (KRIII5_FG) C++
2 / 7
500 ms 252020 KB
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
#include <set>
using namespace std;

const int mmod = 1000000007;
const int m = 32000000;

int G[m+1], H[m+1];

int pw(int a, int b) {
  if (b == 0) return 1;
  int c= pw(a, b/2);
  c = (1LL * c*c) % mmod;
  if (b % 2)
    c = (1LL * a * c) % mmod;
  return c;
}

int main()
{
  G[1] = 1;
  G[2] = G[3] = 2;
  for (int i=3, j=4; ;) {
    for (int iter=0; iter<G[i]; iter++) {
      G[j++] = i;
      if (j == m) break;
    }
    if (j == m) break;
    i ++;
  }

  long long sum = 0;
  for (int i=0; i<m; i++) sum += G[i];
//  printf("%lld\n", sum);

  long long n;
  cin >> n;
  for (int i=1; n; i++) {
    int iter = min((long long)G[i], n);
    n -= iter;
    if (!H[iter]) H[iter] = i;
    else H[iter] = (H[iter] * 1LL * i) % mmod;
  }

  int res = 1;
  int now = 1;
  for (int i=m; i>=1; i--) {
    if (H[i]) now = (now * 1LL * H[i]) % mmod;
    res = (res * 1LL * now) % mmod;
  }
  cout << res << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 256 ms 252020 KB Output is correct
2 Correct 229 ms 252020 KB Output is correct
3 Correct 246 ms 252020 KB Output is correct
4 Correct 273 ms 252020 KB Output is correct
5 Correct 229 ms 252020 KB Output is correct
6 Correct 246 ms 252020 KB Output is correct
7 Correct 259 ms 252020 KB Output is correct
8 Correct 259 ms 252020 KB Output is correct
9 Correct 259 ms 252020 KB Output is correct
10 Correct 243 ms 252020 KB Output is correct
11 Correct 246 ms 252020 KB Output is correct
12 Correct 246 ms 252020 KB Output is correct
13 Correct 273 ms 252020 KB Output is correct
14 Correct 256 ms 252020 KB Output is correct
15 Correct 219 ms 252020 KB Output is correct
16 Correct 246 ms 252020 KB Output is correct
17 Correct 236 ms 252020 KB Output is correct
18 Correct 249 ms 252020 KB Output is correct
19 Correct 243 ms 252020 KB Output is correct
20 Correct 253 ms 252020 KB Output is correct
21 Correct 236 ms 252020 KB Output is correct
22 Correct 246 ms 252020 KB Output is correct
23 Correct 259 ms 252020 KB Output is correct
24 Correct 246 ms 252020 KB Output is correct
25 Correct 249 ms 252020 KB Output is correct
26 Correct 256 ms 252020 KB Output is correct
27 Correct 259 ms 252020 KB Output is correct
28 Correct 259 ms 252020 KB Output is correct
29 Correct 259 ms 252020 KB Output is correct
30 Correct 239 ms 252020 KB Output is correct
31 Correct 256 ms 252020 KB Output is correct
32 Correct 249 ms 252020 KB Output is correct
33 Correct 276 ms 252020 KB Output is correct
34 Correct 259 ms 252020 KB Output is correct
35 Correct 269 ms 252020 KB Output is correct
36 Correct 246 ms 252020 KB Output is correct
37 Correct 243 ms 252020 KB Output is correct
38 Correct 259 ms 252020 KB Output is correct
39 Correct 266 ms 252020 KB Output is correct
40 Correct 239 ms 252020 KB Output is correct
41 Correct 256 ms 252020 KB Output is correct
42 Correct 253 ms 252020 KB Output is correct
43 Correct 249 ms 252020 KB Output is correct
44 Correct 233 ms 252020 KB Output is correct
45 Correct 243 ms 252020 KB Output is correct
46 Correct 273 ms 252020 KB Output is correct
47 Correct 259 ms 252020 KB Output is correct
48 Correct 256 ms 252020 KB Output is correct
49 Correct 243 ms 252020 KB Output is correct
50 Correct 249 ms 252020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 256 ms 252020 KB Output is correct
2 Correct 229 ms 252020 KB Output is correct
3 Correct 246 ms 252020 KB Output is correct
4 Correct 273 ms 252020 KB Output is correct
5 Correct 229 ms 252020 KB Output is correct
6 Correct 246 ms 252020 KB Output is correct
7 Correct 259 ms 252020 KB Output is correct
8 Correct 259 ms 252020 KB Output is correct
9 Correct 259 ms 252020 KB Output is correct
10 Correct 243 ms 252020 KB Output is correct
11 Correct 246 ms 252020 KB Output is correct
12 Correct 246 ms 252020 KB Output is correct
13 Correct 273 ms 252020 KB Output is correct
14 Correct 256 ms 252020 KB Output is correct
15 Correct 219 ms 252020 KB Output is correct
16 Correct 246 ms 252020 KB Output is correct
17 Correct 236 ms 252020 KB Output is correct
18 Correct 249 ms 252020 KB Output is correct
19 Correct 243 ms 252020 KB Output is correct
20 Correct 253 ms 252020 KB Output is correct
21 Correct 236 ms 252020 KB Output is correct
22 Correct 246 ms 252020 KB Output is correct
23 Correct 259 ms 252020 KB Output is correct
24 Correct 246 ms 252020 KB Output is correct
25 Correct 249 ms 252020 KB Output is correct
26 Correct 256 ms 252020 KB Output is correct
27 Correct 259 ms 252020 KB Output is correct
28 Correct 259 ms 252020 KB Output is correct
29 Correct 259 ms 252020 KB Output is correct
30 Correct 239 ms 252020 KB Output is correct
31 Correct 256 ms 252020 KB Output is correct
32 Correct 249 ms 252020 KB Output is correct
33 Correct 276 ms 252020 KB Output is correct
34 Correct 259 ms 252020 KB Output is correct
35 Correct 269 ms 252020 KB Output is correct
36 Correct 246 ms 252020 KB Output is correct
37 Correct 243 ms 252020 KB Output is correct
38 Correct 259 ms 252020 KB Output is correct
39 Correct 266 ms 252020 KB Output is correct
40 Correct 239 ms 252020 KB Output is correct
41 Correct 256 ms 252020 KB Output is correct
42 Correct 253 ms 252020 KB Output is correct
43 Correct 249 ms 252020 KB Output is correct
44 Correct 233 ms 252020 KB Output is correct
45 Correct 243 ms 252020 KB Output is correct
46 Correct 273 ms 252020 KB Output is correct
47 Correct 259 ms 252020 KB Output is correct
48 Correct 256 ms 252020 KB Output is correct
49 Correct 243 ms 252020 KB Output is correct
50 Correct 249 ms 252020 KB Output is correct
51 Execution timed out 500 ms 252020 KB Execution timed out
52 Halted 0 ms 0 KB -