fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
  5.  
  6. int64_t rnd(int64_t l, int64_t r) {
  7. return rng() % (r - l + 1) + l;
  8. }
  9.  
  10. int a[500][500];
  11.  
  12. int32_t main() {
  13. cin.tie(0)->sync_with_stdio(0);
  14. int n = rnd(2, 10);
  15. cout << n << '\n';
  16. for (int i = 1; i <= n; i++)
  17. for (int j = 1; j <= n; j++)
  18. cout << (a[i][j] = rnd(-1, 1)) << " \n"[j == n];
  19. for (int i = 1; i <= n; i++)
  20. for (int j = 1; j <= n; j++)
  21. cout << (rnd(0, 1) ? -a[i][j] : a[i][j]) << " \n"[j == n];
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5392KB
stdin
Standard input is empty
stdout
2
0 0
-1 0
0 0
1 0