Skip to content

Instantly share code, notes, and snippets.

@Noobgam
Last active July 27, 2018 13:47
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 Noobgam/3e1447502b8bf947e8501f8086a221d0 to your computer and use it in GitHub Desktop.
Save Noobgam/3e1447502b8bf947e8501f8086a221d0 to your computer and use it in GitHub Desktop.
#include <cstdio>
#include <vector>
using namespace std;
vector <vector <int>> G1;
int** G2;
vector <pair <int, int>> G3;
int main() {
int n, m;
scanf("%d%d", &n, &m);
G1.resize(n);
G2 = new int*[n];
for (int i = 0; i < n; ++i) {
G2[i] = new int[n];
}
for (int i = 0; i < m; ++i) {
int a, b;
scanf("%d%d", &a, &b);
a--;
b--;
G1[a].push_back(b);
G1[b].push_back(a);
G2[a][b] = G2[b][a] = 1;
G3.push_back(pair<int,int>(a,b));
}
for (int i = 0; i < n; ++i) {
delete[] G2[i];
}
delete[] G2;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment