QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#343288#8284. Cats and Fishucup-team173#AC ✓1ms3836kbC++17957b2024-03-02 13:24:392024-03-02 13:24:40

Judging History

This is the latest submission verdict.

  • [2024-03-02 13:24:40]
  • Judged
  • Verdict: AC
  • Time: 1ms
  • Memory: 3836kb
  • [2024-03-02 13:24:39]
  • Submitted

answer

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

#define fi first
#define se second
#define Mp make_pair
#define pb push_back
#define SZ(x) (int((x).size()))

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pii;

void solve() {
    int m, n, x;
    cin >> m >> n >> x;
    vi c(n);
    for(int i = 0; i < n; i++)
        cin >> c[i];
    int eaten = 0, eating = 0;
    priority_queue<pii, vector<pii>, greater<pii>> pq;
    for(int i = 0; i < n; i++) pq.push(Mp(0, c[i]));
    while(SZ(pq)) {
        auto [ti, cc] = pq.top(); pq.pop();
        if(ti > x) break;
        if(ti) eating--;
        if(ti == x) break;
        if(m > 0) {
            pq.push(Mp(ti + cc, cc));
            eating++, m--;
        }
    }
    cout << m << ' ' << eating << '\n';
}
signed main() {
    ios::sync_with_stdio(false);
    int t = 1;
    // cin >> t;
    while(t--) solve();
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3592kb

input:

2 1 1
1

output:

1 0

result:

ok 2 number(s): "1 0"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

8 3 5
1 3 4

output:

0 1

result:

ok 2 number(s): "0 1"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3484kb

input:

4 5 1
5 4 3 2 1

output:

0 3

result:

ok 2 number(s): "0 3"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

1 1 10
1

output:

0 0

result:

ok 2 number(s): "0 0"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

14 3 10
1 40 50

output:

2 2

result:

ok 2 number(s): "2 2"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

8 2 7
12 13

output:

6 2

result:

ok 2 number(s): "6 2"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3484kb

input:

1 1 1
2

output:

0 1

result:

ok 2 number(s): "0 1"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

12 2 11
8 3

output:

6 2

result:

ok 2 number(s): "6 2"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

2 2 12
24 1

output:

0 1

result:

ok 2 number(s): "0 1"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

562 8 232
17 26 800 12 77 32 11 2

output:

368 7

result:

ok 2 number(s): "368 7"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

562 8 1
17 26 800 12 77 32 11 1

output:

554 7

result:

ok 2 number(s): "554 7"

Test #12:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

3656 13 123
1887 26 800 12 77 32 11 1 77 32 77 32 155

output:

3484 12

result:

ok 2 number(s): "3484 12"

Test #13:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

5000 100 626
1767 1255 1320 794 1584 967 560 398 1687 553 1459 1924 740 50 274 1533 864 766 226 1343 1836 1934 651 1716 680 1381 1546 1337 908 251 335 1760 290 1162 1920 286 361 516 356 1261 1924 330 1225 443 1625 1942 1151 826 1139 834 139 1262 33 1679 1429 50 1380 1024 1194 691 677 556 1562 211 47...

output:

4585 100

result:

ok 2 number(s): "4585 100"

Test #14:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

5000 50 56
954 1898 1879 1978 571 713 376 1656 130 845 928 594 1412 223 681 117 379 974 923 1297 67 1179 1607 795 1438 908 512 921 1 1020 1821 184 1477 1977 905 1226 998 613 1299 2000 1223 1287 238 1940 333 1287 1682 1314 1663 1493

output:

4895 49

result:

ok 2 number(s): "4895 49"

Test #15:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

5000 99 222
380 382 1033 70 1068 218 1622 1792 1665 1519 1917 1585 11 103 647 620 1564 1629 1059 328 396 1555 1889 1632 760 1677 745 1569 991 1973 1362 783 468 1621 1658 656 927 1839 1269 1791 764 1225 102 330 138 921 599 1589 1164 286 1159 181 604 855 823 870 771 1049 188 646 307 1949 416 775 1693 ...

output:

4870 99

result:

ok 2 number(s): "4870 99"

Test #16:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

1 100 395
1692 1571 579 840 76 962 766 1898 837 1878 1442 91 848 387 1271 479 933 1007 1482 417 691 1607 1450 541 668 873 1243 1732 678 1864 1606 1547 1995 204 1463 1467 73 815 1886 387 1572 736 1391 1922 751 340 1090 1165 1175 592 19 815 1992 1184 1363 1604 1045 100 1493 1453 1076 573 1746 1295 179...

output:

0 0

result:

ok 2 number(s): "0 0"

Test #17:

score: 0
Accepted
time: 1ms
memory: 3568kb

input:

500 100 445
1000 1251 581 200 1006 153 1566 12 1901 928 873 1218 184 995 1773 71 969 96 852 1338 861 1464 1999 352 1414 1491 1489 1376 1176 1658 1775 1432 252 75 1670 662 1647 969 693 191 1476 906 542 699 158 1319 1866 1559 1191 1759 1586 1442 93 340 1878 1136 671 364 314 810 1748 1137 100 1868 68 1...

output:

297 100

result:

ok 2 number(s): "297 100"

Test #18:

score: 0
Accepted
time: 1ms
memory: 3484kb

input:

5000 10 893
87 1135 26 1716 930 1277 1623 1547 717 1847

output:

4945 10

result:

ok 2 number(s): "4945 10"

Extra Test:

score: 0
Extra Test Passed