Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
52588 jr_zlw 修复符文 C++ 解答错误 0 3 MS 180 KB 1623 2022-07-19 13:32:09

Tests(0/20):


#include<cstdio> #define rep(a,b,c) for(int c(a);c<=(b);++c) inline int read() { int res=0;char ch=getchar();while(ch<'0'||ch>'9')ch=getchar(); while(ch<='9'&&ch>='0')res=res*10+(ch^48),ch=getchar();return res; } typedef long long LL;int n,m;LL l,r,h,a,b,c,W; inline int dfs(int n,int m,int x,int y) { if(n==1)return x;int mid=n>>1;if(y<=mid)return dfs(n>>1,m<<1,x,y); return dfs(n>>1,m<<1,m+(m-x+1),mid-(y-mid)+1); } int s[1<<10|7]; inline LL qry0(int l,int r) { LL lst=0;if(l&1) { lst=s[l];if(!(r&1))lst+=s[r]; lst+=((r-l)>>1ll)*W; } else { lst=((r+1-l)>>1)&1?W:0; if(!(r&1))lst^=s[r]; } return lst; } inline int S(int x) { int ans=0,p=x>>1; for(int i=0;i<n;++i)ans=(ans<<1)|(p&1),p>>=1; if(x&1)ans^=(1<<n)-1;return ans; } inline LL qry(int l,int r) { LL lst=0;if(l&1) { lst=S(l);if(!(r&1))lst+=S(r); lst+=((r-l)>>1ll)*W; } else { lst=((r+1-l)>>1)&1?W:0; if(!(r&1))lst^=S(r); } return lst; } int main() { n=read();m=read();l=read();r=read();a=read();b=read();c=read(); LL th,tl,tr,lst;W=(1<<n)-1; if(n<=10) { for(int S=0;S<(1<<n);++S){s[dfs(1<<n,1,1,S+1)-1]=S;} // for(int S=0;S<(1<<n);++S)printf("%d ",s[S]);puts(""); LL nn=W+1; lst=qry0(l,r);while(m--) { th=((l^r^h^lst)+c)%1000000007; tl=((l^a^th)%(nn+1))%nn; tr=((r^b^th)%(nn-tl))+tl; l=tl;r=tr;h=th;lst=qry0(l,r); } } else { LL nn=W+1; lst=qry(l,r);while(m--) { th=((l^r^h^lst)+c)%1000000007; tl=((l^a^th)%(nn+1))%nn; tr=((r^b^th)%(nn-tl))+tl; l=tl;r=tr;h=th;lst=qry(l,r); } } printf("%lld\n",h); }


测评信息: