Skip to content

Instantly share code, notes, and snippets.

@tooshitaka
Created March 16, 2017 01:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tooshitaka/6e33ed8e2c8bdb6f8de899f271efe4f7 to your computer and use it in GitHub Desktop.
Save tooshitaka/6e33ed8e2c8bdb6f8de899f271efe4f7 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
// Input
int adj_m[100][100] = { 0 };
int n;
cin >> n;
int u,v,k;
for (int i = 0; i < n; i++) {
cin >> u >> k;
for (int j = 0; j < k; j++) {
cin >> v;
adj_m[u - 1][v - 1] = 1;
}
}
// Output
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (j)
cout << " ";
cout << adj_m[i][j];
}
cout << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment