QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#407204#8227. 圆starry-sky-1550 75ms1608kbC++141.1kb2024-05-08 10:36:572024-05-08 10:36:59

Judging History

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

  • [2024-05-08 10:36:59]
  • 评测
  • 测评结果:0
  • 用时:75ms
  • 内存:1608kb
  • [2024-05-08 10:36:57]
  • 提交

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 s) {
	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;
		}
	}
	for (int i = 1; i <= 4 && s + i <= lim; i ++) {
		if (cnt2[i] == cnt[i]) {
			continue;
		}
		cnt2[i] ++;
		dfs(s + 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;
			memset(cnt2, 0, sizeof(cnt2));
			dfs(0);
		}
		printf("%lld\n", _sum);
	}
	return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 6ms
memory: 1608kb

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
25
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:

wrong answer 14th numbers differ - expected: '26', found: '25'

Subtask #2:

score: 0
Wrong Answer

Test #8:

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

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:

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

result:

wrong answer 1st numbers differ - expected: '79', found: '78'

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:

417
419
384
433
375
397
359
427
462
378
395
382
384
418
434
425
414
383
421
360
428
444
458
422
417
426
393
460
424
472
396
375
355
399
404
420
471
441
354
453
458
394
381
403
428
445
390
446
420
337
416
398
372
436
438
379
405
407
433
421
407
404
342
398
395
387
385
439
382
428
425
460
373
420
404
...

result:


Subtask #4:

score: 0
Wrong Answer

Test #22:

score: 0
Wrong Answer
time: 75ms
memory: 1472kb

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
501
493
539
484
498
511
484
485
526
466
472
467
543
472
478
499
441
537
515
539
491
497
455
473
457
513
493
480
540
528
470
540
506
533
526
475
495
498
465
562
468
487
474
515
505
559
507
545
486
476
487
534
509
538
443
482
510
446
528
471
516
574
434
484
482
554
554
450
490
494
489
496
533
541
...

result:

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

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:

453
520
534
476
518
496
505
513
479
514
531
545
513
531
536
509
528
528
530
508
509
521
512
512
485
494
491
474
544
504
523
476
481
515
489
496
601
560
556
545
528
524
489
543
515
487
501
524
467
567
515
462
505
494
472
508
546
527
500
516
482
561
441
481
535
556
522
497
517
476
535
503
534
510
465
...

result: