QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#336434 | #8284. Cats and Fish | ucup-team1191# | AC ✓ | 1ms | 4132kb | C++20 | 1.4kb | 2024-02-24 16:20:45 | 2024-02-24 16:20:45 |
Judging History
answer
#include <bits/stdc++.h>
#define fr first
#define sc second
#define all(a) (a).begin(), (a).end()
#define unique(a) a.resize(unique(a.begin(), a.end()) - a.begin())
using namespace std;
#ifdef ONPC
mt19937 rnd(223);
#else
mt19937 rnd(chrono::high_resolution_clock::now()
.time_since_epoch().count());
#endif
#define TIME (clock() * 1.0 / CLOCKS_PER_SEC)
using ll = long long;
using ld = double;
const int maxn = 1e5 + 100, inf = 1e9 + 100;
template<typename T>
using pq = priority_queue<T, vector<T>, greater<T>>;
void solve() {
int m, n, x;
cin >> m >> n >> x;
vector<int> c(n);
for (int& i : c)
cin >> i;
pq<pair<int, int>> q;
for (int i = 0; i < n; ++i) {
q.emplace(0, c[i]);
}
int ans = 0;
int ans2 = 0;
for (int i = 0; i < m; ++i) {
auto [tm, c] = q.top();
q.pop();
// cerr << tm << ' ' << c << endl;
if (tm + c <= x) {
++ans;
} else if (tm < x) {
++ans2;
}
q.emplace(tm + c, c);
}
cout << m - ans2 - ans << ' ' << ans2 << '\n';
}
int main() {
#ifdef ONPC
freopen("../a.in", "r", stdin);
// freopen("../a.out", "w", stdout);
#endif
ios::sync_with_stdio(0);
cin.tie(0);
cout << fixed;
cout.precision(20);
solve();
cerr << "\n\nConsumed " << TIME << endl;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3896kb
input:
2 1 1 1
output:
1 0
result:
ok 2 number(s): "1 0"
Test #2:
score: 0
Accepted
time: 0ms
memory: 4028kb
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: 3960kb
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: 3892kb
input:
1 1 10 1
output:
0 0
result:
ok 2 number(s): "0 0"
Test #5:
score: 0
Accepted
time: 0ms
memory: 4124kb
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: 3864kb
input:
8 2 7 12 13
output:
6 2
result:
ok 2 number(s): "6 2"
Test #7:
score: 0
Accepted
time: 0ms
memory: 4132kb
input:
1 1 1 2
output:
0 1
result:
ok 2 number(s): "0 1"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
12 2 11 8 3
output:
6 2
result:
ok 2 number(s): "6 2"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
2 2 12 24 1
output:
0 1
result:
ok 2 number(s): "0 1"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3936kb
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: 3852kb
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: 3996kb
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: 1ms
memory: 3896kb
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: 3996kb
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: 1ms
memory: 3996kb
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: 4064kb
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: 0ms
memory: 4056kb
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: 0ms
memory: 3852kb
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