prestige

Untitled

Dec 7th, 2013
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. #include <algorithm>
  2. #include <bitset>
  3. #include <cassert>
  4. #include <cmath>
  5. #include <cstdio>
  6. #include <cstdlib>
  7. #include <cstring>
  8. #include <iostream>
  9. #include <list>
  10. #include <map>
  11. #include <queue>
  12. #include <set>
  13. #include <string>
  14. #include <sstream>
  15. #include <vector>
  16. #include <complex>
  17. #include <ctime>
  18. #include <stack>
  19.  
  20. using namespace std;
  21.  
  22. typedef long long ll;
  23. typedef unsigned long long ull;
  24. typedef vector<int> VI;
  25. typedef vector< VI > VVI;
  26. typedef pair<int, int> PII;
  27. typedef vector<PII> VPII;
  28.  
  29. #define REP(i, n) for(int i = 0; i < (n); ++i)
  30. #define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
  31. #define FOR(i, x, y) for(int i = (x); i <= (y); ++i)
  32. #define RFOR(i, x, y) for(int i = (x); i >= (y); --i)
  33. #define SZ(a) (int)(a).size()
  34. #define ALL(a) (a).begin(),(a).end()
  35. #define SORT(a) sort(ALL(a))
  36. #define CLEAR(x) memset(x, 0, sizeof x);
  37. #define COPY(FROM, TO) memcpy(TO, FROM, sizeof TO);
  38. #define UNIQUE(c) SORT(c),(c).resize(unique(ALL(c))-(c).begin())
  39. #define pb push_back
  40. #define mk make_pair
  41. #define sqr(x) ((x)*(x))
  42. #define X first
  43. #define Y second
  44. const long double pi=acos(-1.0);
  45. const double EPS = 1E-9;
  46. const int inf = (1e+9);
  47. const int NMAX = 1e+5;
  48. const int MOD = 1743;
  49.  
  50. int n, k;
  51. VVI g;
  52. int main () {
  53. scanf("%d%d", &n, &k);
  54. g.resize(n + 1);
  55. REP (i, k) {
  56. int t, a, b;
  57. scanf("%d", &t);
  58. if (t == 1) {
  59. scanf("%d%d", &a, &b);
  60. g[a].pb(b);
  61. g[b].pb(a);
  62. } else {
  63. scanf("%d", &a);
  64. REP (j, SZ(g[a])) printf("%d ", g[a][j]);
  65. printf("\n");
  66. }
  67. }
  68. }
  69. /*
  70. 4 7 2 3 9
  71. 1 2 3 4
  72. */
Advertisement
Add Comment
Please, Sign In to add comment