QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#295802#5567. Balanced Permutationsucup-team484#AC ✓53ms4956kbC++176.2kb2024-01-01 01:20:132024-01-01 01:20:14

Judging History

你现在查看的是最新测评结果

  • [2024-01-01 01:20:14]
  • 评测
  • 测评结果:AC
  • 用时:53ms
  • 内存:4956kb
  • [2024-01-01 01:20:13]
  • 提交

answer

#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define st first
#define nd second
using namespace std;
typedef long long ll;
const ll inf = 1e18 + 7;
const int N = 1e2 + 5;
ll C[N][N], dp[N], cnt[N];

int cur[N], vis[N];

int balanced(int l, int r) {
  int tmp = 0;
  for (int i = l; i <= r; i++) {
    int mx = 0;
    for (int j = i; j <= r; j++) {
      mx = max(mx, cur[j]);
      tmp += mx == cur[i] || mx == cur[j];
    }
  }
  return tmp == dp[r - l + 1];
}

ll brute(int i, int n) {
  for (int j = i, k = 1; j < n; j++) {
    while (k <= n && vis[k])
      k++;
    cur[j] = k++;
  }
  int r = 0;
  do {
    r += balanced(0, n - 1);
  } while (next_permutation(cur + i, cur + n));
  for (int j = i; j < n; j++)
    cur[j] = 0;
  return r;
}

// len_of_prefix, len_of_tot, n, available numbers
ll count(int l, int r, int len, int n, ll k, vector<int> nums, vector<int> rhs) {
  // cout << l << " " << r << " " << len << " ("; for (int i: nums) cout << i << ", "; cout << ")" << endl;
  if (sz(nums) < len - (r - l))
    return 0;
  if (0 == r - l || len == r - l) {
    ll ret = 0;
    int j = sz(nums);
    if (r - l == len) {
      ret = balanced(l, r - 1);
    } else {
      if (C[sz(nums)][len] > k / cnt[len])
        ret = k;
      else
        ret = min(k, cnt[len] * C[sz(nums)][len]);
      j -= len;
    }
    for (int i = sz(rhs) - 1; i >= 0 && ret < k && ret > 0; i--) {
      if (rhs[i] <= 0) {
        rhs[i] = -rhs[i];
        if (C[j][rhs[i]] > k / ret)
          ret = k;
        else
          ret = min(k, ret * C[j][rhs[i]]);
        j -= rhs[i];
      } else
        j++;
    }
    return ret;
  }
  int mx = 0;
  for (int i = l; i < r; i++)
    mx = max(mx, cur[i]);
  ll ret = 0;
  while (sz(nums) >= len - (r - l) && nums.back() > mx) {
    int val = nums.back();
    nums.pop_back();
    rhs.push_back(0);
    for (int i = r; i < l + len && ret < k; i++) {
      if (dp[i - l] + dp[l + len - i - 1] + len == dp[len]) {
        rhs.back() = -(l + len - i - 1);
        ll tmp = count(l, r, i - l, n, k, nums, rhs);
        if (tmp > k / cnt[l + len - i - 1])
          tmp = k;
        else
          tmp *= cnt[l + len - i - 1];
        ret = min(k, ret + tmp);
      }
    }
    rhs.back() = val;
  }
  if (sz(nums) < len - (r - l))
    return ret;
  int i = l;
  while (i < r && cur[i] != mx)
    i++;
  assert(i < r);
  if (dp[i - l] + dp[l + len - i - 1] + len == dp[len] && balanced(l, i - 1))
    ret = min(k, ret + count(i + 1, r, l + len - i - 1, n, k, nums, rhs));
  return ret;
}

void dfs(int i, int n, ll& k, int mn) {
  if (k == 0)
    return;
  if (i > 0) {
    vector<int> nums;
    for (int j = 1; j <= n; j++)
      if (!vis[j])
        nums.push_back(j);
    ll kk = count(0, i, n, n, k, nums, {});
    if (k > kk) {
      k -= kk;
      return;
    }
    if (i == n && kk > 0)
      k--;
  }
  if (i == n)
    return;
  if (mn) {
    cur[i] = 0;
    while (cur[i] < n && k > 0) {
      cur[i]++;
      if (!vis[cur[i]]) {
        vis[cur[i]] = 1;
        dfs(i + 1, n, k, mn);
        vis[cur[i]] = 0;
      }
    }
  } else {
    cur[i] = n + 1;
    while (cur[i] > 1 && k > 0) {
      cur[i]--;
      if (!vis[cur[i]]) {
        vis[cur[i]] = 1;
        dfs(i + 1, n, k, mn);
        vis[cur[i]] = 0;
      }
    }
  }
}

void prep() {
  for (int i = 0; i < N; C[i++][0] = 1)
    for (int j = 1; j <= i; j++)
      C[i][j] = min(inf, C[i - 1][j] + C[i - 1][j - 1]);
  dp[0] = 0, cnt[0] = 1;
  for (int i = 1; i < N; i++) {
    dp[i] = inf;
    for (int j = 0; j < i; j++)
      dp[i] = min(dp[j] + dp[i - j - 1], dp[i]);
    dp[i] += i;
    for (int j = 0; j < i; j++) {
      if (dp[j] + dp[i - j - 1] + i == dp[i]) {
        ll v = cnt[j];
        if (v > inf / cnt[i - j - 1])
          v = inf;
        else
          v = min(inf, v * cnt[i - j - 1]);
        if (v > inf / C[i - 1][j])
          v = inf;
        else
          v = min(inf, v * C[i - 1][j]);
        cnt[i] = min(inf, cnt[i] + v);
      }
    }
  }
}

void solve(int n, ll x, int mn) {
  int h = 1;
  while ((1 << h) - 1 < n)
    h++;
  h--;
  vector<int> a(1 << h), pos(1 << h);
  if (mn == 1) {
    for (int i = h - 1, l = 1; i >= 0; i--, l *= 2) {
      for (int j = i + 1; j <= i + l; j++) {
        if (j != i + 1)
          a[j + l - 1] = a[j];
        a[j] ^= l;
      }
    }
  } else {
    for (int i = 0; i < (1 << h); i++)
      a[i] = (1 << h) - 1 - i;
  }
  for (int i = 0; i < (1 << h); i++)
    pos[a[i]] = i;
  int leaves = n - (1 << h) + 1, val = 1, idx = 0;
  vector<int> arr(n), s(n);
  function<int(int)> build = [&](int k) {
    if (k - 1 >= (1 << h) - 1) {
      if (pos[k - (1 << h)] < leaves) {
        arr[idx] = val++;
        return s[idx++] = 1;
      }
      return 0;
    }
    int ret = build(2 * k + !mn);
    int tmp = idx++;
    ret += build(2 * k + mn);
    arr[tmp] = val++;
    return s[tmp] = ++ret;
  };
  build(1);
  if (mn == 0) {
    reverse(arr.begin(), arr.end());
    reverse(s.begin(), s.end());
  }
  int ok = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] > 22) {
      assert(s[i] <= 39);
      dfs(0, s[i], x, mn);
      int j = i;
      while (j >= 0 && arr[j] <= arr[i])
        j--;
      j++;
      vector<int> tmp;
      for (int k = j; k < n; k++)
        tmp.push_back(arr[k]);
      sort(all(tmp));
      for (int k = j; k < n; k++)
        arr[k] = tmp[cur[k - j] - 1];
      ok = 1;
      break;
    }
  }
  if (ok == 0) {
    dfs(0, n, x, mn);
    for (int i = 0; i < n; i++)
      arr[i] = cur[i];
  }
  if (x > 0) {
    cout << "-1\n";
  } else {
    for (int i = 0; i < n; i++)
     cout << arr[i] << " \n"[i + 1 == n];
  }
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n; ll x, y; cin >> n >> x >> y;
  prep();
  solve(n, x, 1);
  for (int i = 0; i < N; i++)
    cur[i] = vis[i] = 0;
  solve(n, y, 0);
}


/*
build a cartesian tree. permutation is balanced iff this tree is almost complete.
Observe that #balanced_permutations > 10^18 for n > 22 -> build greedily the lex-min/max
and brute force the last subtree with > 22 nodes (size <= 39). Use dp to optimize.
*/

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3624kb

input:

3 1 2

output:

1 3 2
1 3 2

result:

ok 6 numbers

Test #2:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

4 9 13

output:

3 1 4 2
-1

result:

ok 5 number(s): "3 1 4 2 -1"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

4 20 7

output:

-1
2 3 4 1

result:

ok 5 number(s): "-1 2 3 4 1"

Test #4:

score: 0
Accepted
time: 13ms
memory: 4688kb

input:

99500 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199000 numbers

Test #5:

score: 0
Accepted
time: 3ms
memory: 4696kb

input:

99500 40467622443163494 495971246876580853

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199000 numbers

Test #6:

score: 0
Accepted
time: 13ms
memory: 4648kb

input:

99600 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199200 numbers

Test #7:

score: 0
Accepted
time: 13ms
memory: 4572kb

input:

99600 876080080810139630 528446840542737495

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199200 numbers

Test #8:

score: 0
Accepted
time: 13ms
memory: 4628kb

input:

99700 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199400 numbers

Test #9:

score: 0
Accepted
time: 13ms
memory: 4628kb

input:

99700 711692547767050359 156213023658572307

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199400 numbers

Test #10:

score: 0
Accepted
time: 8ms
memory: 4596kb

input:

99800 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199600 numbers

Test #11:

score: 0
Accepted
time: 13ms
memory: 4692kb

input:

99800 547305006134026495 783979211069374416

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199600 numbers

Test #12:

score: 0
Accepted
time: 10ms
memory: 4636kb

input:

99900 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199800 numbers

Test #13:

score: 0
Accepted
time: 12ms
memory: 4648kb

input:

99900 382917468795969927 188373361625400717

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199800 numbers

Test #14:

score: 0
Accepted
time: 6ms
memory: 4688kb

input:

100000 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 200000 numbers

Test #15:

score: 0
Accepted
time: 13ms
memory: 4956kb

input:

100000 527271021985658374 940151335561648448

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 200000 numbers

Test #16:

score: 0
Accepted
time: 5ms
memory: 3872kb

input:

24999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 49998 numbers

Test #17:

score: 0
Accepted
time: 4ms
memory: 3820kb

input:

24999 136771156689394005 924256336536334059

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 49998 numbers

Test #18:

score: 0
Accepted
time: 5ms
memory: 3920kb

input:

29999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 59998 numbers

Test #19:

score: 0
Accepted
time: 2ms
memory: 3976kb

input:

29999 275583998678440849 312380694035658334

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 59998 numbers

Test #20:

score: 0
Accepted
time: 3ms
memory: 3896kb

input:

34999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 69998 numbers

Test #21:

score: 0
Accepted
time: 8ms
memory: 4080kb

input:

34999 541165311540387602 981345461923895956

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 69998 numbers

Test #22:

score: 0
Accepted
time: 6ms
memory: 3988kb

input:

39999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 79998 numbers

Test #23:

score: 0
Accepted
time: 6ms
memory: 4124kb

input:

39999 903350181794275662 369469819423220230

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 79998 numbers

Test #24:

score: 0
Accepted
time: 3ms
memory: 3988kb

input:

44999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 89998 numbers

Test #25:

score: 0
Accepted
time: 7ms
memory: 3932kb

input:

44999 168931494656222415 261806619871266364

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 89998 numbers

Test #26:

score: 0
Accepted
time: 7ms
memory: 4048kb

input:

49999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 99998 numbers

Test #27:

score: 0
Accepted
time: 7ms
memory: 3948kb

input:

49999 531116369205077770 649930977370590638

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 99998 numbers

Test #28:

score: 0
Accepted
time: 7ms
memory: 3992kb

input:

54999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 109998 numbers

Test #29:

score: 0
Accepted
time: 8ms
memory: 4352kb

input:

54999 796697677772057227 318895740963860964

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 109998 numbers

Test #30:

score: 0
Accepted
time: 8ms
memory: 3992kb

input:

59999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 119998 numbers

Test #31:

score: 0
Accepted
time: 9ms
memory: 4016kb

input:

59999 930392135317961046 514344917370708985

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 119998 numbers

Test #32:

score: 0
Accepted
time: 9ms
memory: 4108kb

input:

64999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 129998 numbers

Test #33:

score: 0
Accepted
time: 9ms
memory: 4128kb

input:

64999 424463865182859336 599356898911231372

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 129998 numbers

Test #34:

score: 0
Accepted
time: 10ms
memory: 4464kb

input:

69999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 139998 numbers

Test #35:

score: 0
Accepted
time: 10ms
memory: 4512kb

input:

69999 563276707171906180 987481256410555646

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 139998 numbers

Test #36:

score: 0
Accepted
time: 10ms
memory: 4460kb

input:

74999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 149998 numbers

Test #37:

score: 0
Accepted
time: 10ms
memory: 4652kb

input:

74999 828858015738885637 879818061153569076

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 149998 numbers

Test #38:

score: 0
Accepted
time: 11ms
memory: 4416kb

input:

79999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 159998 numbers

Test #39:

score: 0
Accepted
time: 7ms
memory: 4444kb

input:

79999 191042890287740993 267942410062958759

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 159998 numbers

Test #40:

score: 0
Accepted
time: 11ms
memory: 4408kb

input:

84999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 169998 numbers

Test #41:

score: 0
Accepted
time: 11ms
memory: 4772kb

input:

84999 456624198854720450 936907177951196380

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 169998 numbers

Test #42:

score: 0
Accepted
time: 8ms
memory: 4440kb

input:

89999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 179998 numbers

Test #43:

score: 0
Accepted
time: 8ms
memory: 4412kb

input:

89999 818809073403575806 325031535450520655

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 179998 numbers

Test #44:

score: 0
Accepted
time: 9ms
memory: 4432kb

input:

94999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 189998 numbers

Test #45:

score: 0
Accepted
time: 13ms
memory: 4448kb

input:

94999 84390386265522559 217368340193534085

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 189998 numbers

Test #46:

score: 0
Accepted
time: 13ms
memory: 4636kb

input:

99999 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199998 numbers

Test #47:

score: 0
Accepted
time: 13ms
memory: 4592kb

input:

99999 223203228254569402 605492693397891063

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 199998 numbers

Test #48:

score: 0
Accepted
time: 9ms
memory: 3544kb

input:

35 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 23 11 12 10 20 9 15 14 35 18 25 16 30 21 13 27 22 34 29 31 26 19 33 24 28 32 17
31 32 30 33 28 29 27 34 24 25 22 26 3 10 12 9 11 35 4 8 15 1 20 6 19 14 23 17 18 5 2 21 7 16 13

result:

ok 70 numbers

Test #49:

score: 0
Accepted
time: 7ms
memory: 3556kb

input:

35 511704785331017757 621033432375162630

output:

1 2 4 3 8 5 7 6 22 12 17 15 21 10 14 18 11 35 20 29 24 30 19 25 13 34 26 23 27 9 33 31 16 32 28
31 32 30 33 28 29 27 34 24 25 23 4 26 6 13 7 35 16 14 18 17 20 3 10 12 9 22 8 15 1 21 2 5 19 11

result:

ok 70 numbers

Test #50:

score: 0
Accepted
time: 10ms
memory: 3668kb

input:

36 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 20 9 17 14 19 11 18 10 36 15 32 12 33 30 21 34 16 23 13 35 28 29 27 31 25 26 24 22
32 33 31 34 29 30 28 35 25 26 24 27 18 5 22 12 36 9 17 1 21 7 11 20 14 15 23 13 16 3 2 19 4 6 10 8

result:

ok 72 numbers

Test #51:

score: 0
Accepted
time: 14ms
memory: 3548kb

input:

36 784783501880360048 944159764336367242

output:

1 2 4 3 8 5 7 6 20 9 11 10 18 14 17 16 13 36 29 30 19 33 22 15 27 23 21 35 25 32 12 34 28 31 26 24
32 33 31 34 29 30 28 35 25 26 24 27 18 12 23 22 36 5 1 11 10 20 2 13 14 7 6 21 3 15 8 19 4 9 17 16

result:

ok 72 numbers

Test #52:

score: 0
Accepted
time: 26ms
memory: 3604kb

input:

37 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 18 9 15 12 17 14 16 10 37 24 27 13 23 33 20 11 30 22 36 21 32 25 35 31 29 34 26 28 19
33 34 32 35 30 31 29 36 26 27 25 28 23 16 24 5 37 4 10 8 6 19 13 2 15 7 22 14 9 20 17 21 1 3 18 11 12

result:

ok 74 numbers

Test #53:

score: 0
Accepted
time: 17ms
memory: 3600kb

input:

37 281234255284478147 779772222703343379

output:

1 2 4 3 8 5 7 6 17 10 15 11 16 12 14 13 37 18 22 25 21 35 32 23 34 27 36 28 30 31 9 24 19 33 20 29 26
33 34 32 35 30 31 29 36 26 27 25 28 23 21 24 16 37 12 15 18 6 19 1 13 11 9 22 7 14 4 3 20 2 5 17 10 8

result:

ok 74 numbers

Test #54:

score: 0
Accepted
time: 28ms
memory: 3548kb

input:

38 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 17 9 11 10 16 14 15 12 13 38 26 33 34 19 23 36 18 30 25 27 37 20 31 21 35 24 32 28 29 22
34 35 33 36 31 32 30 37 27 28 26 29 24 25 21 17 38 16 19 4 3 22 8 2 20 1 18 9 23 12 14 6 15 5 7 13 10 11

result:

ok 76 numbers

Test #55:

score: 0
Accepted
time: 33ms
memory: 3504kb

input:

38 554312976128787734 615384685365286811

output:

1 2 4 3 8 5 7 6 16 11 13 12 15 10 14 9 38 31 33 21 32 19 36 29 27 35 23 18 37 28 22 30 17 34 24 25 26 20
34 35 33 36 31 32 30 37 27 28 26 29 24 25 22 15 38 8 4 9 1 20 6 17 16 10 23 2 14 12 19 7 11 21 3 13 18 5

result:

ok 76 numbers

Test #56:

score: 0
Accepted
time: 53ms
memory: 3560kb

input:

39 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 13 10 15 12 14 11 39 21 30 22 19 36 23 34 18 33 38 28 31 35 20 32 27 37 26 29 24 25 17
35 36 34 37 32 33 31 38 28 29 27 30 25 26 24 39 5 7 6 19 10 14 3 16 11 13 9 23 15 17 4 12 2 22 1 8 21 18 20

result:

ok 78 numbers

Test #57:

score: 0
Accepted
time: 35ms
memory: 3596kb

input:

39 827391692678130025 450997143732262947

output:

1 2 4 3 8 5 7 6 16 9 13 10 15 11 14 12 39 18 17 27 19 23 33 22 26 20 38 28 25 36 30 37 24 31 29 35 21 34 32
35 36 34 37 32 33 31 38 28 29 27 30 25 26 24 39 11 5 13 3 12 10 22 19 20 2 23 8 4 16 7 6 21 1 17 9 18 15 14

result:

ok 78 numbers

Test #58:

score: 0
Accepted
time: 24ms
memory: 3552kb

input:

40 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 40 27 29 36 22 26 38 23 21 33 30 32 19 39 34 31 35 25 37 18 24 28 20 17
36 37 35 38 33 34 32 39 29 30 28 31 26 27 25 40 16 20 22 19 18 23 2 13 1 21 9 24 12 14 6 15 11 8 17 3 4 10 5 7

result:

ok 80 numbers

Test #59:

score: 0
Accepted
time: 12ms
memory: 3544kb

input:

40 211339265697552204 758247565352450609

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 40 19 20 34 22 23 38 21 17 31 25 29 39 18 35 36 30 33 28 37 26 32 27 24
36 37 35 38 33 34 32 39 29 30 28 31 26 27 25 40 17 18 5 20 2 19 21 3 11 10 1 24 12 4 22 8 15 7 23 13 16 9 14 6

result:

ok 80 numbers

Test #60:

score: 0
Accepted
time: 11ms
memory: 3660kb

input:

41 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 41 18 22 21 38 29 32 24 39 31 23 34 19 26 40 30 36 25 17 37 33 35 27 28 20
37 38 36 39 34 35 33 40 30 31 29 32 27 28 26 41 21 1 22 6 13 5 24 12 14 20 9 19 10 25 16 15 18 4 17 3 23 2 7 11 8

result:

ok 82 numbers

Test #61:

score: 0
Accepted
time: 7ms
memory: 3548kb

input:

41 707790023396637599 593860028014394042

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 41 17 33 35 18 28 39 31 30 32 20 23 22 40 26 29 19 27 38 24 36 37 21 34 25
37 38 36 39 34 35 33 40 30 31 29 32 27 28 26 41 21 16 22 8 18 4 23 11 13 17 2 15 25 10 19 1 20 7 9 24 12 5 14 3 6

result:

ok 82 numbers

Test #62:

score: 0
Accepted
time: 8ms
memory: 3544kb

input:

42 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 42 17 22 37 24 35 31 38 23 28 27 33 19 26 41 29 32 30 36 25 40 18 34 39 20 21
38 39 37 40 35 36 34 41 31 32 30 33 28 29 27 42 23 9 24 5 7 3 25 15 18 17 22 13 19 26 8 10 14 1 11 4 21 2 6 20 12 16

result:

ok 84 numbers

Test #63:

score: 0
Accepted
time: 8ms
memory: 3548kb

input:

42 980868739945979890 429472486381370178

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 42 17 22 36 23 28 39 30 35 27 32 25 41 29 33 38 24 37 34 40 20 21 31 19 26 18
38 39 37 40 35 36 34 41 31 32 30 33 28 29 27 42 23 19 24 7 22 18 25 11 16 5 17 6 10 26 12 4 15 8 9 2 21 13 1 20 3 14

result:

ok 84 numbers

Test #64:

score: 0
Accepted
time: 3ms
memory: 3624kb

input:

43 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 43 17 19 26 18 39 28 32 36 27 34 21 42 24 25 40 33 35 29 41 31 37 30 38 22 23 20
39 40 38 41 36 37 35 42 32 33 31 34 29 30 28 43 24 22 25 12 13 6 26 9 10 4 21 15 19 5 27 8 11 17 1 14 3 23 2 7 20 16 18

result:

ok 86 numbers

Test #65:

score: 0
Accepted
time: 4ms
memory: 3552kb

input:

43 253947460790289477 265084949043313610

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 43 17 18 33 28 22 40 19 24 21 39 23 35 26 42 25 36 31 32 29 41 37 30 38 20 34 27
39 40 38 41 36 37 35 42 32 33 31 34 29 30 28 43 24 25 11 21 18 26 14 17 6 22 12 7 27 10 15 3 16 4 13 8 23 9 19 20 1 5 2

result:

ok 86 numbers

Test #66:

score: 0
Accepted
time: 5ms
memory: 3600kb

input:

44 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 44 17 18 34 25 33 29 40 30 37 26 27 22 43 21 28 19 41 36 35 42 32 38 31 39 23 24 20
40 41 39 42 37 38 36 43 33 34 32 35 30 31 29 44 25 26 5 19 18 27 1 22 15 23 8 14 11 28 9 7 13 4 6 2 24 3 12 10 21 16 20 17

result:

ok 88 numbers

Test #67:

score: 0
Accepted
time: 4ms
memory: 3624kb

input:

44 527026173044664473 100697407410289747

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 44 17 18 32 19 29 26 41 27 28 25 39 38 23 43 24 35 30 40 34 37 42 33 20 36 21 31 22
40 41 39 42 37 38 36 43 33 34 32 35 30 31 29 44 25 26 19 24 12 27 20 1 23 8 11 6 28 9 10 4 21 13 18 5 22 2 16 3 17 14 15 7

result:

ok 88 numbers

Test #68:

score: 0
Accepted
time: 4ms
memory: 3672kb

input:

45 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 45 17 18 31 23 22 43 24 36 35 42 28 40 25 44 26 27 39 33 34 29 41 32 37 30 38 20 21 19
41 42 40 43 38 39 37 44 34 35 33 36 31 32 30 45 26 27 5 20 18 28 1 23 15 24 8 16 11 29 9 10 7 14 4 6 2 25 3 13 12 22 17 21 19

result:

ok 90 numbers

Test #69:

score: 0
Accepted
time: 3ms
memory: 3560kb

input:

45 23476930743749868 936309870072233179

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 45 17 18 23 21 20 40 34 35 29 39 19 31 44 22 27 24 42 28 30 26 43 32 37 25 41 36 38 33
41 42 40 43 38 39 37 44 34 35 33 36 31 32 30 45 26 27 6 17 12 28 10 11 2 14 8 13 1 29 20 23 7 24 18 21 9 25 4 5 3 22 16 19 15

result:

ok 90 numbers

Test #70:

score: 0
Accepted
time: 3ms
memory: 3552kb

input:

46 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 46 17 18 30 22 23 44 19 38 32 41 28 40 39 45 25 27 26 42 34 35 29 43 33 36 31 37 21 24 20
42 43 41 44 39 40 38 45 35 36 34 37 32 33 31 46 27 26 28 5 20 18 29 1 23 15 24 8 16 11 30 9 10 7 14 4 6 2 25 3 13 12 22 17 21 19

result:

ok 92 numbers

Test #71:

score: 0
Accepted
time: 3ms
memory: 3556kb

input:

46 296555651588059455 771922328439209315

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 46 17 18 27 22 24 21 41 28 32 19 40 29 25 45 26 31 23 43 36 39 33 44 20 38 34 42 30 37 35
42 43 41 44 39 40 38 45 35 36 34 37 32 33 31 46 27 26 28 8 19 14 29 2 23 6 25 3 12 1 30 5 20 18 21 13 15 7 24 10 16 4 22 11 17 9

result:

ok 92 numbers

Test #72:

score: 0
Accepted
time: 2ms
memory: 3556kb

input:

47 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 47 17 18 31 22 24 23 45 19 39 33 42 29 41 40 46 26 28 27 43 35 36 30 44 34 37 32 38 21 25 20
43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 47 27 28 26 29 5 20 18 30 1 23 15 24 8 16 11 31 9 10 7 14 4 6 2 25 3 13 12 22 17 21 19

result:

ok 94 numbers

Test #73:

score: 0
Accepted
time: 2ms
memory: 3612kb

input:

47 569634368137401746 607534791101152748

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 47 17 18 30 19 22 20 42 21 32 26 40 35 36 27 46 39 41 28 44 24 34 31 45 33 38 23 43 29 37 25
43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 47 27 28 26 29 10 22 20 30 11 17 14 21 18 19 5 31 15 16 13 24 6 9 2 25 4 12 3 23 1 8 7

result:

ok 94 numbers

Test #74:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

48 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 48 17 19 18 32 23 25 24 46 20 40 34 43 30 42 41 47 27 29 28 44 36 37 31 45 35 38 33 39 22 26 21
44 45 43 46 41 42 40 47 37 38 36 39 34 35 33 32 48 27 28 26 29 5 20 18 30 1 23 15 24 8 16 11 31 9 10 7 14 4 6 2 25 3 13 12 22 17 21 19

result:

ok 96 numbers

Test #75:

score: 0
Accepted
time: 1ms
memory: 3552kb

input:

48 66085125836487141 443147253763096180

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 48 17 19 18 27 20 25 21 46 23 41 36 43 35 37 32 47 28 33 22 44 24 42 29 45 30 31 26 40 34 39 38
44 45 43 46 41 42 40 47 37 38 36 39 34 35 33 32 48 27 28 26 29 13 16 5 30 4 10 8 21 9 17 15 31 12 18 3 22 19 20 2 25 11 14 6 24 1 23 7

result:

ok 96 numbers

Test #76:

score: 0
Accepted
time: 2ms
memory: 3604kb

input:

49 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 17 9 10 12 11 16 13 15 14 49 18 20 19 33 24 26 25 47 21 41 35 44 31 43 42 48 28 30 29 45 37 38 32 46 36 39 34 40 23 27 22
45 46 44 47 42 43 41 48 38 39 37 40 35 36 33 34 32 49 27 28 26 29 5 20 18 30 1 23 15 24 8 16 11 31 9 10 7 14 4 6 2 25 3 13 12 22 17 21 19

result:

ok 98 numbers

Test #77:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

49 339163842385829432 278759716425039612

output:

1 2 4 3 8 5 7 6 17 9 10 12 11 16 13 15 14 49 18 20 19 30 26 29 21 47 22 33 27 44 39 42 38 48 23 41 40 45 25 43 32 46 34 36 35 37 28 31 24
45 46 44 47 42 43 41 48 38 39 37 40 35 36 33 34 32 49 27 28 26 29 15 25 8 30 13 17 16 24 5 23 18 31 4 14 11 20 1 10 6 22 9 19 7 21 2 12 3

result:

ok 98 numbers

Test #78:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

50 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 18 9 10 12 11 17 13 14 16 15 50 19 21 20 34 25 27 26 48 22 42 36 45 32 44 43 49 29 31 30 46 38 39 33 47 37 40 35 41 24 28 23
46 47 45 48 43 44 42 49 39 40 38 41 36 35 37 33 34 32 50 27 28 26 29 5 20 18 30 1 23 15 24 8 16 11 31 9 10 7 14 4 6 2 25 3 13 12 22 17 21 19

result:

ok 100 numbers

Test #79:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

50 723111415405251611 586010129455292682

output:

1 2 4 3 8 5 7 6 18 9 10 12 11 17 13 14 16 15 50 19 21 20 33 26 27 25 46 24 40 22 43 31 42 23 49 28 39 36 47 35 38 30 48 29 41 37 45 32 44 34
46 47 45 48 43 44 42 49 39 40 38 41 36 35 37 33 34 32 50 27 28 26 29 11 12 5 30 8 22 15 24 9 14 1 31 16 17 4 18 7 10 6 25 3 21 20 23 2 19 13

result:

ok 100 numbers

Test #80:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

51 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 19 9 10 12 11 18 13 14 17 15 16 51 20 22 21 35 26 28 27 49 23 43 37 46 33 45 44 50 30 32 31 47 39 40 34 48 38 41 36 42 25 29 24
47 48 46 49 44 45 43 50 40 41 39 42 36 37 35 38 33 34 32 51 27 28 26 29 5 20 18 30 1 23 15 24 8 16 11 31 9 10 7 14 4 6 2 25 3 13 12 22 17 21 19

result:

ok 102 numbers

Test #81:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

51 996190136249561198 421622592117236114

output:

1 2 4 3 8 5 7 6 19 9 10 12 11 18 13 14 17 15 16 51 20 22 21 35 26 27 25 46 39 44 37 45 28 31 23 50 30 41 40 43 24 38 36 49 42 47 33 48 32 34 29
47 48 46 49 44 45 43 50 40 41 39 42 36 37 35 38 33 34 32 51 27 28 26 29 13 20 16 30 1 24 3 25 9 18 14 31 7 12 8 21 11 17 4 23 6 15 5 22 2 19 10

result:

ok 102 numbers

Test #82:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

52 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 20 9 10 12 11 19 13 14 18 15 17 16 52 21 23 22 36 27 29 28 50 24 44 38 47 34 46 45 51 31 33 32 48 40 41 35 49 39 42 37 43 26 30 25
48 49 47 50 45 46 44 51 41 42 40 39 43 36 37 35 38 33 34 32 52 27 28 26 29 5 20 18 30 1 23 15 24 8 16 11 31 9 10 7 14 4 6 2 25 3 13 12 22 17 21 19

result:

ok 104 numbers

Test #83:

score: 0
Accepted
time: 1ms
memory: 3552kb

input:

52 269268848503936193 257235054779179547

output:

1 2 4 3 8 5 7 6 20 9 10 12 11 19 13 14 18 15 17 16 52 21 23 22 33 26 28 27 49 34 36 31 43 35 37 25 51 24 46 44 48 29 41 30 50 38 45 32 47 39 42 40
48 49 47 50 45 46 44 51 41 42 40 39 43 36 37 35 38 33 34 32 52 27 28 26 29 16 20 9 30 10 15 2 22 4 14 5 31 6 12 7 23 13 17 3 25 11 21 8 24 18 19 1

result:

ok 104 numbers

Test #84:

score: 0
Accepted
time: 2ms
memory: 3556kb

input:

53 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 21 9 10 12 11 20 13 15 14 19 16 18 17 53 22 24 23 37 28 30 29 51 25 45 39 48 35 47 46 52 32 34 33 49 41 42 36 50 40 43 38 44 27 31 26
49 50 48 51 46 47 45 52 42 43 40 41 39 44 36 37 35 38 33 34 32 53 27 28 26 29 5 20 18 30 1 23 15 24 8 16 11 31 9 10 7 14 4 6 2 25 3 13 12 22 17 21 19

result:

ok 106 numbers

Test #85:

score: 0
Accepted
time: 2ms
memory: 3608kb

input:

53 765719606203021589 92847517441122979

output:

1 2 4 3 8 5 7 6 21 9 10 12 11 20 13 15 14 19 16 18 17 53 22 24 23 36 30 33 27 51 29 42 28 48 32 43 35 52 44 45 38 46 37 41 25 50 39 47 34 49 26 40 31
49 50 48 51 46 47 45 52 42 43 40 41 39 44 36 37 35 38 33 34 32 53 27 28 26 29 20 21 16 30 3 10 1 25 6 22 4 31 2 11 7 23 12 17 13 24 14 15 8 19 9 18 5

result:

ok 106 numbers

Test #86:

score: 0
Accepted
time: 2ms
memory: 3672kb

input:

54 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 22 9 10 13 11 12 21 14 16 15 20 17 19 18 54 23 25 24 38 29 31 30 52 26 46 40 49 36 48 47 53 33 35 34 50 42 43 37 51 41 44 39 45 28 32 27
50 51 49 52 47 48 46 53 43 42 44 40 41 39 45 36 37 35 38 33 34 32 54 27 28 26 29 5 20 18 30 1 23 15 24 8 16 11 31 9 10 7 14 4 6 2 25 3 13 12 22 17 ...

result:

ok 108 numbers

Test #87:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

54 38798322752363880 928459975808099115

output:

1 2 4 3 8 5 7 6 22 9 10 13 11 12 21 14 16 15 20 17 19 18 54 23 25 24 32 27 30 29 46 31 37 35 43 28 38 33 53 36 40 26 51 41 48 42 52 39 49 47 50 44 45 34
50 51 49 52 47 48 46 53 43 42 44 40 41 39 45 36 37 35 38 33 34 32 54 27 28 26 29 6 19 7 30 14 17 16 20 2 11 9 31 15 22 12 23 8 13 3 25 1 10 5 24 18...

result:

ok 108 numbers

Test #88:

score: 0
Accepted
time: 2ms
memory: 3632kb

input:

55 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 23 9 10 14 11 13 12 22 15 17 16 21 18 20 19 55 24 26 25 39 30 32 31 53 27 47 41 50 37 49 48 54 34 36 35 51 43 44 38 52 42 45 40 46 29 33 28
51 52 50 53 48 49 47 54 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 55 27 28 26 29 5 20 18 30 1 23 15 24 8 16 11 31 9 10 7 14 4 6 2 25 3 13 12 ...

result:

ok 110 numbers

Test #89:

score: 0
Accepted
time: 2ms
memory: 3660kb

input:

55 311877043596673467 764072438470042548

output:

1 2 4 3 8 5 7 6 23 9 10 14 11 13 12 22 15 17 16 21 18 20 19 55 24 26 25 36 31 32 28 53 46 50 45 52 44 48 42 54 34 37 30 49 40 43 33 51 29 39 27 47 35 41 38
51 52 50 53 48 49 47 54 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 55 27 28 26 29 8 21 4 30 6 15 13 19 7 18 17 31 10 16 5 22 14 20 3 25 1 23 2...

result:

ok 110 numbers

Test #90:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

56 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 24 9 11 10 15 12 14 13 23 16 18 17 22 19 21 20 56 25 27 26 40 31 33 32 54 28 48 42 51 38 50 49 55 35 37 36 52 44 45 39 53 43 46 41 47 30 34 29
52 53 51 54 49 50 48 47 55 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 56 27 28 26 29 5 20 18 30 1 23 15 24 8 16 11 31 9 10 7 14 4 6 2 25 3 ...

result:

ok 112 numbers

Test #91:

score: 0
Accepted
time: 2ms
memory: 3548kb

input:

56 808327801295758862 599684896837018684

output:

1 2 4 3 8 5 7 6 24 9 11 10 15 12 14 13 23 16 18 17 22 19 21 20 56 25 27 26 39 34 38 36 51 33 40 30 45 31 43 29 55 35 48 46 53 28 52 50 54 42 44 37 49 41 47 32
52 53 51 54 49 50 48 47 55 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 56 27 28 26 29 10 24 4 30 16 20 17 23 6 22 21 31 13 14 3 19 12 18 5 2...

result:

ok 112 numbers

Test #92:

score: 0
Accepted
time: 2ms
memory: 3624kb

input:

57 1000000000000000000 1000000000000000000

output:

1 2 4 3 9 5 6 8 7 25 10 12 11 16 13 15 14 24 17 19 18 23 20 22 21 57 26 28 27 41 32 34 33 55 29 49 43 52 39 51 50 56 36 38 37 53 45 46 40 54 44 47 42 48 31 35 30
53 54 52 55 50 51 48 49 47 56 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 57 27 28 26 29 5 20 18 30 1 23 15 24 8 16 11 31 9 10 7 14 4 6 2...

result:

ok 114 numbers

Test #93:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

57 81406513550133857 435297359498962116

output:

1 2 4 3 9 5 6 8 7 25 10 12 11 16 13 15 14 24 17 19 18 23 20 22 21 57 26 28 27 36 30 34 33 54 35 47 38 52 48 50 45 56 29 49 43 53 39 46 41 55 31 44 40 51 32 42 37
53 54 52 55 50 51 48 49 47 56 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 57 27 28 26 29 13 18 2 30 7 20 11 22 4 15 12 31 9 19 10 24 3 17...

result:

ok 114 numbers

Test #94:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

58 1000000000000000000 1000000000000000000

output:

1 2 4 3 10 5 6 9 7 8 26 11 13 12 17 14 16 15 25 18 20 19 24 21 23 22 58 27 29 28 42 33 35 34 56 30 50 44 53 40 52 51 57 37 39 38 54 46 47 41 55 45 48 43 49 32 36 31
54 55 53 56 51 50 52 48 49 47 57 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 58 27 28 26 29 5 20 18 30 1 23 15 24 8 16 11 31 9 10 7 14...

result:

ok 116 numbers

Test #95:

score: 0
Accepted
time: 1ms
memory: 3544kb

input:

58 354485234394443444 270909817865938253

output:

1 2 4 3 10 5 6 9 7 8 26 11 13 12 17 14 16 15 25 18 20 19 24 21 23 22 58 27 29 28 39 36 38 35 55 31 43 41 49 37 46 32 57 34 52 51 54 40 47 42 56 30 45 33 53 48 50 44
54 55 53 56 51 50 52 48 49 47 57 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 58 27 28 26 29 16 17 11 30 22 23 15 25 8 14 9 31 13 19 7 ...

result:

ok 116 numbers

Test #96:

score: 0
Accepted
time: 2ms
memory: 3592kb

input:

59 1000000000000000000 1000000000000000000

output:

1 2 4 3 11 5 6 10 7 9 8 27 12 14 13 18 15 17 16 26 19 21 20 25 22 24 23 59 28 30 29 43 34 36 35 57 31 51 45 54 41 53 52 58 38 40 39 55 47 48 42 56 46 49 44 50 33 37 32
55 56 54 57 51 52 50 53 48 49 47 58 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 59 27 28 26 29 5 20 18 30 1 23 15 24 8 16 11 31 9 1...

result:

ok 118 numbers

Test #97:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

59 850935992093528839 106522280527881685

output:

1 2 4 3 11 5 6 10 7 9 8 27 12 14 13 18 15 17 16 26 19 21 20 25 22 24 23 59 28 30 29 42 40 41 37 57 31 39 35 55 48 52 36 58 33 47 43 54 32 38 34 56 45 51 50 53 44 49 46
55 56 54 57 51 52 50 53 48 49 47 58 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 59 27 28 26 29 19 24 15 30 8 10 5 17 14 16 7 31 9 2...

result:

ok 118 numbers

Test #98:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

60 1000000000000000000 1000000000000000000

output:

1 2 4 3 12 5 7 6 11 8 10 9 28 13 15 14 19 16 18 17 27 20 22 21 26 23 25 24 60 29 31 30 44 35 37 36 58 32 52 46 55 42 54 53 59 39 41 40 56 48 49 43 57 47 50 45 51 34 38 33
56 57 55 54 58 51 52 50 53 48 49 47 59 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 60 27 28 26 29 5 20 18 30 1 23 15 24 8 16 11 ...

result:

ok 120 numbers

Test #99:

score: 0
Accepted
time: 1ms
memory: 3556kb

input:

60 11511523963207914 413772697853102051

output:

1 2 4 3 12 5 7 6 11 8 10 9 28 13 15 14 19 16 18 17 27 20 22 21 26 23 25 24 60 29 31 30 37 32 36 33 56 44 45 38 52 35 47 43 59 46 51 40 57 39 50 42 58 53 54 34 55 48 49 41
56 57 55 54 58 51 52 50 53 48 49 47 59 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 60 27 28 26 29 13 22 4 30 5 15 11 24 10 20 3 ...

result:

ok 120 numbers

Test #100:

score: 0
Accepted
time: 2ms
memory: 3556kb

input:

61 1000000000000000000 1000000000000000000

output:

1 2 5 3 4 13 6 8 7 12 9 11 10 29 14 16 15 20 17 19 18 28 21 23 22 27 24 26 25 61 30 32 31 45 36 38 37 59 33 53 47 56 43 55 54 60 40 42 41 57 49 50 44 58 48 51 46 52 35 39 34
57 58 55 56 54 59 51 52 50 53 48 49 47 60 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 61 27 28 26 29 5 20 18 30 1 23 15 24 8 ...

result:

ok 122 numbers

Test #101:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

61 507962281662293309 249385160515045483

output:

1 2 5 3 4 13 6 8 7 12 9 11 10 29 14 16 15 20 17 19 18 28 21 23 22 27 24 26 25 61 30 32 31 43 37 42 41 58 45 53 48 54 33 50 34 60 39 55 38 57 46 56 35 59 40 49 44 52 36 51 47
57 58 55 56 54 59 51 52 50 53 48 49 47 60 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 61 27 28 26 29 16 21 18 30 12 22 7 24 1...

result:

ok 122 numbers

Test #102:

score: 0
Accepted
time: 2ms
memory: 3616kb

input:

62 1000000000000000000 1000000000000000000

output:

1 2 6 3 5 4 14 7 9 8 13 10 12 11 30 15 17 16 21 18 20 19 29 22 24 23 28 25 27 26 62 31 33 32 46 37 39 38 60 34 54 48 57 44 56 55 61 41 43 42 58 50 51 45 59 49 52 47 53 36 40 35
58 57 59 55 56 54 60 51 52 50 53 48 49 47 61 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 62 27 28 26 29 5 20 18 30 1 23 15...

result:

ok 124 numbers

Test #103:

score: 0
Accepted
time: 1ms
memory: 3556kb

input:

62 781040998211635600 84997618882021619

output:

1 2 6 3 5 4 14 7 9 8 13 10 12 11 30 15 17 16 21 18 20 19 29 22 24 23 28 25 27 26 62 31 33 32 45 39 44 40 59 42 43 35 57 50 51 47 61 36 52 38 58 48 56 41 60 53 54 49 55 37 46 34
58 57 59 55 56 54 60 51 52 50 53 48 49 47 61 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 62 27 28 26 29 20 23 3 30 6 18 4 ...

result:

ok 124 numbers

Test #104:

score: 0
Accepted
time: 2ms
memory: 3632kb

input:

63 1000000000000000000 1000000000000000000

output:

1 3 2 7 4 6 5 15 8 10 9 14 11 13 12 31 16 18 17 22 19 21 20 30 23 25 24 29 26 28 27 63 32 34 33 47 38 40 39 61 35 55 49 58 45 57 56 62 42 44 43 59 51 52 46 60 50 53 48 54 37 41 36
58 59 57 60 55 56 54 61 51 52 50 53 48 49 47 62 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 63 27 28 26 29 5 20 18 30 1...

result:

ok 126 numbers

Test #105:

score: 0
Accepted
time: 1ms
memory: 3552kb

input:

63 54119719055945188 920610081543965052

output:

1 3 2 7 4 6 5 15 8 10 9 14 11 13 12 31 16 18 17 22 19 21 20 30 23 25 24 29 26 28 27 63 32 34 33 41 38 40 35 61 45 46 43 57 37 54 44 62 36 51 47 59 52 58 55 60 49 53 42 56 48 50 39
58 59 57 60 55 56 54 61 51 52 50 53 48 49 47 62 43 44 42 45 40 41 39 46 36 37 35 38 33 34 32 63 27 28 26 29 6 20 16 30 2...

result:

ok 126 numbers

Test #106:

score: 0
Accepted
time: 1ms
memory: 3668kb

input:

64 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 48 39 41 40 62 36 56 50 59 46 58 57 63 43 45 44 60 52 53 47 61 51 54 49 55 38 42 37
59 60 58 61 56 57 55 62 52 53 51 54 49 50 48 63 44 45 43 46 41 42 40 47 37 38 36 39 34 35 33 64 28 29 27 30 25 26 8 5...

result:

ok 128 numbers

Test #107:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

64 550570468165095991 756222544205908484

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 46 43 44 38 56 37 50 41 52 36 51 48 63 53 60 54 61 40 59 55 62 47 57 49 58 39 45 42
59 60 58 61 56 57 55 62 52 53 51 54 49 50 48 63 44 45 43 46 41 42 40 47 37 38 36 39 34 35 33 64 28 29 27 30 25 26 12 ...

result:

ok 128 numbers

Test #108:

score: 0
Accepted
time: 3ms
memory: 3588kb

input:

65 1000000000000000000 1000000000000000000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 65 33 34 36 35 49 40 42 41 63 37 57 51 60 47 59 58 64 44 46 45 61 53 54 48 62 52 55 50 56 39 43 38
60 61 59 62 57 58 56 63 53 54 52 55 50 51 49 64 45 46 44 47 42 43 41 48 38 39 37 40 35 36 34 65 29 30 28 31 26 27 ...

result:

ok 130 numbers

Test #109:

score: 0
Accepted
time: 4ms
memory: 3556kb

input:

65 823649189009405578 591835006867851916

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 65 33 34 36 35 48 44 47 37 63 56 59 58 60 51 54 39 64 38 49 40 57 43 55 42 62 46 53 52 61 45 50 41
60 61 59 62 57 58 56 63 53 54 52 55 50 51 49 64 45 46 44 47 42 43 41 48 38 39 37 40 35 36 34 65 29 30 28 31 26 27 ...

result:

ok 130 numbers

Test #110:

score: 0
Accepted
time: 1ms
memory: 3556kb

input:

4 3 4

output:

1 4 2 3
3 1 4 2

result:

ok 8 numbers

Test #111:

score: 0
Accepted
time: 1ms
memory: 3496kb

input:

4 12 12

output:

3 4 2 1
1 2 4 3

result:

ok 8 numbers

Test #112:

score: 0
Accepted
time: 1ms
memory: 3660kb

input:

5 6 33

output:

1 4 2 5 3
1 4 5 2 3

result:

ok 10 numbers

Test #113:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

5 38 37

output:

4 3 5 2 1
1 3 5 2 4

result:

ok 10 numbers

Test #114:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

6 21 12

output:

2 1 6 3 5 4
4 5 3 6 1 2

result:

ok 12 numbers

Test #115:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

6 81 78

output:

-1
1 3 2 6 4 5

result:

ok 7 numbers

Test #116:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

7 44 67

output:

3 4 2 7 5 6 1
1 6 2 7 4 5 3

result:

ok 14 numbers

Test #117:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

7 77 81

output:

5 6 3 7 1 4 2
-1

result:

ok 8 numbers

Test #118:

score: 0
Accepted
time: 1ms
memory: 3556kb

input:

8 742 1483

output:

3 4 2 8 5 6 7 1
1 6 4 2 8 5 7 3

result:

ok 16 numbers

Test #119:

score: 0
Accepted
time: 1ms
memory: 3588kb

input:

8 1680 1679

output:

6 7 5 8 3 4 2 1
1 2 4 3 8 6 7 5

result:

ok 16 numbers

Test #120:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

9 7823 23407

output:

3 5 7 2 9 6 1 8 4
-1

result:

ok 10 numbers

Test #121:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

9 19038 19039

output:

7 8 6 9 4 3 5 2 1
1 2 4 3 9 5 7 8 6

result:

ok 18 numbers

Test #122:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

10 88137 71300

output:

4 9 6 2 10 5 3 8 1 7
4 6 2 5 10 1 7 9 8 3

result:

ok 20 numbers

Test #123:

score: 0
Accepted
time: 1ms
memory: 3556kb

input:

10 147838 147840

output:

8 9 7 10 5 3 6 2 4 1
1 2 4 3 10 5 6 9 7 8

result:

ok 20 numbers

Test #124:

score: 0
Accepted
time: 1ms
memory: 3548kb

input:

11 500999 976865

output:

5 6 1 10 2 8 3 11 4 9 7
-1

result:

ok 12 numbers

Test #125:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

11 844799 844802

output:

9 10 8 11 5 6 4 7 1 3 2
-1

result:

ok 12 numbers

Test #126:

score: 0
Accepted
time: 1ms
memory: 3548kb

input:

12 1481085 4208914

output:

4 3 10 2 5 1 12 6 8 11 9 7
-1

result:

ok 13 numbers

Test #127:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

12 3590397 3590402

output:

10 11 9 8 12 5 6 3 7 1 4 2
-1

result:

ok 13 numbers

Test #128:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

13 13128300 7093900

output:

-1
3 10 2 12 1 11 9 13 5 8 4 7 6

result:

ok 14 numbers

Test #129:

score: 0
Accepted
time: 1ms
memory: 3548kb

input:

13 10982400 10982399

output:

11 12 9 10 8 13 5 6 4 7 2 3 1
1 2 5 3 4 13 6 8 7 12 10 11 9

result:

ok 26 numbers

Test #130:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

14 21649632 23249635

output:

11 12 6 13 5 1 14 3 8 7 10 4 9 2
-1

result:

ok 15 numbers

Test #131:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

14 21964798 21964801

output:

12 11 13 9 10 8 14 5 6 3 7 2 4 1
-1

result:

ok 15 numbers

Test #132:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

15 13637410 16693144

output:

6 8 4 12 9 10 3 15 5 11 7 14 2 13 1
2 12 11 14 5 13 6 15 4 9 8 10 1 7 3

result:

ok 30 numbers

Test #133:

score: 0
Accepted
time: 1ms
memory: 3548kb

input:

15 21964800 21964800

output:

12 13 11 14 9 10 8 15 5 6 4 7 2 3 1
1 3 2 7 4 6 5 15 8 10 9 14 11 13 12

result:

ok 30 numbers

Test #134:

score: 0
Accepted
time: 1ms
memory: 3660kb

input:

16 2116113626 480332813

output:

-1
7 13 10 14 2 6 12 8 16 5 11 3 15 4 9 1

result:

ok 17 numbers

Test #135:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

16 1729728000 1729727998

output:

13 14 12 15 10 11 9 16 6 7 5 8 3 4 2 1
1 2 4 3 8 5 7 6 16 9 12 10 15 11 14 13

result:

ok 32 numbers

Test #136:

score: 0
Accepted
time: 3ms
memory: 3660kb

input:

17 61448680459 63697469831

output:

10 12 13 2 16 6 11 4 7 17 8 9 1 15 3 14 5
2 3 1 15 6 9 5 17 10 7 12 4 11 16 13 14 8

result:

ok 34 numbers

Test #137:

score: 0
Accepted
time: 3ms
memory: 3580kb

input:

17 71175103999 71175104001

output:

14 15 13 16 11 12 10 17 7 8 6 9 4 5 1 3 2
-1

result:

ok 18 numbers

Test #138:

score: 0
Accepted
time: 2ms
memory: 3608kb

input:

18 1800888941091 1301439923651

output:

11 15 10 8 17 4 16 9 18 1 7 13 2 3 14 5 12 6
4 14 1 16 12 8 15 2 13 11 18 5 9 6 17 7 10 3

result:

ok 36 numbers

Test #139:

score: 0
Accepted
time: 5ms
memory: 3540kb

input:

18 2015248435198 2015248435201

output:

15 16 14 17 12 13 11 18 8 9 7 10 5 3 6 2 4 1
-1

result:

ok 19 numbers

Test #140:

score: 0
Accepted
time: 2ms
memory: 3548kb

input:

19 11794830056134 17670348826098

output:

4 3 15 11 7 17 1 8 6 19 12 16 13 18 10 2 14 9 5
8 1 11 5 18 3 10 12 9 7 19 2 14 13 17 15 4 16 6

result:

ok 38 numbers

Test #141:

score: 0
Accepted
time: 8ms
memory: 3664kb

input:

19 43663840563202 43663840563199

output:

-1
1 2 4 3 8 5 7 6 19 9 10 12 11 18 13 14 17 16 15

result:

ok 20 numbers

Test #142:

score: 0
Accepted
time: 9ms
memory: 3552kb

input:

20 410635252089580 51822920104791

output:

7 14 5 19 15 8 18 11 13 10 20 3 12 2 1 17 4 9 16 6
14 11 16 9 18 3 12 8 15 1 20 13 6 17 4 19 2 7 10 5

result:

ok 40 numbers

Test #143:

score: 0
Accepted
time: 17ms
memory: 3588kb

input:

20 763552502169602 763552502169602

output:

-1
-1

result:

ok 2 number(s): "-1 -1"

Test #144:

score: 0
Accepted
time: 21ms
memory: 3616kb

input:

21 5853385131713636 10455056956103738

output:

7 18 5 13 6 20 15 11 19 17 16 21 8 12 3 10 14 4 2 9 1
1 15 4 18 10 12 11 16 6 21 3 17 2 14 8 20 9 5 19 7 13

result:

ok 42 numbers

Test #145:

score: 0
Accepted
time: 26ms
memory: 3584kb

input:

21 11097307357593598 11097307357593599

output:

18 19 17 20 15 16 14 21 11 12 9 10 8 13 5 6 3 7 2 4 1
1 2 4 3 8 5 7 6 21 9 10 12 11 20 13 15 14 19 17 18 16

result:

ok 42 numbers

Test #146:

score: 0
Accepted
time: 17ms
memory: 3668kb

input:

22 56829646874130118 15004223689160141

output:

6 15 3 13 21 7 8 4 19 12 10 22 1 17 14 18 11 20 9 5 16 2
14 17 4 20 2 12 13 11 9 22 6 10 8 18 15 3 21 7 16 5 19 1

result:

ok 44 numbers

Test #147:

score: 0
Accepted
time: 39ms
memory: 3544kb

input:

22 136209525264384001 136209525264384000

output:

-1
1 2 4 3 8 5 7 6 22 9 10 13 11 12 21 14 16 15 20 17 19 18

result:

ok 23 numbers

Test #148:

score: 0
Accepted
time: 23ms
memory: 3604kb

input:

40 993786706455628800 1

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 40 27 28 37 36 38 34 35 33 39 30 29 31 25 26 24 32 21 22 20 23 18 19 17
36 37 35 38 33 34 32 39 29 30 28 31 26 27 25 40 21 22 20 23 18 19 17 16 24 12 13 11 14 9 10 8 15 5 6 4 7 2 3 1

result:

ok 80 numbers

Test #149:

score: 0
Accepted
time: 25ms
memory: 3552kb

input:

40 993786706455628800 967203704529920000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 40 27 28 37 36 38 34 35 33 39 30 29 31 25 26 24 32 21 22 20 23 18 19 17
36 37 35 38 33 34 32 39 29 30 28 31 26 27 25 40 17 1 18 2 3 19 4 5 7 6 24 8 9 12 10 11 23 13 15 14 22 16 21 20

result:

ok 80 numbers

Test #150:

score: 0
Accepted
time: 22ms
memory: 3608kb

input:

40 993786706455628801 967203704529920001

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 40 27 29 17 18 30 19 20 22 21 39 23 24 28 25 26 38 31 33 32 37 34 36 35
36 37 35 38 33 34 32 39 29 30 28 31 26 27 25 40 16 22 21 23 19 20 18 17 24 12 13 11 14 9 10 8 15 5 6 4 7 2 3 1

result:

ok 80 numbers

Test #151:

score: 0
Accepted
time: 11ms
memory: 4392kb

input:

65544 993786706455628800 967203704529920000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 131088 numbers

Test #152:

score: 0
Accepted
time: 11ms
memory: 4616kb

input:

65540 993786706455628800 967203704529920000

output:

1 2 4 3 8 5 7 6 16 9 11 10 15 12 14 13 32 17 19 18 23 20 22 21 31 24 26 25 30 27 29 28 64 33 35 34 39 36 38 37 47 40 42 41 46 43 45 44 63 48 50 49 54 51 53 52 62 55 57 56 61 58 60 59 128 65 67 66 71 68 70 69 79 72 74 73 78 75 77 76 95 80 82 81 86 83 85 84 94 87 89 88 93 90 92 91 127 96 98 97 102 99 ...

result:

ok 131080 numbers