QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#775686#56. Nim ProductPhysics21230375 1ms4148kbC++17775b2024-11-23 16:29:022024-11-23 16:29:03

Judging History

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

  • [2024-11-23 16:29:03]
  • 评测
  • 测评结果:75
  • 用时:1ms
  • 内存:4148kb
  • [2024-11-23 16:29:02]
  • 提交

answer

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
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]>=0)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;
}
unsigned SA,SB,SC;
inline unsigned rng(){
  SA^=SA<<16,SA^=SA>>5,SA^=SA<<1;
  unsigned t=SA;
  return SA=SB,SB=SC,SC^=t^SA;
}
int main(){
  ios::sync_with_stdio(false);
  memset(r,-1,sizeof(r));
  unsigned t,l=0; cin>>t>>SA>>SB>>SC;
  while(t--){
    unsigned x=rng()+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: 4052kb

input:

10 274134852 279286565 744539633

output:

2002382043

result:

ok single line: '2002382043'

Test #2:

score: 25
Accepted
time: 1ms
memory: 4148kb

input:

1000 734766235 309378503 610268282

output:

2106551671

result:

ok single line: '2106551671'

Test #3:

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

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: