QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#394000 | #2536. Akcija | lfxxx# | 0 | 1ms | 4012kb | C++17 | 1.2kb | 2024-04-19 20:28:28 | 2024-07-04 03:36:41 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) (x).begin(), (x).end()
bool be;
constexpr int N = 2005;
int n, k;
struct Node {
int w, d;
}a[N];
struct node {
int val;
vector<int>v;
inline bool operator < (node c) const {
return val > c.val;
}
}b;
void getv()
{
priority_queue<pii>q;
for (int i = 1; i <= n; ++i) {
if (q.size() < a[i].d) {
q.emplace(a[i].w, i);
} else {
if (q.top().first > a[i].w) {
q.pop();
q.emplace(a[i].w, i);
}
}
}
while (!q.empty()) {
b.v.emplace_back(q.top().second);
b.val += q.top().first;
q.pop();
}
}
bool en;
int main() {
cerr << (&be - &en) / 1024.0 / 1024 << " MB\n--------------------------------" << endl;
#ifdef IAKIOI
freopen("in.in", "r", stdin);
// freopen("out.out", "w", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> k;
for (int i = 1; i <= n; ++i) {
cin >> a[i].w >> a[i].d;
}
sort(a + 1, a + 1 + n, [](Node a, Node b) {
if (a.d != b.d) return a.d < b.d;
return a.w < b.w;
});
getv();
cout << b.v.size() << ' ' << b.val << endl;
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3832kb
input:
1919 1 126746165 1373 126746165 1621 126746165 1157 126746165 1647 126746165 1046 126746165 1626 126746165 813 126746165 1197 126746165 1240 126746165 738 126746165 840 126746165 571 126746165 1712 126746165 109 126746165 1850 126746165 524 126746165 736 126746165 917 126746165 1520 126746165 1559 1...
output:
1893 -587678231
result:
wrong answer 1st lines differ - expected: '1893 239930490345', found: '1893 -587678231'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #27:
score: 0
Wrong Answer
time: 0ms
memory: 3900kb
input:
1919 2 126746165 1373 668827372 1621 842598033 1157 119717982 1647 527842278 1046 492815129 1626 917098873 813 346103003 1197 144760418 1240 339840086 738 518170881 840 527423104 571 783646464 1712 77685618 109 74284316 1850 300769843 524 944005181 736 969138120 917 789000286 1520 358649048 1559 189...
output:
1893 -1984353767
result:
wrong answer 1st lines differ - expected: '1893 934318516761', found: '1893 -1984353767'
Subtask #4:
score: 0
Wrong Answer
Test #40:
score: 0
Wrong Answer
time: 0ms
memory: 3784kb
input:
19 1910 872059530 14 567896598 17 515371564 12 609933207 17 421749461 11 993851818 17 897732743 9 76274388 12 362276371 13 93554371 8 695969254 9 21709341 6 395396341 17 894018749 2 835539456 19 150700500 6 934168428 8 934249073 10 508532761 16
output:
18 1197197544
result:
wrong answer 1st lines differ - expected: '18 9787132136', found: '18 1197197544'
Subtask #5:
score: 0
Wrong Answer
Test #53:
score: 0
Wrong Answer
time: 0ms
memory: 4012kb
input:
96 96 390531470 69 349016804 82 612244127 58 41258987 83 470944790 53 681046579 82 109569778 41 700928268 60 224279712 63 681889278 37 173204769 43 701269722 29 624757038 86 271969787 6 444924884 93 500697380 27 509702566 37 262449977 46 669488879 77 170692294 78 362932916 51 118514404 47 724509790 ...
output:
94 -67778681
result:
wrong answer 1st lines differ - expected: '94 42881894279', found: '94 -67778681'
Subtask #6:
score: 0
Skipped
Dependency #1:
0%