Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int n, m, mx = 0;
- vector<int> color;
- vector<pair<int, int>> r;
- int check(vector<int> color)
- {
- int cnt = 0;
- map<pair<int, int>, int> mp;
- for(auto i : r)
- {
- if(mp.count({min(color[i.first], color[i.second]), max(color[i.first], color[i.second])}) == 0)
- {
- // cout << min(color[i.first], color[i.second]) << " " << max(color[i.first], color[i.second]) << "\n";
- cnt++;
- mp[{min(color[i.first], color[i.second]), max(color[i.first], color[i.second])}] = 1;
- }
- }
- return cnt;
- }
- void f(int i, vector<int> color)
- {
- if(i == n + 1)
- {
- // for(int i = 0; i < n; i++)
- // cout << color[i] << ' ';
- // cout << "\n";
- mx = max(check(color), mx);
- return;
- }
- for(int j = 1; j <= 6; j++)
- {
- color[i] = j;
- f(i + 1, color);
- }
- }
- main()
- {
- cin >> n >> m;
- for(int i = 0; i < m; i++)
- {
- int f, t;
- cin >> f >> t;
- r.push_back({f, t});
- }
- color.resize(n + 1, 0);
- set<int> s{1, 2, 3, 4, 5, 6, 7};
- f(1, color);
- cout << mx;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement