alt

代码演示:

#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define endl '\n'
const int N = 500010;

void solve(){
	int f=0;
	string s="0112233445142015320125410214530214510214102302142025101203201451451522302514203214510021454101002532";
	for(int i=0;i<s.length();i++){
		if(s[i]=='0'){
			f=3-f;
		}else if(s[i]=='1'){
			if(f%2==1){
                f=4-f;
            }
		}else if(s[i]=='2'){
			f=f^1;
		}else if(s[i]=='3'){
			if(f==0) f=2;
			else if(f==2) f=0;
		}else if(s[i]=='4'){
			f=(f+1)%4;
		}else{
			f=(f+3)%4;
		}
		cout<<f;
	}
}
signed main(){
	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
	int T=1;//cin>>T;
	while(T--){
		solve();
	}
	return 0;
}