Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <bitset>
- #include <cassert>
- #include <cmath>
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <iostream>
- #include <list>
- #include <map>
- #include <queue>
- #include <set>
- #include <string>
- #include <sstream>
- #include <vector>
- #include <complex>
- #include <ctime>
- #include <stack>
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef vector<int> VI;
- typedef vector< VI > VVI;
- typedef pair<int, int> PII;
- typedef vector<PII> VPII;
- #define REP(i, n) for(int i = 0; i < (n); ++i)
- #define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
- #define FOR(i, x, y) for(int i = (x); i <= (y); ++i)
- #define RFOR(i, x, y) for(int i = (x); i >= (y); --i)
- #define SZ(a) (int)(a).size()
- #define ALL(a) (a).begin(),(a).end()
- #define SORT(a) sort(ALL(a))
- #define CLEAR(x) memset(x, 0, sizeof x);
- #define COPY(FROM, TO) memcpy(TO, FROM, sizeof TO);
- #define UNIQUE(c) SORT(c),(c).resize(unique(ALL(c))-(c).begin())
- #define pb push_back
- #define mk make_pair
- #define sqr(x) ((x)*(x))
- #define X first
- #define Y second
- const long double pi=acos(-1.0);
- const double EPS = 1E-9;
- const int inf = (1e+9);
- const int NMAX = 1e+5;
- const int MOD = 1743;
- int n, k;
- VVI g;
- int main () {
- scanf("%d%d", &n, &k);
- g.resize(n + 1);
- REP (i, k) {
- int t, a, b;
- scanf("%d", &t);
- if (t == 1) {
- scanf("%d%d", &a, &b);
- g[a].pb(b);
- g[b].pb(a);
- } else {
- scanf("%d", &a);
- REP (j, SZ(g[a])) printf("%d ", g[a][j]);
- printf("\n");
- }
- }
- }
- /*
- 4 7 2 3 9
- 1 2 3 4
- */
Advertisement
Add Comment
Please, Sign In to add comment