Advertisement
leminhkt

noname34 (MIX)

Apr 2nd, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #define iFOR(i, a, b) for(int i=(a); i<=(b); i++)
  3. using namespace std;
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.         //=================declare=================
  11.     int n, m;
  12.     int a[50005];
  13.  
  14.  
  15.  
  16.  
  17. //=================..end..=================
  18.         //=================function=================
  19.  
  20.  
  21.  
  22.  
  23.  
  24. //=================..end...=================
  25. int main(){
  26.     ifstream cin1("AR1.INP");
  27.     ifstream cin2("AR2.INP");
  28.     ofstream cout("MIX.OUT");
  29.         //=================code=================
  30.     cin1>>n;
  31.     iFOR(i, 0, n-1) cin1>>a[i];
  32.     a[n]=INT_MAX;
  33.     cin2>>n;
  34.     for(int i=-1; n--;){
  35.         cin2>>m;
  36.         while(a[i+1]<=m) cout<<a[++i]<<' ';
  37.         cout<<(a[i]=m)<<' ';
  38.         if(!n) while(a[i+1]!=INT_MAX) cout<<a[++i]<<' ';
  39.     }
  40. //=================end.=================
  41.     cin1.close();
  42.     cin2.close();
  43.     cout.close();
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement