Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,m, V[1000],B[1000];
- cin >> n >> m;
- for(int i=0; i<n; i++)
- cin >> V[i];
- for(int i=0; i<m; i++)
- cin >> B[i];
- int i=n-1,j=m-1,ok1=0,ok2=0;
- while(i>=0 || j>=0){
- if(V[i]%2==0 && V[i]>B[j] && i>=0)
- {
- cout << V[i] << " ";
- i--;
- }
- if(B[j]%2==0 && B[j]>V[i] && j>=0)
- {
- cout << B[j] << " ";
- j--;
- }
- if(j<0)
- B[j]=0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement