QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#721127#9597. Grade 2rotcar07WA 141ms11764kbC++23340b2024-11-07 15:20:282024-11-07 15:20:34

Judging History

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

  • [2024-11-07 15:20:34]
  • 评测
  • 测评结果:WA
  • 用时:141ms
  • 内存:11764kb
  • [2024-11-07 15:20:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int x,n;
typedef long long ll;
ll a[1<<20];
int main(){
	cin>>x>>n;
	int bit=__lg(x)+1,w=1<<bit;
	for(int i=0;i<w;i++) a[i]=a[i-1]+(__gcd(x,(i*x)^x)==1);
	while(n--){
		ll l,r;cin>>l>>r;
		auto f=[&](ll x){
			return a[w-1]*(x>>bit)+a[x&w-1];
		};
		cout<<f(r)-f(l-1)<<'\n';
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3640kb

input:

15 2
1 4
11 4514

output:

2
2252

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 109ms
memory: 7840kb

input:

500696 100000
110442401300 646889080214
337192 670162015551
508011001649 508011014425
94418501628 94418501634
824168677375 824168677376
732815842309 795402573302
353241304050 846773277757
622033633276 622033633284
760381702139 760381702143
207714 795408271057
382792 952061527685
686173 331215904334
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #3:

score: 0
Accepted
time: 97ms
memory: 9636kb

input:

465262 100000
119442423888 249533375982
528365238401 528365275157
654839906300 654839906303
135820863700 135820967840
336231 918143221477
568175915485 568176067832
993015103483 993015103488
951474 444595379179
298623434750 298623434751
257961 410491919396
996297715292 996297994388
17765498878 177654...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #4:

score: 0
Accepted
time: 141ms
memory: 11764kb

input:

599394 100000
683408 868635908987
347999512025 347999739145
740945 377178907084
399211757563 399211757568
766968 548821086083
630762 702128377806
756554924031 756554924036
904713771313 904714518208
17026878789 17027129255
11601638470 206412869961
253365321722 253365321730
785476956554 785477402085
2...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #5:

score: -100
Wrong Answer
time: 122ms
memory: 7184kb

input:

255255 100000
693776785134 693776920782
174578728959 174578728960
109045569231 631173362385
470661333171 470661439492
401883 183360880923
436203696728 436203931780
165055 339075075373
640081 299360395352
864237441330 864237509663
730335563579 730335652091
194265481215 194265481219
40664920117 406649...

output:

36283
0
141606131858
28194
49729143417
63334
91960410090
81189274737
18687
24416
1
9811
20612
197980898177
39954585067
2
35132911639
1
133417599880
1
36096
196422817375
249130729593
1
16666
41491
35290183064
34746269284
71942755150
41989
0
115846701166
1
83477915674
69415271144
110243663256
0
1954
0...

result:

wrong answer 1st lines differ - expected: '48406', found: '36283'