fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. const int N=1e6+4;
  4. long long b[N],c[N],n,m;
  5. int main()
  6. {
  7. cin>>n>>m;
  8. for(int i=1;i<=n;i++) cin>>b[i];
  9. for(int i=1;i<=m;i++) cin>>c[i];
  10. long long i=1,j=1;
  11. while(i<=n && j<=m)
  12. {
  13. if(b[i]<=c[j])
  14. {
  15. cout<<"b"<<i<<" ";
  16. i++;
  17. }
  18. else
  19. {
  20. cout<<"c"<<j<<" ";
  21. j++;
  22. }
  23. }
  24. while(i<=n)
  25. {
  26. cout<<"b"<<i<<" ";
  27. i++;
  28. }
  29. while(j<=m)
  30. {
  31. cout<<"c"<<j<<" ";
  32. j++;
  33. }
  34. }
  35.  
Success #stdin #stdout 0.01s 5312KB
stdin
Standard input is empty
stdout
Standard output is empty