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. using namespace std;
  10. #define all(a) a.begin(), a.end()
  11. #define ll long long
  12. #define fo(i,n) for (long long i = 0; i < n; i++)
  13. bool comp(pair<char,ll> a, pair<char,ll> b)
  14. {
  15. return (a.first < b.first);
  16. }
  17. bool comp2(pair<char,ll> a, pair<char,ll> b)
  18. {
  19. return (a.first > b.first);
  20. }
  21. int main()
  22. {
  23. ios_base::sync_with_stdio(false);
  24. cin.tie(0); cout.tie(0);
  25. ll n,m,i;
  26. ll a,b;
  27. string input;
  28. cin >> i;
  29. while (i--)
  30. {
  31. cin >> n >> m;
  32. vector<vector<ll>> nums(n,vector<ll>(m,0));
  33. fo(j,n)
  34. {
  35. fo(k,m)
  36. {
  37. cin >> a;
  38. nums[j][k] = a;
  39. }
  40. }
  41. for (auto z : nums)
  42. {
  43. for (auto s : z)
  44. {
  45. cout << s << ' ';
  46. }
  47. }
  48. }
  49. }
Success #stdin #stdout 0.01s 5288KB
stdin
4
1 1
1
3 3
1 2 1
2 3 2
1 3 1
1 6
5 4 5 4 4 5
3 4
1 4 2 2
1 4 3 5
6 6 3 5
stdout
1 1 2 1 2 3 2 1 3 1 5 4 5 4 4 5 1 4 2 2 1 4 3 5 6 6 3 5