답안 #10419

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
10419 2014-10-26T16:14:23 Z tncks0121 배낭 문제 준비하기 (GA9_invknapsack) C++14
100 / 100
0 ms 1120 KB
#define _CRT_SECURE_NO_WARNINGS
   
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <deque>
#include <utility>
#include <bitset>
#include <limits.h>
#include <time.h>
   
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
typedef double lf;
typedef unsigned int uint;
typedef long double llf;
typedef pair<int, int> pii;
  
ll T;
const int O = 62;
const ll MAXV = (ll)1e18 + 10;
  
ll C[O+1][O+1];
  
int res[305], N;
  
int main() {
  scanf("%lld", &T);
    
  for(int i = 1; i <= O; i++) {
    C[i][0] = C[i][i] = 1;
    for(int j = 1; j < i; j++) C[i][j] = min(C[i-1][j] + C[i-1][j-1], MAXV);
  }
    
  N = O;
  for(int i = 0; i < O; i++) res[i] = 1;
    
  while(T > 0) {
    ll t = 1; int v = O+1;
    for(int i = 1; i <= O; i++) {
      if(T >= C[O][i] && C[O][i] > t) t = C[O][i], v = O+1 - i;
    }
    res[N++] = v;
    T -= t;
  }
    
  printf("%d %d\n", N, O+1);
  for(int i = 0; i < N; i++) {
    printf("%d%c", res[i], (i + 1 < N) ? ' ' : '\n');
  }
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1120 KB Output is correct
2 Correct 0 ms 1120 KB Output is correct
3 Correct 0 ms 1120 KB Output is correct
4 Correct 0 ms 1120 KB Output is correct
5 Correct 0 ms 1120 KB Output is correct
6 Correct 0 ms 1120 KB Output is correct
7 Correct 0 ms 1120 KB Output is correct
8 Correct 0 ms 1120 KB Output is correct
9 Correct 0 ms 1120 KB Output is correct
10 Correct 0 ms 1120 KB Output is correct
11 Correct 0 ms 1120 KB Output is correct
12 Correct 0 ms 1120 KB Output is correct
13 Correct 0 ms 1120 KB Output is correct
14 Correct 0 ms 1120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1120 KB Output is correct
2 Correct 0 ms 1120 KB Output is correct
3 Correct 0 ms 1120 KB Output is correct
4 Correct 0 ms 1120 KB Output is correct
5 Correct 0 ms 1120 KB Output is correct
6 Correct 0 ms 1120 KB Output is correct
7 Correct 0 ms 1120 KB Output is correct
8 Correct 0 ms 1120 KB Output is correct
9 Correct 0 ms 1120 KB Output is correct
10 Correct 0 ms 1120 KB Output is correct
11 Correct 0 ms 1120 KB Output is correct
12 Correct 0 ms 1120 KB Output is correct
13 Correct 0 ms 1120 KB Output is correct
14 Correct 0 ms 1120 KB Output is correct
15 Correct 0 ms 1120 KB Output is correct
16 Correct 0 ms 1120 KB Output is correct
17 Correct 0 ms 1120 KB Output is correct
18 Correct 0 ms 1120 KB Output is correct
19 Correct 0 ms 1120 KB Output is correct
20 Correct 0 ms 1120 KB Output is correct
21 Correct 0 ms 1120 KB Output is correct
22 Correct 0 ms 1120 KB Output is correct
23 Correct 0 ms 1120 KB Output is correct
24 Correct 0 ms 1120 KB Output is correct
25 Correct 0 ms 1120 KB Output is correct
26 Correct 0 ms 1120 KB Output is correct
27 Correct 0 ms 1120 KB Output is correct
28 Correct 0 ms 1120 KB Output is correct
29 Correct 0 ms 1120 KB Output is correct
30 Correct 0 ms 1120 KB Output is correct
31 Correct 0 ms 1120 KB Output is correct
32 Correct 0 ms 1120 KB Output is correct
33 Correct 0 ms 1120 KB Output is correct
34 Correct 0 ms 1120 KB Output is correct
35 Correct 0 ms 1120 KB Output is correct
36 Correct 0 ms 1120 KB Output is correct
37 Correct 0 ms 1120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1120 KB Output is correct
2 Correct 0 ms 1120 KB Output is correct
3 Correct 0 ms 1120 KB Output is correct
4 Correct 0 ms 1120 KB Output is correct
5 Correct 0 ms 1120 KB Output is correct
6 Correct 0 ms 1120 KB Output is correct
7 Correct 0 ms 1120 KB Output is correct
8 Correct 0 ms 1120 KB Output is correct
9 Correct 0 ms 1120 KB Output is correct
10 Correct 0 ms 1120 KB Output is correct
11 Correct 0 ms 1120 KB Output is correct
12 Correct 0 ms 1120 KB Output is correct
13 Correct 0 ms 1120 KB Output is correct
14 Correct 0 ms 1120 KB Output is correct
15 Correct 0 ms 1120 KB Output is correct
16 Correct 0 ms 1120 KB Output is correct
17 Correct 0 ms 1120 KB Output is correct
18 Correct 0 ms 1120 KB Output is correct
19 Correct 0 ms 1120 KB Output is correct
20 Correct 0 ms 1120 KB Output is correct
21 Correct 0 ms 1120 KB Output is correct
22 Correct 0 ms 1120 KB Output is correct
23 Correct 0 ms 1120 KB Output is correct
24 Correct 0 ms 1120 KB Output is correct
25 Correct 0 ms 1120 KB Output is correct
26 Correct 0 ms 1120 KB Output is correct
27 Correct 0 ms 1120 KB Output is correct
28 Correct 0 ms 1120 KB Output is correct
29 Correct 0 ms 1120 KB Output is correct
30 Correct 0 ms 1120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1120 KB Output is correct
2 Correct 0 ms 1120 KB Output is correct
3 Correct 0 ms 1120 KB Output is correct
4 Correct 0 ms 1120 KB Output is correct
5 Correct 0 ms 1120 KB Output is correct
6 Correct 0 ms 1120 KB Output is correct
7 Correct 0 ms 1120 KB Output is correct
8 Correct 0 ms 1120 KB Output is correct
9 Correct 0 ms 1120 KB Output is correct
10 Correct 0 ms 1120 KB Output is correct
11 Correct 0 ms 1120 KB Output is correct
12 Correct 0 ms 1120 KB Output is correct
13 Correct 0 ms 1120 KB Output is correct
14 Correct 0 ms 1120 KB Output is correct
15 Correct 0 ms 1120 KB Output is correct
16 Correct 0 ms 1120 KB Output is correct
17 Correct 0 ms 1120 KB Output is correct
18 Correct 0 ms 1120 KB Output is correct
19 Correct 0 ms 1120 KB Output is correct
20 Correct 0 ms 1120 KB Output is correct
21 Correct 0 ms 1120 KB Output is correct
22 Correct 0 ms 1120 KB Output is correct
23 Correct 0 ms 1120 KB Output is correct
24 Correct 0 ms 1120 KB Output is correct
25 Correct 0 ms 1120 KB Output is correct
26 Correct 0 ms 1120 KB Output is correct
27 Correct 0 ms 1120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1120 KB Output is correct
2 Correct 0 ms 1120 KB Output is correct
3 Correct 0 ms 1120 KB Output is correct
4 Correct 0 ms 1120 KB Output is correct
5 Correct 0 ms 1120 KB Output is correct
6 Correct 0 ms 1120 KB Output is correct
7 Correct 0 ms 1120 KB Output is correct
8 Correct 0 ms 1120 KB Output is correct
9 Correct 0 ms 1120 KB Output is correct
10 Correct 0 ms 1120 KB Output is correct
11 Correct 0 ms 1120 KB Output is correct
12 Correct 0 ms 1120 KB Output is correct
13 Correct 0 ms 1120 KB Output is correct
14 Correct 0 ms 1120 KB Output is correct
15 Correct 0 ms 1120 KB Output is correct
16 Correct 0 ms 1120 KB Output is correct
17 Correct 0 ms 1120 KB Output is correct
18 Correct 0 ms 1120 KB Output is correct
19 Correct 0 ms 1120 KB Output is correct
20 Correct 0 ms 1120 KB Output is correct
21 Correct 0 ms 1120 KB Output is correct
22 Correct 0 ms 1120 KB Output is correct
23 Correct 0 ms 1120 KB Output is correct
24 Correct 0 ms 1120 KB Output is correct
25 Correct 0 ms 1120 KB Output is correct
26 Correct 0 ms 1120 KB Output is correct
27 Correct 0 ms 1120 KB Output is correct
28 Correct 0 ms 1120 KB Output is correct
29 Correct 0 ms 1120 KB Output is correct
30 Correct 0 ms 1120 KB Output is correct
31 Correct 0 ms 1120 KB Output is correct
32 Correct 0 ms 1120 KB Output is correct
33 Correct 0 ms 1120 KB Output is correct
34 Correct 0 ms 1120 KB Output is correct