Advertisement
Rofyda_Elghadban1

Untitled

Sep 13th, 2023
1,154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.63 KB | None | 0 0
  1.  #include <bits/stdc++.h>
  2.  
  3.  #define ll long long
  4.  #define ull unsigned long long
  5.  #define pi 3.141592654
  6.  #define NUM 1e18
  7.  #define Mod  1'000'000'007
  8.  #define fixed(n) fixed<<setprecision(n)
  9.  #define cin(v) for(auto &i:v) cin >> i ;
  10.  #define cout(v) for(auto &i:v) cout << i  <<" ";
  11.  #define vowel(x) (x=='e'||x=='a'||x=='i'||x=='o'||x=='u')
  12.  #define small(x) (x>=97&&x<=122)
  13.  #define capital(x) (x>=65&&x<=90)
  14.  #define Tolower(s) transform(s.begin(),s.end(),s.begin(),::tolower);
  15.  #define Toupper(s) transform(s.begin(),s.end(),s.begin(),::toupper);
  16.  #define all(v) ((v).begin()), ((v).end())
  17.  #define allr(v) ((v).rbegin()), ((v).rend())
  18.  #define updmax(a,b) a=max(a,b)
  19.  #define updmin(a,b) a=min(a,b)
  20.  #define ceil(a,b) ((a/b)+(a%b?1:0))
  21.  /* asc -> 1 2 3 ,des -> 3 2 1 */
  22.  
  23.  /***********************************************************************************/
  24.  
  25.  using namespace std;
  26.  
  27.  void Rofyda_Elghadban(){
  28.   #ifndef ONLINE_JUDGE  
  29.     freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  30.    #endif
  31.     ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  32.  }
  33.  
  34.  void solve(){
  35.  }
  36.  
  37.  
  38.  int main(){
  39.  Rofyda_Elghadban();
  40.  //freopen("input.txt","r",stdin);
  41.  //freopen("output.txt","r",stdout);
  42.  //solve();
  43.  
  44.  int t,m;
  45.  cin>>t>>m;
  46.  int freq[101]{};
  47.  vector<int>v;
  48.  for(int i=1;i<=t;i++){
  49.   int l,r;
  50.   cin>>l>>r;
  51.   for(int i=l;i<=r;i++){
  52.     freq[i]++;
  53.   }
  54.  }
  55.  for(int i=1;i<=m;i++){
  56.   if(freq[i]==0){
  57.     v.push_back(i);
  58.   }
  59.  }
  60.  if(v.size()!=0){
  61.   cout<<v.size()<<"\n";
  62.   cout(v);
  63.  }else if(v.size()==0){
  64.   cout<<v.size()<<"\n"<<" ";
  65.  }
  66.  
  67.  
  68.  return 0;
  69. }
  70.  
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement