fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4.  
  5. ll left(ll count){
  6. if(count==1)
  7. cout<<3<<" "<<1<<endl;
  8.  
  9. if(count==2)
  10. cout<<3<<" "<<3<<endl;
  11. }
  12.  
  13. ll right(ll count){
  14. if(count==1)
  15. cout<<1<<" "<<1<<endl;
  16.  
  17. if(count==2)
  18. cout<<1<<" "<<2<<endl;
  19.  
  20. if(count==3){
  21. cout<<1<<" "<<3<<endl;
  22. }
  23.  
  24. if(count==4)
  25. cout<<1<<" "<<4<<endl;
  26. }
  27.  
  28. int main() {
  29. string s;
  30. cin>>s;
  31. ll l=s.length();
  32. ll co =1 , co1=1;
  33. for(int i=0;i<l;i++){
  34. if(s[i]=='1'){
  35. left(co);
  36. co++;
  37. if(co>2)
  38. co=1;
  39. }
  40.  
  41. if(s[i]=='0'){
  42. right(co1);
  43. co1++;
  44. if(co1>4)
  45. co1=4;
  46. }
  47.  
  48. }
  49.  
  50.  
  51. }
Success #stdin #stdout 0s 15240KB
stdin
110
stdout
3 1
3 3
1 1