Advertisement
semsem_elazazy

Untitled

Apr 18th, 2022
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. #include <iostream>
  2. #include<bits/stdc++.h>
  3. #include<utility>
  4. #include <queue>
  5. #define ll long long
  6. #define ull unsigned long long
  7. #define pi  3.14159
  8.  
  9. #define OO  2000000000
  10. //#define ceil(w, m) (((w) / (m)) + ((w) % (m) ? 1 : 0))
  11. using namespace std;
  12.  
  13. void yasmeen_fakhri(){
  14.   ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  15.   #ifndef ONLINE_JUDGE  
  16.     freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  17.   #endif
  18. }
  19.  
  20.  
  21. void solve(){
  22.     ll n,m;
  23.     cin>>n>>m;
  24.    priority_queue<int, vector<int>, greater<int> > cinema ;
  25.    for(int i =1 ; i <= n ; i++){
  26.        cinema.push(i);
  27.      
  28.    }
  29.    for(int j =0 ; j<m ; j++){
  30.    if ( n == 1 ){
  31.        cout<<cinema.top()<<'\n';
  32.        cinema.pop();
  33.    }
  34.    if (n == 2 ){
  35.        ll o; cin>>o;
  36.        cinema.push(o);
  37.    }
  38.    }
  39.  
  40. }
  41.  
  42. int main() {
  43.    yasmeen_fakhri();
  44.  
  45. int test =1;
  46. //cin>>test;
  47. while(test--){
  48.  solve();
  49.  
  50. }
  51. return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement