|
| 1 | +# --------------------------------------------------------------------------------------- |
| 2 | +# URL : https://codeforces.com/contest/1914/problem/B |
| 3 | +# Title : Preparing for the Contest |
| 4 | +# Tags : tag-codeforces, tag-problem-B, tag-div-3, tag-difficulty-0 |
| 5 | +# Notes : constructive algorithms, math |
| 6 | +# --------------------------------------------------------------------------------------- |
| 7 | + |
| 8 | +# region --------------------------------------------Shared part-------------------------------------------------------- |
| 9 | +import math |
| 10 | +import os |
| 11 | +import sys |
| 12 | +import time |
| 13 | +from collections import defaultdict, Counter |
| 14 | +from io import IOBase, BytesIO |
| 15 | + |
| 16 | +inp = lambda: sys.stdin.readline().strip().rstrip("\r\n") |
| 17 | +iinp = lambda: int(inp()) |
| 18 | +intl = lambda: list(map(int, inp().split())) |
| 19 | +strl = lambda: list(inp().split()) |
| 20 | +list_to_string = lambda _a: "".join(map(str, _a)) |
| 21 | +list_to_string_list = lambda _a: " ".join(map(str, _a)) |
| 22 | +_dp = lambda default_value: defaultdict(lambda: default_value) |
| 23 | +flush = lambda: sys.stdout.flush() |
| 24 | +print_flush = lambda _text: (print(_text), flush()) |
| 25 | +fact = lambda number: math.factorial(number) |
| 26 | +_cnt = lambda _a: Counter(_a) |
| 27 | + |
| 28 | + |
| 29 | +def lcm(a, b): |
| 30 | + return a * b // math.gcd(a, b) |
| 31 | + |
| 32 | + |
| 33 | +def print_dp(_dict): |
| 34 | + for item in _dict.items(): |
| 35 | + print(f"{item[0]} = {item[1]}") |
| 36 | + |
| 37 | + |
| 38 | +def memodict(f): |
| 39 | + """memoization decorator for a function taking a single argument""" |
| 40 | + |
| 41 | + class memodict(dict): |
| 42 | + def __missing__(self, key): |
| 43 | + ret = self[key] = f(key) |
| 44 | + return ret |
| 45 | + |
| 46 | + return memodict().__getitem__ |
| 47 | + |
| 48 | + |
| 49 | +MOD = 10 ** 9 + 7 |
| 50 | +INF = sys.maxsize |
| 51 | +A = 911382323 |
| 52 | +M = 9999999999879998 |
| 53 | +yes = "YES" |
| 54 | +no = "NO" |
| 55 | + |
| 56 | +# region -------------------------------------------Fast IO Region------------------------------------------------------ |
| 57 | +BUFSIZE = 8192 |
| 58 | + |
| 59 | + |
| 60 | +class FastIO(IOBase): |
| 61 | + newlines = 0 |
| 62 | + |
| 63 | + def __init__(self, file): |
| 64 | + self._fd = file.fileno() |
| 65 | + self.buffer = BytesIO() |
| 66 | + self.writable = "x" in file.mode or "r" not in file.mode |
| 67 | + self.write = self.buffer.write if self.writable else None |
| 68 | + |
| 69 | + def read(self): |
| 70 | + while True: |
| 71 | + b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) |
| 72 | + if not b: |
| 73 | + break |
| 74 | + ptr = self.buffer.tell() |
| 75 | + self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) |
| 76 | + self.newlines = 0 |
| 77 | + return self.buffer.read() |
| 78 | + |
| 79 | + def readline(self): |
| 80 | + while self.newlines == 0: |
| 81 | + b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) |
| 82 | + self.newlines = b.count(b"\n") + (not b) |
| 83 | + ptr = self.buffer.tell() |
| 84 | + self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) |
| 85 | + self.newlines -= 1 |
| 86 | + return self.buffer.readline() |
| 87 | + |
| 88 | + def flush(self): |
| 89 | + if self.writable: |
| 90 | + os.write(self._fd, self.buffer.getvalue()) |
| 91 | + self.buffer.truncate(0), self.buffer.seek(0) |
| 92 | + |
| 93 | + |
| 94 | +class IOWrapper(IOBase): |
| 95 | + def __init__(self, file): |
| 96 | + self.buffer = FastIO(file) |
| 97 | + self.flush = self.buffer.flush |
| 98 | + self.writable = self.buffer.writable |
| 99 | + self.write = lambda s: self.buffer.write(s.encode("ascii")) |
| 100 | + self.read = lambda: self.buffer.read().decode("ascii") |
| 101 | + self.readline = lambda: self.buffer.readline().decode("ascii") |
| 102 | + |
| 103 | + |
| 104 | +sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout) |
| 105 | + |
| 106 | + |
| 107 | +# endregion |
| 108 | +# endregion |
| 109 | + |
| 110 | +# -------------------------------------------------------Solution------------------------------------------------------- |
| 111 | + |
| 112 | +def solve(): |
| 113 | + n, k = intl() |
| 114 | + |
| 115 | + return list_to_string_list(list(range(n, k + 1, -1)) + list(range(1, k + 2))) |
| 116 | + |
| 117 | + |
| 118 | +def run(): |
| 119 | + t = iinp() |
| 120 | + |
| 121 | + for _ in range(t): |
| 122 | + print(solve()) |
| 123 | + |
| 124 | + |
| 125 | +if __name__ == "__main__": |
| 126 | + if os.environ.get("DEBUG_CODEFORCES"): |
| 127 | + sys.stdin = open("../../input.txt", "r") |
| 128 | + start_time = time.time() |
| 129 | + run() |
| 130 | + print("\n--- %s seconds ---\n" % (time.time() - start_time)) |
| 131 | + else: |
| 132 | + run() |
0 commit comments