Submission #10419

#TimeUsernameProblemLanguageResultExecution timeMemory
10419tncks0121배낭 문제 준비하기 (GA9_invknapsack)C++14
100 / 100
0 ms1120 KiB
#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; }
#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...