QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#407200#8227. 圆starry-sky-1550 71ms1624kbC++141.1kb2024-05-08 10:32:072024-05-08 10:32:09

Judging History

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

  • [2024-05-08 10:32:09]
  • 评测
  • 测评结果:0
  • 用时:71ms
  • 内存:1624kb
  • [2024-05-08 10:32:07]
  • 提交

answer

#include <cstdio>
#include <cstring>
#include <algorithm>
#define int long long
#define INF 0x3f3f3f3f3f3f3f3f
using namespace std;
int T, n, a, b, cnt[10], cnt2[10], _sum, lim;
void calc(int x, int y) {
	if (x == y) {
		_sum += cnt[x] / 2;
		cnt[x] %= 2;
		return;
	}
	int tmp = min(cnt[x], cnt[y]);
	_sum += tmp;
	cnt[x] -= tmp;
	cnt[y] -= tmp;
}
void dfs(int u, int s) {
	if (u == 5) {
		if (s == lim) {
			int _min = INF;
			for (int i = 1; i <= 4; i ++) {
				if (cnt2[i]) {
					_min = min(_min, cnt[i] / cnt2[i]);
				}
			}
			_sum += _min;
			for (int i = 1; i <= n; i ++) {
				cnt[i] -= cnt2[i] * _min;
			}
		}
		return;
	}
	for (int i = 0; i <= cnt[u] && s + u * i <= lim; i ++) {
		cnt2[u] = i;
		dfs(u + 1, s + u * i);
	}
}
signed main() {
	scanf("%lld", &T);
	while (T --) {
		scanf("%lld", &n);
		_sum = 0;
		memset(cnt, 0, sizeof(cnt));
		for (int i = 1; i <= n; i ++) {
			scanf("%lld.%lld", &a, &b);
			_sum += a;
			if (b >= 5) {
				_sum ++;
			} else {
				cnt[b] ++;
			}
		}
		for (int i = 5; i <= 8; i ++) {
			lim = i;
			dfs(1, 0);
		}
		printf("%lld\n", _sum);
	}
	return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 20
Accepted
time: 6ms
memory: 1596kb

input:

10000
5
0.3 1.3 7.5 0.9 1.3
5
3.7 2.8 4.8 3.3 6.8
5
5.9 5.5 0.9 8.8 6.0
5
6.9 1.9 8.3 0.9 8.6
5
1.1 5.2 5.1 6.1 7.1
5
5.1 5.8 6.1 0.1 5.2
5
1.3 7.1 3.1 2.9 9.6
5
7.8 9.8 6.8 0.8 7.8
5
6.3 9.8 1.1 3.4 7.1
5
0.1 1.7 1.2 2.2 3.7
5
3.7 9.5 0.2 8.7 7.2
5
0.0 3.6 2.7 5.1 9.9
5
5.8 3.0 5.0 4.0 8.3
5
1.0 9....

output:

12
22
28
27
25
23
25
34
28
10
30
22
26
26
27
26
34
19
22
29
26
24
19
34
19
21
24
23
31
23
17
26
31
21
28
7
28
36
16
23
16
37
23
24
27
23
24
30
27
26
22
30
7
34
18
30
32
33
25
26
28
27
19
26
16
29
10
30
30
25
29
13
27
12
30
17
29
28
20
20
36
27
22
27
19
28
32
18
45
36
21
28
31
27
23
18
18
40
27
15
29...

result:

ok 10000 numbers

Test #2:

score: 20
Accepted
time: 6ms
memory: 1596kb

input:

10000
5
6.1 5.2 3.2 3.1 9.2
5
1.1 1.3 3.3 3.4 2.3
5
3.3 4.4 5.2 5.2 3.2
5
5.3 8.2 2.2 0.1 9.1
5
5.2 4.3 1.3 5.3 0.4
5
5.1 4.4 2.1 1.4 0.1
5
1.1 5.1 9.1 0.1 2.1
5
4.3 7.1 0.2 4.3 5.2
5
8.4 1.1 3.2 4.4 8.4
5
1.4 3.4 1.2 1.2 8.2
5
9.1 1.1 1.4 6.4 1.1
5
4.4 7.4 3.3 5.4 0.2
5
7.3 2.3 0.1 8.4 4.3
5
0.1 3....

output:

27
12
22
25
17
14
18
22
26
16
20
21
23
18
16
30
37
16
31
26
24
24
26
17
34
28
28
18
17
14
29
26
31
21
20
23
32
18
20
24
22
22
16
21
24
27
20
24
30
12
16
18
21
30
31
15
28
24
24
23
33
37
22
8
28
12
30
11
25
19
30
25
25
23
31
18
33
18
20
12
29
22
27
15
34
26
21
18
20
27
26
29
29
19
24
21
24
21
22
23
2...

result:

ok 10000 numbers

Test #3:

score: 0
Wrong Answer
time: 5ms
memory: 1572kb

input:

10000
1
5.1
5
5.2 8.1 9.3 7.3 2.2
3
7.1 8.2 0.1
3
9.3 3.2 9.1
3
8.1 8.4 7.3
3
3.1 0.4 7.2
2
6.1 8.1
3
3.2 5.2 8.4
3
6.2 0.1 0.2
1
4.4
3
3.4 3.1 3.1
5
6.1 1.1 2.1 1.4 1.1
3
2.1 7.4 8.2
5
8.3 6.2 6.2 0.3 5.3
5
6.2 1.4 1.2 8.4 1.3
1
1.3
2
1.2 1.2
2
0.1 8.2
2
6.1 6.1
2
3.1 0.1
5
3.3 8.3 3.3 4.3 8.2
3
3....

output:

5
33
15
22
25
12
14
17
7
4
10
12
19
27
19
1
2
8
12
3
28
21
25
18
9
24
22
3
23
11
6
17
0
15
6
15
15
6
9
27
6
28
3
9
28
22
3
8
4
10
15
17
28
26
9
22
15
36
27
18
17
18
8
7
6
27
15
5
26
21
23
20
3
17
5
10
13
7
6
25
3
28
31
29
12
24
9
29
16
11
18
22
15
29
6
10
5
7
7
5
9
28
21
17
13
10
20
21
13
23
5
8
9
0...

result:

wrong answer 5th numbers differ - expected: '24', found: '25'

Subtask #2:

score: 0
Wrong Answer

Test #8:

score: 15
Accepted
time: 0ms
memory: 1480kb

input:

100
12
3.8 2.2 7.7 4.3 8.1 9.3 6.2 7.6 5.8 9.3 5.3 7.2
12
9.1 5.5 6.5 8.1 4.1 4.5 9.1 0.5 3.1 3.7 6.5 2.4
12
2.4 3.4 3.4 8.7 0.7 9.2 0.9 2.0 5.0 8.6 5.0 0.0
12
6.7 5.0 4.7 8.9 8.5 2.8 9.0 6.8 6.0 6.7 9.5 0.9
12
4.2 7.2 8.5 9.1 0.2 4.2 0.2 5.6 2.3 1.7 0.2 8.4
12
9.7 6.8 4.0 1.8 7.7 2.8 2.1 3.3 0.7 4....

output:

79
66
51
78
54
56
74
59
68
68
50
57
79
53
65
62
35
77
65
51
53
60
47
74
69
77
43
60
61
66
60
87
63
56
52
64
67
42
69
43
69
71
81
70
53
72
81
57
41
66
77
66
53
57
73
62
57
59
75
52
71
61
41
79
53
55
60
65
49
72
49
49
61
50
52
74
76
66
69
28
66
66
57
64
74
66
52
86
44
57
62
59
59
52
59
62
58
52
64
61

result:

ok 100 numbers

Test #9:

score: 15
Accepted
time: 0ms
memory: 1476kb

input:

100
12
2.3 5.3 6.1 9.4 9.3 0.4 7.1 6.1 5.3 4.3 9.1 8.4
12
7.4 6.4 9.2 1.4 7.4 0.4 9.4 5.4 3.4 5.3 5.4 9.2
12
3.4 2.1 8.1 6.1 2.2 8.4 5.2 6.2 4.4 6.1 1.2 2.2
12
0.1 9.1 5.1 5.1 5.2 6.1 0.2 3.3 0.3 5.1 1.1 1.1
12
7.2 4.2 6.2 7.3 2.3 5.1 4.2 4.3 6.3 2.2 6.4 3.3
12
5.2 8.2 8.2 3.3 2.2 8.2 3.2 5.2 6.2 0....

output:

75
72
58
43
62
61
56
58
59
56
67
70
59
61
61
55
46
68
63
62
72
61
67
48
67
70
47
55
57
49
50
57
52
60
65
66
62
53
58
58
55
48
55
69
55
75
64
73
80
55
34
79
65
56
59
54
51
48
39
65
63
78
53
64
79
56
54
56
84
56
62
71
58
66
70
54
80
47
68
79
71
63
58
54
52
71
49
62
53
74
78
53
69
68
49
67
37
65
56
73

result:

ok 100 numbers

Test #10:

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

input:

100
9
7.2 0.2 6.2 4.2 0.1 0.3 6.3 9.4 4.2
6
5.3 7.3 9.3 7.2 2.2 0.3
7
2.4 5.3 7.3 9.2 3.1 6.4 1.3
2
1.1 6.3
4
1.2 4.2 4.1 4.1
9
2.4 6.2 7.4 4.4 4.4 8.4 7.1 3.4 6.2
1
6.2
10
6.4 0.4 2.4 3.1 7.2 7.2 1.4 9.1 9.1 1.1
8
2.1 3.3 0.3 2.3 7.3 3.1 9.3 6.1
10
6.4 8.3 4.4 6.3 3.4 7.4 2.3 3.3 1.3 7.4
1
9.2
10
0...

output:

40
33
36
7
14
51
6
49
35
52
9
42
5
28
21
14
32
34
3
32
10
21
19
24
14
15
20
58
58
50
64
42
18
23
32
8
2
23
9
43
3
18
30
27
60
17
31
58
42
11
17
60
30
5
35
46
0
31
14
60
49
14
63
41
55
71
11
45
30
19
27
82
39
36
4
13
33
57
40
16
59
19
6
20
7
20
55
17
68
6
61
69
21
1
46
4
36
46
4
28

result:

wrong answer 34th numbers differ - expected: '22', found: '23'

Subtask #3:

score: 0
Time Limit Exceeded

Test #15:

score: 0
Time Limit Exceeded

input:

10000
80
5.8 9.4 8.7 6.3 3.9 8.7 1.6 3.3 1.6 7.2 3.8 1.8 4.7 7.3 4.8 2.1 1.2 6.5 0.9 1.8 2.6 2.8 7.1 0.9 9.5 4.5 0.8 1.9 3.6 5.9 9.8 3.3 3.8 6.8 4.7 0.0 6.6 9.9 8.8 9.3 7.2 5.9 1.9 8.8 0.6 0.3 4.2 1.3 2.2 8.2 4.8 2.9 4.7 6.2 1.7 7.2 1.0 8.0 9.9 6.2 7.3 8.8 3.6 4.6 0.7 9.6 9.3 8.2 7.6 6.8 5.2 3.6 7.8...

output:

425
440
387
434
377
412
371
438
469
398
411
438
392
421
434
432
414
401
436
374
432
455
484
424
421
431
404
462
430
473
403
377
359
403
418
462
471
442
371
454
460
415
393
405
442
453
438
451
421
340
417
402
391
440
439
381
415
438
435
427
410
410
365
410
398
389
385
442
392
435
430
464
394
431
408
...

result:


Subtask #4:

score: 0
Wrong Answer

Test #22:

score: 0
Wrong Answer
time: 71ms
memory: 1624kb

input:

10000
100
9.0 7.4 3.6 2.0 6.4 8.4 3.4 2.4 9.4 2.6 8.6 3.4 4.4 8.4 5.4 6.4 3.4 8.6 0.0 1.0 8.4 8.0 6.6 6.6 5.4 8.4 7.0 2.6 9.6 1.6 8.6 0.8 5.0 8.4 8.4 7.4 3.8 6.4 9.4 2.6 8.4 9.6 3.0 3.4 6.4 8.4 6.4 8.4 5.4 4.4 4.6 1.4 7.4 7.4 5.8 4.0 6.6 0.4 7.4 1.8 5.4 9.4 9.4 3.0 1.6 4.8 5.0 3.4 0.4 1.0 2.0 4.4 3....

output:

543
510
526
543
484
515
522
487
485
530
474
477
467
543
490
485
500
450
537
528
554
496
509
457
476
473
533
504
481
550
528
478
540
523
543
560
475
496
528
477
565
468
487
476
518
506
567
517
545
486
486
498
537
513
540
456
494
518
460
534
479
517
576
435
488
500
555
555
450
491
495
489
506
538
543
...

result:

wrong answer 2nd numbers differ - expected: '503', found: '510'

Subtask #5:

score: 0
Time Limit Exceeded

Test #29:

score: 0
Time Limit Exceeded

input:

10000
100
2.1 3.8 5.3 2.1 1.8 3.1 5.6 6.8 1.3 8.6 5.8 1.9 4.9 4.2 9.2 6.1 6.3 2.2 5.6 1.3 6.7 2.7 1.0 6.8 6.3 5.9 8.3 7.9 0.0 0.1 4.9 4.9 0.2 2.9 4.0 8.6 1.6 2.0 1.0 1.0 5.7 2.0 5.7 2.8 2.8 2.8 2.3 5.9 5.3 7.0 8.6 4.0 6.6 5.1 5.0 8.7 3.0 0.9 5.0 2.8 4.7 5.1 1.2 8.1 0.0 0.6 6.6 1.3 3.0 0.6 9.9 9.0 9....

output:

487
529
536
523
522
501
517
549
504
547
535
549
524
532
538
553
540
529
535
513
516
521
518
520
496
509
493
486
545
521
594
476
493
534
507
502
601
562
559
566
532
538
496
557
516
509
517
536
494
573
583
529
562
498
491
518
548
535
529
523
490
565
457
493
541
559
532
502
518
477
559
507
542
521
542
...

result: