# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
15192 | hodduc | 분배 (kriii3_Q) | C++98 | 11 ms | 1596 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[18];
int vn[131072];
int main()
{
n[1] = 1;
for(long long i = 2, x = 2; i < 17; i++, x<<=1){
n[i] = n[i-1] * 2 + x;
}
for(int i = 1; i < 131072; i<<=1) {
for(int j = 0; j < 131072; 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;
if(n[N] % l != 0) {
printf("ERR?");
return 0;
}
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... |