I only have one idea for this question, and I don't know the basics of computers well. The mod value of the natural overflow is exactly 2^64, which is actually a different value for fabonacci. In fact, my maxn first opened 60, if I accidentally opened 2e6+10, it would be A directly. Unfortunately, considering the overflow, I didn't dare to open it. . . . . I really didn't expect this kind of operation.
AC code:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn=2e6+10;
ll fa[maxn];
ll init(){
fa[1]=1;
fa[2]=2;
for(ll i=3;i<maxn;i++){
fa[i]=fa[i-1]+fa[i-2];
}
}
int main(){
init();
ll T;
scanf("%lld",&T);
while(T--){
ll n;
scanf("%lld",&n);
ll A=0,B=0,t,i;
for(i=1;i<=n;i++){
scanf("%lld",&t);
A+=t*fa[i];
}
scanf("%lld",&n);
for(i=1;i<=n;i++){
scanf("%lld",&t);
B+=t*fa[i];
}
ll res=A*B;
scanf("%lld",&n);
ll C=0;
for(i=1;i<=n;i++){
scanf("%lld",&t);
C+=t*fa[i];
}
ll tt=res-C,ans=0;
for(i=1;i<maxn;i++){
if(tt==fa[i]){
ans=i;break;
}
}
printf("%lld\n",ans);
}
return 0;
}
There is a pitfall in this. If you use map or unordered_map, you will still get T, this. . . . . . . Is there any great god to give pointers?