Advertisement
Pit_Anonim

E

Nov 25th, 2021
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. int main() {
  5.     int c = 0;
  6.     int a;
  7.     std::cin>>a;
  8.     int map[a][a];
  9.  
  10.     std::vector<std::pair<int, int>> pairs;
  11.  
  12.     for (int x = 0; x < a; x++)
  13.         for (int y = 0; y < a; y++)
  14.             std::cin>>map[x][y];
  15.  
  16.  
  17.     for (int x = 0; x < a; x++)
  18.         for (int y = 0; y < x; y++)
  19.             if (map[x][y])
  20.                 pairs.push_back(std::pair<int,int>(y+1, x+1));
  21.  
  22.  
  23.     for (int x = 0; x < pairs.size(); x++)
  24.         std::cout<<pairs[x].first << " " << pairs[x].second << std::endl;
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement