QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#401686 | #8227. 圆 | New_hope | 0 | 163ms | 3928kb | C++14 | 1.6kb | 2024-04-29 09:32:52 | 2024-04-29 09:32:54 |
Judging History
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;
bool vis[1000005];
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;
vis[i] = 0;
}
sort (a + 1, a + 1 + n, cmp);
for (int i(1); i <= n && a[i].xi <= 2; i ++) {
o tp = {0, 5 - a[i].xi};
int l = lower_bound(a + 1, a + 1 + n, tp) - a;
if (a[l].xi + a[i].xi == 5) {
vis[l] = vis[i] = 1;
w.zh += (a[l].zh + a[i].zh) + (a[l].xi + a[i].xi + 5) / 10;
}
}
for (int i(1); i <= n; i ++)
if (!vis[i]) q.push(a[i]);
while (q.size()) {
o u = q.top(); q.pop();
// printf("u: %d.%d\n", u.zh, u.xi);
if (w.xi >= 5)
w.zh += 1, w.xi = 0;
if (u.xi < 5) {
if (u.xi + w.xi >= 5) {
w.zh += u.zh + (w.xi + u.xi + 5) / 10;
w.xi = 0;
}
else {
w.zh += u.zh + (w.xi + u.xi) / 10;
w.xi = (w.xi + u.xi) % 10;
}
}
else
w.zh += u.zh + (u.xi + 5)/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;
}
/*
1
5
6.9 1.9 8.3 0.9 8.6
*/
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 10ms
memory: 3928kb
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 32 10 30 22 26 35 27 26 34 19 22 29 26 24 19 34 19 31 24 23 33 23 17 26 31 21 28 7 28 36 16 23 16 37 23 26 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 18 29 28 20 20 36 27 22 29 19 28 32 18 45 36 21 28 31 27 23 18 18 40 27 15 47...
result:
wrong answer 9th numbers differ - expected: '28', found: '32'
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 1ms
memory: 3884kb
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:
88 78 51 96 68 56 74 59 68 76 50 61 84 53 65 62 36 83 65 51 62 71 62 83 69 82 43 60 61 69 62 87 63 65 56 66 75 42 69 45 75 71 81 109 69 72 81 76 60 67 91 69 60 66 73 62 57 64 75 52 71 61 61 79 83 55 61 78 63 86 55 56 71 50 52 74 81 66 71 36 80 89 57 74 77 78 54 86 48 59 65 61 60 54 59 72 65 55 70 68
result:
wrong answer 1st numbers differ - expected: '79', found: '88'
Subtask #3:
score: 0
Wrong Answer
Test #15:
score: 0
Wrong Answer
time: 129ms
memory: 3756kb
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:
444 685 394 520 387 461 425 496 598 406 415 455 397 434 448 636 514 426 441 448 504 567 499 468 430 494 444 530 480 506 425 481 410 414 540 447 471 444 394 457 491 424 425 523 457 549 451 522 423 372 485 403 400 575 464 403 441 458 473 441 427 423 389 427 500 427 469 459 417 442 433 482 395 557 478 ...
result:
wrong answer 1st numbers differ - expected: '425', found: '444'
Subtask #4:
score: 0
Wrong Answer
Test #22:
score: 0
Wrong Answer
time: 163ms
memory: 3808kb
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 503 525 542 484 510 518 486 485 528 466 475 467 543 487 478 499 441 537 525 551 491 506 455 475 458 531 493 480 547 528 470 540 519 535 558 475 495 526 467 562 468 487 474 516 506 564 510 545 486 476 487 536 509 538 449 489 510 453 528 471 516 574 435 485 491 554 554 450 491 494 489 506 535 541 ...
result:
wrong answer 3rd numbers differ - expected: '526', found: '525'
Subtask #5:
score: 0
Wrong Answer
Test #29:
score: 0
Wrong Answer
time: 162ms
memory: 3888kb
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:
612 532 559 646 529 708 540 584 573 605 544 598 539 560 538 567 551 560 559 552 689 524 542 839 509 558 576 521 630 533 622 478 535 584 544 511 605 566 574 802 693 627 583 579 541 551 550 547 553 653 552 512 559 531 607 587 558 540 546 634 510 574 469 533 627 709 541 503 521 745 662 513 585 533 514 ...
result:
wrong answer 1st numbers differ - expected: '459', found: '612'