Advertisement
Korotkodul

E

Dec 31st, 2021
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4. #include <queue>
  5. #include <algorithm>
  6. #include <string>
  7. #include <stack>
  8. #include <set>
  9. #include <map>
  10. #define pii pair <int,int>
  11. using namespace std;
  12. using ll = long long;
  13. using ld = long double;
  14. void cv(vector <int> &v){
  15.     for (auto x: v) cout<<x<<' ';
  16.     cout<<"\n";
  17. }
  18.  
  19. void cvv(vector <vector <int> > &v){
  20.     for (auto x: v) cv(x);
  21.     cout<<"\n";
  22. }
  23. int n, mn, mx;
  24. vector <vector <int> > G;
  25. vector <pii> Edge;
  26. void cG(){
  27.     for (int i = 0; i < n;++i){
  28.         cout<<"("<<i<<"): ";
  29.         cv(G[i]);
  30.     }
  31. }
  32.  
  33. void cEdge(){
  34.     cout<<Edge.size()<<"\n";
  35.     for (auto x: Edge){
  36.         cout<<x.first+1<<' '<<x.second+1<<"\n";
  37.     }
  38. }
  39.  
  40. bool cmp()
  41.  
  42. int main()
  43. {
  44.     /*ios::sync_with_stdio(0);
  45.     cin.tie(0);
  46.     cout.tie(0);*/
  47.     cin>>n>>mx>>mn;
  48.     G.resize(n);
  49.     for (int i = 0; i < n; ++i){
  50.         if (G[i].size() == mn) continue;
  51.         for (int j = 0; j < n && j != i; ++j){
  52.             if (G[j].size() >= mn) continue;
  53.             if (find(G[i].begin(), G[i].end(), j) == G[i].end() ){
  54.                 G[i].push_back(j);
  55.                 G[j].push_back(i);
  56.                 Edge.push_back({min(i, j), max(i, j)});
  57.             }
  58.             if (G[i].size() == mn){
  59.                 break;
  60.             }
  61.         }
  62.     }
  63.     //while ()
  64.     cG();
  65.     //cEdge();
  66. }
  67. /*
  68. 15 4 3
  69.  
  70. 17 7 5
  71. */
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement