Submission #15189

#TimeUsernameProblemLanguageResultExecution timeMemory
15189hodduc분배 (kriii3_Q)C++98
0 / 24
7 ms1340 KiB
#include<stdio.h> int N, K; long long n[17]; int vn[65536]; int main() { n[1] = 1; for(long long i = 2, x = 2; i < 16; i++, x<<=1){ n[i] = n[i-1] * 2 + x; } for(int i = 1; i < 65536; i<<=1) { for(int j = 0; j < 65536; j++) { if(j&i) vn[j]++; } } long long l, t, j, bn; scanf("%d %d", &N, &K); l = 1 << K; t = n[N] / l; j = 0; bn = (1 << N) - 1; for(int i = 0; i < l; i++) { long long tt = t; while(tt) { printf("%lld ", j); printf("%lld ", bn-j); tt -= vn[j]; tt -= vn[bn-j]; j++; } printf("\n"); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...