QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#859513#9675. 电池检测Southern_Dynasty5 364ms7552kbC++141.8kb2025-01-17 20:09:402025-01-17 20:09:41

Judging History

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

  • [2025-01-17 20:09:41]
  • 评测
  • 测评结果:5
  • 用时:364ms
  • 内存:7552kb
  • [2025-01-17 20:09:40]
  • 提交

answer

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define gt getchar
#define pt putchar
#define fst first
#define scd second
#define SZ(s) ((int)s.size())
#define all(s) s.begin(),s.end()
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned int uint;
const int N=1005;
using namespace std;
using namespace __gnu_pbds;
typedef pair<int,int> pii;
template<class T,class I> inline bool chkmax(T &a,I b){return b>a?a=b,1:0;}
template<class T,class I> inline bool chkmin(T &a,I b){return b<a?a=b,1:0;}
inline bool __(char ch){return ch>=48&&ch<=57;}
template<class T> inline void read(T &x){
	x=0;bool sgn=0;static char ch=gt();
	while(!__(ch)&&ch!=EOF) sgn|=(ch=='-'),ch=gt();
	while(__(ch)) x=(x<<1)+(x<<3)+(ch&15),ch=gt();
	if(sgn) x=-x;
}
template<class T,class ...I> inline void read(T &x,I &...x1){
	read(x);
	read(x1...);
}
template<class T> inline void print(T x){
	static char stk[70];short top=0;
	if(x<0) pt('-');
	do{stk[++top]=x>=0?(x%10+48):(-(x%10)+48),x/=10;}while(x);
	while(top) pt(stk[top--]);
}
template<class T> inline void printsp(T x){
	print(x);
	putchar(' ');
}
template<class T> inline void println(T x){
	print(x);
	putchar('\n');
}
int T,a,b,f[N][N];
inline int g(int x){
	return x*(x-1)/2;
}
inline void init(int n){
	for(int i=0;i<=n;++i) f[1][i]=-1e9,f[2][i]=g(i+2);
	for(int i=3;i<=n;++i){
		for(int j=1;j<=n;++j){
			for(int k=1;k<=j;++k){
				chkmax(f[i][j],f[i-1][j-k]+g(k+1));
			}
		}
	}
}
inline void solve(){
	read(a,b);
	println(f[a][b]);
}
signed main(){
	read(T);
	init(1000);
	while(T--) solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 10
Accepted
time: 364ms
memory: 7552kb

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: 364ms
memory: 7552kb

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
10
15
2
4
7
11
1
3
6
10

result:

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

Subtask #2:

score: 5
Accepted

Test #3:

score: 5
Accepted
time: 361ms
memory: 7552kb

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
10
15
21
28
36
45
55
66
78
91
105
120
136
153
171
190
210
231
253
276
300
325
351
378
406
435
465
496
528
561
595
630
666
703
741
780
820
861
903
946
990
1035
1081
1128
1176
1225
1275
1326
1378
1431
1485
1540
1596
1653
1711
1770
1830
1891
1953
2016
2080
2145
2211
2278
2346
2415
2485
2556
2628
27...

result:

ok 1000 numbers

Subtask #3:

score: 0
Wrong Answer

Test #4:

score: 0
Wrong Answer
time: 360ms
memory: 7552kb

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
11
16
22
29
37
46
56
67
79
92
106
121
137
154
172
191
211
232
254
277
301
326
352
379
407
436
466
497
529
562
596
631
667
704
742
781
821
862
904
947
991
1036
1082
1129
1177
1226
1276
1327
1379
1432
1486
1541
1597
1654
1712
1771
1831
1892
1954
2017
2081
2146
2212
2279
2347
2416
2486
2557
2629
...

result:

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

Subtask #4:

score: 0
Wrong Answer

Test #5:

score: 0
Wrong Answer
time: 361ms
memory: 7552kb

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:

29161
94830
9730
1
630
83028
52003
462241
48205
666
125250
17578
69006
105
16290
406
32131
330078
15
1953
57970
25200
630
1596
3655
84255
30876
110685
21
297606
45753
378
820
133903
10878
43365
5671
378
19306
69751
595
56616
27730
4186
254541
345696
107880
70876
2415
122760
9870
1326
703
1081
199396...

result:

wrong answer 1st numbers differ - expected: '242', found: '29161'

Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%