fork download
  1. #define PLOTO kingInTheNorth & lordCommanderOfTheNightWatch
  2.  
  3. // Night gathers, and now my watch begins. It shall not end until my death.
  4. // I am the sword in the darkness.
  5. // I am the watcher on the walls.
  6. // I am the shield that guards the realms of men.
  7. // I pledge my life and honor to the Night's Watch, for this night and all the nights to come.
  8.  
  9. #include "bits/stdc++.h"
  10.  
  11. #define int long long
  12. #define vi vector< int >
  13. #define pi pair< int , int >
  14. #define fastIO() ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
  15. #define all(x) x.begin(),x.end()
  16. #define endl '\n'
  17. #define MOD = 1e9+7
  18.  
  19. using namespace std;
  20.  
  21. template<typename typC,typename typD> istream &operator>>(istream &cin,pair<typC,typD> &a) { return cin>>a.first>>a.second; }
  22. template<typename typC> istream &operator>>(istream &cin,vector<typC> &a) { for (auto &x:a) cin>>x; return cin; }
  23. template<typename typC,typename typD> ostream &operator<<(ostream &cout,const pair<typC,typD> &a) { return cout<<a.first<<' '<<a.second; }
  24. template<typename typC> ostream &operator<<(ostream &cout,const vector<typC> &a) { int n=a.size(); if (!n) return cout; cout<<a[0]; for (int i=1; i<n; i++) cout<<' '<<a[i]; return cout; }
  25.  
  26.  
  27.  
  28. void itIsADream(){
  29. int a,b; cin >> a >> b;vi ans;
  30. ans.push_back(b);
  31. while(a < b){
  32. int x = b%10;
  33. if(x%2 == 0){
  34. b /= 2;
  35. } else if(x == 1){
  36. b /= 10;
  37. } else {
  38. cout << "NO\n";
  39. return;
  40. }
  41. ans.push_back(b);
  42. }
  43. if(a == b){
  44. cout << "YES\n" << ans.size() << "\n";
  45. for(int i = ans.size()-1; i >= 0;i--){
  46. cout << ans[i] << " ";
  47. }
  48. } else {
  49. cout << "NO\n";
  50. }
  51. }
  52.  
  53. int32_t main()
  54. {
  55. fastIO();
  56. int t = 1;
  57. // cin >> t;
  58. while (t--)
  59. {
  60. itIsADream();
  61. }
  62. return 0;
  63. }
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
NO