Submit Info #5362

Problem Lang User Status Time Memory
Nim Product ($\mathbb{F}_{2^{64}}$) cpp TKO919 AC 543 ms 20.67 MiB

ケース詳細
Name Status Time Memory
example_00 AC 3 ms 1.17 MiB
large_00 AC 519 ms 20.58 MiB
large_few_00 AC 59 ms 3.08 MiB
power_of_two_00 AC 0 ms 1.21 MiB
random_00 AC 543 ms 20.67 MiB
random_01 AC 538 ms 20.67 MiB
random_few_00 AC 60 ms 3.08 MiB
random_few_01 AC 60 ms 3.05 MiB
small_00 AC 320 ms 6.58 MiB
small_few_00 AC 39 ms 1.57 MiB

#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; //template #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(a);i>(b);i--) #define ALL(v) (v).begin(),(v).end() typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12; void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;} template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; } template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; } //end typedef unsigned long long ull; ull memo[256][256]; ull mul(ull x,ull y,int k=64){ if(k<=8&&memo[x][y]<256)return memo[x][y]; k>>=1; ull a=x>>k,b=x^(a<<k),c=y>>k,d=y^(c<<k); ull ac=mul(a,c,k),bd=mul(b,d,k),abcd=mul(a^b,c^d,k); return mul(ac,1ull<<(k-1),k)^(abcd^bd)<<k^bd; } void init(){ fill(memo[0],memo[256],256); memo[0][0]=memo[0][1]=memo[1][0]=0; memo[1][1]=1; rep(i,0,256)rep(j,0,256)memo[i][j]=mul(i,j,8); } int main(){ init(); int t; scanf("%d",&t); rep(_,0,t){ ull x,y; scanf("%llu%llu",&x,&y); printf("%llu\n",mul(x,y)); } return 0; }