QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#401670#8227. 圆New_hope0 166ms3908kbC++141.4kb2024-04-29 08:49:232024-04-29 08:49:23

Judging History

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

  • [2024-04-29 08:49:23]
  • 评测
  • 测评结果:0
  • 用时:166ms
  • 内存:3908kb
  • [2024-04-29 08:49:23]
  • 提交

answer

#include <bits/stdc++.h>
#define db double
using namespace std;

struct o
{
  int zh, xi;
  bool operator < (const o &a) const
  {
    return xi > a.xi;
  }
};
int T, n;
o a[1000005];

/*
*/
bool cmp(o x, o y)
{
  return (x.xi != y.xi ? x.xi < y.xi : x.zh < y.zh);
}
void solve()
{
  o w = {0, 0};
  priority_queue <o> q; 
  scanf("%d", &n);
  for (int i(1); i <= n; i ++) {
    db t; scanf("%lf", &t); 
    t *= 10;
    a[i].zh = (int)(t / 10);
    a[i].xi = (int)t % 10;
  }
  sort (a + 1, a + 1 + n, cmp);
  for (int i(1); i <= n; i ++) {
    if (q.empty()) {
      q.push(a[i]);
      continue;
    }
    o u = q.top();
    if (a[i].xi + u.xi >= 5 && a[i].xi < 5) {
      q.pop();
      w.zh += a[i].zh + u.zh + (a[i].xi + u.xi + 5)/10;
    }
    else q.push(a[i]);
    // printf("w: %d.%d\n", w.zh, w.xi);
  }// 向上取整
  // printf("dfan\n");
  while (q.size()) {
    o u = q.top(); q.pop();
    // printf("u: %d.%d\n", u.zh, u.xi);
    if (u.xi + w.xi >= 5) 
      w.zh += u.zh + (u.xi + w.xi + 5)/10;
    else {
      w.zh += u.zh + (u.xi + w.xi)/10;
      w.xi = (u.xi + w.xi)%10;
    }
    // printf("w: %d.%d\n", w.zh, w.xi);
  }
  w.zh += (w.xi + 5)/10;
  printf("%d\n", w.zh);
}
int main()
{
  // freopen("test.out", "w", stdout);
  scanf("%d", &T);
  while (T --) solve();

  return 0;
}
/*
2
5
5.1 5.8 6.1 0.1 5.2
*/

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 9ms
memory: 3908kb

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
20
22
29
26
24
19
34
19
21
24
23
31
23
17
26
31
22
28
8
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
20
27
16
29
10
30
30
25
30
13
27
12
30
17
29
28
20
21
36
27
22
27
19
28
32
18
45
36
21
28
31
27
23
18
18
40
27
16
29...

result:

wrong answer 18th numbers differ - expected: '19', found: '20'

Subtask #2:

score: 0
Wrong Answer

Test #8:

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

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:

82
66
52
78
57
57
74
60
68
68
51
57
80
54
69
62
37
77
65
53
54
61
47
74
69
77
44
60
64
66
63
89
63
56
53
64
67
43
69
45
69
71
82
70
54
72
81
58
41
67
77
66
55
59
73
63
58
59
75
52
72
61
41
79
55
55
62
65
50
72
49
50
62
50
52
74
76
67
69
31
66
67
57
65
75
66
52
87
46
57
64
59
61
53
59
63
58
52
64
61

result:

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

Subtask #3:

score: 0
Wrong Answer

Test #15:

score: 0
Wrong Answer
time: 127ms
memory: 3816kb

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:

436
443
403
439
397
411
398
457
488
421
425
415
416
434
436
469
425
421
436
399
446
489
482
432
428
448
405
468
447
479
423
387
367
408
425
459
473
447
391
459
463
437
407
425
447
469
414
459
421
365
424
412
412
448
454
389
427
437
442
439
420
423
357
414
403
393
387
442
415
447
436
470
407
448
414
...

result:

wrong answer 1st numbers differ - expected: '425', found: '436'

Subtask #4:

score: 0
Wrong Answer

Test #22:

score: 0
Wrong Answer
time: 149ms
memory: 3872kb

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:

571
526
561
557
489
542
540
525
486
536
488
487
473
543
512
525
513
477
539
544
572
511
560
467
518
501
555
534
533
565
556
495
542
546
561
560
479
518
559
497
579
477
506
489
524
530
580
532
550
493
519
533
566
538
545
480
512
535
482
560
504
533
587
475
496
530
572
581
465
494
532
496
517
548
565
...

result:

wrong answer 1st numbers differ - expected: '543', found: '571'

Subtask #5:

score: 0
Wrong Answer

Test #29:

score: 0
Wrong Answer
time: 166ms
memory: 3872kb

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:

475
541
539
509
531
505
533
537
513
544
535
549
548
540
538
548
558
533
548
520
554
530
541
543
516
501
507
516
554
546
557
479
505
532
533
509
618
569
564
558
548
558
514
565
518
544
536
554
506
596
557
516
535
505
515
525
553
546
563
540
501
574
475
509
556
573
543
501
534
498
559
507
560
541
516
...

result:

wrong answer 1st numbers differ - expected: '459', found: '475'