Submission #10418

# Submission time Handle Problem Language Result Execution time Memory
10418 2014-10-26T16:11:50 Z tncks0121 배낭 문제 준비하기 (GA9_invknapsack) C++14
0 / 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;
    for(int i = 1; i <= O; i++) {
      if(T >= C[O][i] && C[O][i] > t) t = C[O][i], v = O - i;
    }
    res[N++] = v;
    T -= t;
  }
   
  printf("%d %d\n", N, O);
  for(int i = 0; i < N; i++) {
    printf("%d%c", res[i], (i + 1 < N) ? ' ' : '\n');
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1120 KB Output isn't correct - the number of ways is not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -