QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#94497#5833. Number Gameeyiigjkn0 6047ms3692kbC++14781b2023-04-06 14:15:062023-04-06 14:15:10

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-06 14:15:10]
  • 评测
  • 测评结果:0
  • 用时:6047ms
  • 内存:3692kb
  • [2023-04-06 14:15:06]
  • 提交

answer

# include <bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr int N=31;
int fib[40];
ll slv(int A,int B)
{
	if(!A || !B) return 0;
	ll ans=0;
	for(int i=0;i+2<=N;i+=2)
	{
		for(int a=1,b=0;a<=A;a++)
		{
			while(fib[i]*a+fib[i+1]*(b+1)<=A && fib[i+1]*a+fib[i+2]*(b+1)<=B) b++;
			ans+=max(b-2*a+1,0);
		}
		for(int a=0,b=1;b<=B;b++)
		{
			while(fib[i+2]*(a+1)+fib[i+1]*b<=A && fib[i+1]*(a+1)+fib[i]*b<=B) a++;
			ans+=max(a-2*b+1,0);
		}
	}
	return ans;
}
int main()
{
	int T,L1,L2,R1,R2;
	fib[0]=1;fib[1]=0;
	for(int i=2;i<=N;i++) fib[i]=fib[i-1]+fib[i-2];
	cin>>T;
	for(int _=1;_<=T;_++)
	{
		scanf("%d%d%d%d",&L1,&R1,&L2,&R2);
		printf("Case #%d: %lld\n",_,slv(R1,R2)-slv(L1-1,R2)-slv(R1,L2-1)+slv(L1-1,L2-1));
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 3554ms
memory: 3652kb

input:

100
5 5 8 8
11 11 2 2
1 6 1 6
1 5 9 20
1 1 1 1
1000000 1000000 1000000 1000000
1000000 1000000 1 1
1 31 1 31
39 39 24 24
37 67 7 17
1 24 40 63
1 30 43 69
34 55 46 76
44 54 39 53
47 77 24 40
48 50 24 49
45 61 7 37
27 56 37 67
31 49 20 48
8 37 42 60
20 50 30 31
1 31 37 50
40 61 17 44
34 42 1 29
22 36 ...

output:

Case #1: 0
Case #2: 1
Case #3: 20
Case #4: 61
Case #5: 0
Case #6: 0
Case #7: 1
Case #8: 604
Case #9: 0
Case #10: 341
Case #11: 598
Case #12: 848
Case #13: 139
Case #14: 0
Case #15: 503
Case #16: 20
Case #17: 476
Case #18: 195
Case #19: 109
Case #20: 478
Case #21: 0
Case #22: 385
Case #23: 354
Case #...

result:

wrong answer 4th lines differ - expected: 'Case #4: 60', found: 'Case #4: 61'

Subtask #2:

score: 0
Wrong Answer

Test #2:

score: 0
Wrong Answer
time: 6047ms
memory: 3692kb

input:

100
5 5 8 8
11 11 2 2
1 6 1 6
1 5 9 20
1 1 1 1
1000000 1000000 1000000 1000000
1000000 1000000 1 1
1 1000000 1 1000000
88555 88555 54730 54730
94333 94333 58301 58301
1233 74802 1526 99178
1403 98398 100 99952
2314 98444 13714 78345
6209 77129 27966 59955
323 35101 11059 46724
6347 98575 43370 99140...

output:

Case #1: 0
Case #2: 1
Case #3: 20
Case #4: 61
Case #5: 0
Case #6: 0
Case #7: 1
Case #8: 648464189318
Case #9: 0
Case #10: 4
Case #11: 4769859705
Case #12: 6229445196
Case #13: 3706804552
Case #14: 1046461290
Case #15: 755781518
Case #16: 2448303035
Case #17: 5013456369
Case #18: 2065027149
Case #19:...

result:

wrong answer 4th lines differ - expected: 'Case #4: 60', found: 'Case #4: 61'