QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#668187 | #9225. Fibonacci Fusion | 11d10xy | WA | 48ms | 239068kb | C++14 | 933b | 2024-10-23 12:19:08 | 2024-10-23 12:19:09 |
Judging History
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'