Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #pragma comment(linker, "/STACK:66777216")
  3. #include <iostream>
  4. #include <cstdio>
  5. #include <cmath>
  6. #include <vector>
  7. #include <ctime>
  8. #include <map>
  9. #include <set>
  10. #include <string>
  11. #include <queue>
  12. #include <deque>
  13. #include <cassert>
  14. #include <cstdlib>
  15. #include <bitset>
  16. #include <algorithm>
  17. #include <string>
  18. #include <list>
  19. #include <fstream>
  20. #include <cstring>
  21. #include <unordered_set>
  22. #include <unordered_map>
  23. using namespace std;
  24.  
  25. typedef unsigned long long ull;
  26. typedef long long ll;
  27. typedef long double ld;
  28.  
  29. #define forn(i, n) for (int i = 0; i < (int)n; i++)
  30. #define fornn(i, q, n) for (int i = q; i < (ll)n; i++)
  31. #define mp make_pair
  32. #define pk push_back
  33. #define all(v) v.begin(), v.end()
  34. #define times clock() * 1.0 / CLOCKS_PER_SEC
  35. #define prev pprev
  36.  
  37. #define TASK "elections"
  38.  
  39. const double EPS = 1e-7;
  40. const double PI = acos(-1.0);
  41.  
  42. const ll INF = (ll)2e9 + 1;
  43. const ll LINF = (ll)8e18;
  44. const ll MM = (ll)1e9 + 7;
  45. const ll MOD = (ll)1e9 + 7;
  46. int solve();
  47. void gen();
  48.  
  49. int main() {
  50. #ifdef _DEBUG
  51. freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  52. #else
  53. //freopen(TASK".in", "r", stdin), freopen(TASK".out", "w", stdout);
  54. //freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout), freopen("test.txt", "w", stderr);
  55. #endif
  56. solve();
  57. return 0;
  58. }
  59.  
  60. const int MAXN = (int)2e5 + 14;
  61. const int MAXC = 2007;
  62. const int P = 997;
  63.  
  64. int G[20][20];
  65.  
  66. int solve() {
  67. int n, m;
  68. cin >> n >> m;
  69. forn(i, m) {
  70. int q, w;
  71. cin >> q >> w;
  72. G[q - 1][w - 1] = 1;
  73. G[w - 1][q - 1] = 1;
  74. }
  75. ll cnt = 0;
  76. forn(i, 1 << n) {
  77. bool ok = true;
  78. forn(j1, 20) {
  79. fornn(j2, j1 + 1, 20) {
  80. if (((1 << j1) & i) && ((1 << j2) & i) && G[j1][j2]) {
  81. ok = false;
  82. }
  83. }
  84. }
  85. if (ok)
  86. cnt++;
  87. }
  88. cout << cnt;
  89. return 0;
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement