Advertisement
193030

2011 D

Apr 17th, 2020
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.30 KB | None | 0 0
  1. #include<fstream>
  2. #include<queue>
  3. #include<vector>
  4. #include <algorithm>
  5. using namespace std;
  6.  
  7. // 9 10
  8. // 1 2
  9. // 3 4
  10. // 3 5
  11. // 4 6
  12. // 4 9
  13. // 9 8
  14. // 1 7
  15. // 7 3
  16. // 1 3
  17.  
  18. ifstream cin ("input.txt");
  19. ofstream cout ("output.out");
  20.  
  21. int main(){
  22.     int n,m;
  23.     int a,b;
  24.     //int k = 3;
  25.     int maxA = 0;
  26.     int maxB = 0;
  27.     int counter =0;
  28.     int k = 1;
  29.     int broiTransportniVuzli = 0;
  30.     vector <int> newVec;
  31.     vector <int> outputVector;
  32.     cin>>n>>m; // n - nodes, m - arcs
  33.     vector <int> samp;
  34.     vector < vector <int> > conn(n+1,samp);
  35.     // load adajency matrix
  36.     for(int i=0;i<m;i++){
  37.         cin>>a>>b;
  38.         if(a > maxA) maxA = a;
  39.       //  if(b > maxB) maxB = b;
  40.         conn[a].push_back(b);
  41.         conn[b].push_back(a);
  42.     }
  43.     bool visited[n+1];
  44.     for(int i=0;i<n+1;i++){
  45.         visited[i] = false;
  46.     }
  47.     for(int i =1; i<=maxA; i++)
  48.     {
  49.        cout << conn[i].size() << endl;
  50.         int sizeConn = conn[i].size();
  51.         if(sizeConn >=k)
  52.         {
  53.             counter++;
  54.             newVec.push_back(i);
  55.         }
  56.     }
  57.     cout << "Counter: " << counter << endl;
  58.     cout << "VEC" << endl;
  59.     sort(newVec.begin(), newVec.end());
  60.     for(int i =0; i<newVec.size(); i++)
  61.     {
  62.         cout << newVec[i] << endl;
  63.     }
  64. }
  65.  
  66.  
  67. //Raboti
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement