fork download
  1. #include <algorithm>
  2. #include <iomanip>
  3. #include <iostream>
  4. #include <vector>
  5. #include <set>
  6. #include <numeric>
  7. #include <map>
  8. #include <unordered_map>
  9. #include <stack>
  10. #include <queue>
  11. using namespace std;
  12. #define all(a) a.begin(), a.end()
  13. #define ll long long
  14. #define fo(i,n) for (long long i = 0; i < n; i++)
  15. #define pb push_back
  16. int main()
  17. {
  18. ll a,b,c,d,n,m,k,input,i;
  19. ios_base::sync_with_stdio(false);
  20. string sinput;
  21. cin.tie(0); cout.tie(0);
  22. cin >> i;
  23. while (i--)
  24. {
  25. cin >> n >> k;
  26. fo(j,n)
  27. {
  28. if (k%2 == 1)
  29. {
  30. if (j != n-1)
  31. {
  32. cout << n << ' ';
  33. }
  34. else
  35. {
  36. cout << n-1;
  37. }
  38. }
  39. else
  40. {
  41. if (j != n-2)
  42. {
  43. cout << n-1 << ' ';
  44. }
  45. else
  46. {
  47. cout << n << ' ';
  48. }
  49. }
  50. }
  51. cout << '\n';
  52. }
  53. }
Success #stdin #stdout 0.01s 5288KB
stdin
2
2 1
6 2
stdout
2 1
5 5 5 5 6 5