QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#862778#9675. 电池检测args5 1ms3840kbC++14771b2025-01-19 09:48:052025-01-19 09:48:07

Judging History

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

  • [2025-01-19 09:48:07]
  • 评测
  • 测评结果:5
  • 用时:1ms
  • 内存:3840kb
  • [2025-01-19 09:48:05]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a,b;
void input(){
	scanf("%lld %lld",&a,&b);
}
void solve(){
	ll n=a+b;
	if(n%2==0){
		if(a>b) printf("%lld\n",b+1);
		else{
			ll b1=a,b2=(b-a)/2;
			ll cnt=n/2+2*b2*min(n-2,2*b2+2);
			cnt+=min(n-2,2*b2+2)+2;
			printf("%lld\n",cnt); 
		}
	}else{
		if(a>b+1) printf("%lld\n",b+1);
		else if(a==b+1) printf("%lld\n",b+2);
		else if(a==b-1) printf("%lld\n",a+4);
		else{
			ll b1=a,b2=(b-a)/2;
			//至少b1个1,0,b2个全1,
			//[b1,b2]:剩一个1
			//[b1-1,b2+1]:剩一个0 
			printf("%lld\n",(a+b)/2+2*(b2+1)*min(n-2,2*b2+4)+min(n-2,2*b2+4)+2); 
		}
	}
}
int main(){
	ll T;
	scanf("%lld",&T);
	for(ll i=1;i<=T;i++){
		input();
		solve();
	}
	return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 10
Accepted
time: 1ms
memory: 3840kb

input:

3
2 1
3 1
2 2

output:

3
2
6

result:

ok 3 number(s): "3 2 6"

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 3840kb

input:

12
2 1
2 2
2 3
2 4
3 1
3 2
3 3
3 4
4 1
4 2
4 3
4 4

output:

3
6
6
17
2
4
7
7
2
3
5
8

result:

wrong answer 3rd numbers differ - expected: '10', found: '6'

Subtask #2:

score: 0
Wrong Answer

Test #3:

score: 0
Wrong Answer
time: 1ms
memory: 3840kb

input:

1000
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
2 10
2 11
2 12
2 13
2 14
2 15
2 16
2 17
2 18
2 19
2 20
2 21
2 22
2 23
2 24
2 25
2 26
2 27
2 28
2 29
2 30
2 31
2 32
2 33
2 34
2 35
2 36
2 37
2 38
2 39
2 40
2 41
2 42
2 43
2 44
2 45
2 46
2 47
2 48
2 49
2 50
2 51
2 52
2 53
2 54
2 55
2 56
2 57
2 58
2 59
2 60
2 61...

output:

3
6
6
17
30
36
55
63
88
98
129
141
178
192
235
251
300
318
373
393
454
476
543
567
640
666
745
773
858
888
979
1011
1108
1142
1245
1281
1390
1428
1543
1583
1704
1746
1873
1917
2050
2096
2235
2283
2428
2478
2629
2681
2838
2892
3055
3111
3280
3338
3513
3573
3754
3816
4003
4067
4260
4326
4525
4593
4798...

result:

wrong answer 3rd numbers differ - expected: '10', found: '6'

Subtask #3:

score: 0
Wrong Answer

Test #4:

score: 0
Wrong Answer
time: 0ms
memory: 3840kb

input:

1000
3 1
3 2
3 3
3 4
3 5
3 6
3 7
3 8
3 9
3 10
3 11
3 12
3 13
3 14
3 15
3 16
3 17
3 18
3 19
3 20
3 21
3 22
3 23
3 24
3 25
3 26
3 27
3 28
3 29
3 30
3 31
3 32
3 33
3 34
3 35
3 36
3 37
3 38
3 39
3 40
3 41
3 42
3 43
3 44
3 45
3 46
3 47
3 48
3 49
3 50
3 51
3 52
3 53
3 54
3 55
3 56
3 57
3 58
3 59
3 60
3 61...

output:

2
4
7
7
18
36
37
63
64
98
99
141
142
192
193
251
252
318
319
393
394
476
477
567
568
666
667
773
774
888
889
1011
1012
1142
1143
1281
1282
1428
1429
1583
1584
1746
1747
1917
1918
2096
2097
2283
2284
2478
2479
2681
2682
2892
2893
3111
3112
3338
3339
3573
3574
3816
3817
4067
4068
4326
4327
4593
4594
4...

result:

wrong answer 3rd numbers differ - expected: '6', found: '7'

Subtask #4:

score: 5
Accepted

Test #5:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

1000
907 241
495 435
227 139
616 1
433 35
588 407
533 322
995 961
748 310
212 36
968 500
294 187
375 371
307 14
648 180
122 28
304 253
818 812
41 5
286 62
573 340
547 224
347 35
279 56
151 85
626 410
456 248
578 470
11 6
952 771
404 302
77 27
168 40
524 517
171 147
407 294
268 106
100 27
549 196
973...

output:

242
436
140
2
36
408
323
962
311
37
501
188
372
15
181
29
254
813
6
63
341
225
36
57
86
411
249
471
7
772
303
28
41
518
148
295
107
28
197
374
35
337
236
92
714
832
465
377
70
496
141
52
38
47
632
355
96
329
130
395
233
124
815
408
201
20
56
630
544
62
379
618
415
17
131
265
179
232
316
109
60
266
7...

result:

ok 1000 numbers

Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%