daily pastebin goal
37%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     #include <iostream>
  2.     using namespace std;
  3.      
  4.     int main() {
  5.         int n;
  6.         int input;
  7.         cin >> n;
  8.         int **Graph = (int**)malloc(n*sizeof(int*));
  9.         for (int i = 0; i < n; i++) {
  10.             Graph[i] = (int*)malloc(n*sizeof(int));
  11.         }
  12.        
  13.         for (int i = 0; i < n; i++) {
  14.             for (int j = 0; j < n; j++) {
  15.                 cin >> input;
  16.                 Graph[i][j] = input;
  17.             }
  18.         }
  19.         for (int i = 0; i < n; i++) {
  20.             for (int j = 0; j < n; j++) {
  21.                 if (Graph[i][j] == 1) {
  22.                     cout << i+1 << " " << j+1 << endl;
  23.                     Graph[j][i] = 0;
  24.                 }
  25.             }
  26.         }
  27.        
  28.         return 0;
  29.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top