QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#775668#56. Nim ProductPhysics21230375 3ms4140kbC++17755b2024-11-23 16:26:432024-11-23 16:26:43

Judging History

你现在查看的是最新测评结果

  • [2024-11-23 16:26:43]
  • 评测
  • 测评结果:75
  • 用时:3ms
  • 内存:4140kb
  • [2024-11-23 16:26:43]
  • 提交

answer

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
static ll r[256][256];
unsigned f(unsigned x,unsigned y,int p=32){
  if(x<=1||y<=1)return x*y;
  if(p<8&&r[x][y])return r[x][y];
  unsigned a=x>>p,b=(1u<<p)-1&x,c=y>>p,d=(1u<<p)-1&y;
  unsigned u=f(b,d,p>>1),v=f(f(a,c,p>>1),1u<<p>>1,p>>1);
  unsigned w=((f(a^b,c^d,p>>1)^u)<<p)^v^u;
  if(p<8)r[x][y]=r[y][x]=w;
  return w;
}
int main(){
  ios::sync_with_stdio(false);
  unsigned t,SA,SB,SC,l=0; cin>>t>>SA>>SB>>SC;
  auto rng=[&](){
    SA^=SA<<16,SA^=SA>>5,SA^=SA<<1;
    unsigned t=SA;
    return SA=SB,SB=SC,SC^=t^SA;
  };
  while(t--){
    unsigned x=rng()+(unsigned)l,y=rng();
    l=f(x,y);
  }
  cout<<l<<endl;
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Pretests


Final Tests

Test #1:

score: 25
Accepted
time: 0ms
memory: 4064kb

input:

10 274134852 279286565 744539633

output:

2002382043

result:

ok single line: '2002382043'

Test #2:

score: 25
Accepted
time: 0ms
memory: 4084kb

input:

1000 734766235 309378503 610268282

output:

2106551671

result:

ok single line: '2106551671'

Test #3:

score: 25
Accepted
time: 3ms
memory: 4140kb

input:

30000 784936363 827067061 800454511

output:

554318281

result:

ok single line: '554318281'

Test #4:

score: 0
Time Limit Exceeded

input:

30000000 72129929 485897764 129463885

output:


result: