# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
15189 | hodduc | 분배 (kriii3_Q) | C++98 | 7 ms | 1340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |