Submission #12077

#TimeUsernameProblemLanguageResultExecution timeMemory
12077tncks0121배낭 문제 준비하기 (GA9_invknapsack)C++14
100 / 100
0 ms1120 KiB
#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 = 200;
    for(int i = 1; i <= O; i++) {
      if(T >= C[O][i] && C[O][i] > t) t = C[O][i], v = 200 - i;
    }
    res[N++] = v;
    T -= t;
  }
   
  printf("%d %d\n", N, 200);
  for(int i = 0; i < N; i++) {
    printf("%d%c", res[i], (i + 1 < N) ? ' ' : '\n');
  }
  return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...