QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#668187#9225. Fibonacci Fusion11d10xyWA 48ms239068kbC++14933b2024-10-23 12:19:082024-10-23 12:19:09

Judging History

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

  • [2024-10-23 12:19:09]
  • 评测
  • 测评结果:WA
  • 用时:48ms
  • 内存:239068kb
  • [2024-10-23 12:19:08]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using i64=long long;
constexpr double W=4.784971965;
constexpr i64 mod[3]{998244353,998244853,1000000007};
array<i64,3>fib[10000010];
char buf[2000010];
map<array<i64,3>,int>cnt;
vector<array<i64,3>>qry;
int main(){
   fib[1]={1,1,1};
   for(int i=2;i<=10000000;i++){
      for(int t:{0,1,2})fib[i][t]=(fib[i-1][t]+fib[i-2][t])%mod[t];
   }
   int n;scanf("%d",&n);
   i64 ans=0;
   for(int i=1;i<=n;i++){
      scanf("%s",buf+1);
      int m=strlen(buf+1),L=max(2,(int)(W*(m-1)-2)),R=W*(m+1)+3;
      array<i64,3>a{};
      for(int k=1;k<=m;k++){
         for(int t:{0,1,2})a[t]=(a[t]*10+buf[k]-'0')%mod[t];
      }
      cnt[a]++;
      for(int k=L;k<=R;k++){
         array<i64,3>b{};
         for(int t:{0,1,2})b[t]=(fib[k][t]+mod[t]-a[t])%mod[t];
         if(a==b)ans--;
         qry.push_back(b);
      }
   }
   printf("%lld",ans/2);
   return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 48ms
memory: 239068kb

input:

6
50
8
8
5
72
354224848179261915070

output:

0

result:

wrong answer 1st numbers differ - expected: '4', found: '0'