Advertisement
Ne-Biolog

Untitled

Apr 9th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. int n;
  2. cin >> n;
  3. vector <int> g[n];
  4. for(int i = 0; i < n; ++i) {
  5. for(int j = 0; j < n; ++j) {
  6. int x; cin >> x;
  7. g[j].push_back(x);
  8. cout << x << ' ';
  9. }
  10. cout << endl;
  11. }
  12.  
  13. cout << endl;
  14.  
  15. for(int i = 0; i < n; ++i) {
  16. sort(g[i].begin(), g[i].end());
  17. }
  18.  
  19. for(int i = 0; i < n; ++i) {
  20. for(int j = 0; j < n; ++j) {
  21. cout << g[j][i] << ' ';
  22. }
  23. cout << endl;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement