QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#375546 | #4089. 회의실 | Skyan | 0 | 1ms | 4140kb | C++23 | 1.3kb | 2024-04-03 12:18:28 | 2024-04-03 12:18:29 |
answer
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;
map<int, int> m;
long long int z = 0, f[5005];
vector<pair<int, int>> g[5005], gg[5005];
long long int min_charge(int k, vector<int> s, vector<int> e, vector<int> w) {
vector<int> v;
for (int w : s) v.push_back(w);
for (int w : e) v.push_back(w + 1);
sort(v.begin(), v.end());
for (int w : v) {
if (!m.count(w)) {
m[w] = ++z;
}
}
int n = s.size();
for (int i = 0; i < n; i++) {
s[i] = m[s[i]];
e[i] = m[e[i]];
g[s[i]].push_back({e[i], w[i]});
gg[e[i]].push_back({s[i], w[i]});
}
for (int i = 1; i <= z; i++) {
priority_queue<long long int> q;
f[i] = 1e18;
long long int c = 0;
for (int j = i; j >= 1; j--) {
for (auto w : gg[j]) {
c += w.second;
}
for (auto w : g[j]) {
if (w.first <= i) {
c -= w.second;
q.push(-w.second);
while (q.size() > k) {
c -= q.top();
q.pop();
}
}
}
f[i] = min(f[i], f[j - 1] + c);
}
}
return f[z];
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 4072kb
input:
5 1 2 6 5 4 6 2 8 8 5 1 3 4 6 8 7
output:
gxr40gvcqh-MEETING-rga0zuq58u 5
result:
wrong answer 2nd lines differ - expected: '12', found: '5'
Subtask #2:
score: 0
Wrong Answer
Test #64:
score: 17
Accepted
time: 1ms
memory: 3824kb
input:
248 1 798307257 798307257 359993686 798307257 798307257 812363141 798307257 798307257 872983330 798307257 798307257 537223276 798307257 798307257 375626816 798307257 798307257 518196362 798307257 798307257 474572280 798307257 798307257 277617903 798307257 798307257 473712578 798307257 798307257 5366...
output:
gxr40gvcqh-MEETING-rga0zuq58u 119894782350
result:
ok 2 lines
Test #65:
score: 0
Accepted
time: 1ms
memory: 3828kb
input:
248 1 106716204 134413027 820571410 639195985 658024378 685768282 22383466 885531934 273730628 106716204 885531934 67224076 106716204 885531934 984556051 151623368 527066675 495233434 106716204 538526558 54768332 134413027 538526558 885649153 106716204 885531934 467319104 508538911 527066675 2628753...
output:
gxr40gvcqh-MEETING-rga0zuq58u 123443346507
result:
ok 2 lines
Test #66:
score: -17
Wrong Answer
time: 0ms
memory: 4140kb
input:
248 1 459464034 997962180 761229184 227479654 273550682 80511490 174747895 624745165 534879740 130619474 752848651 703375936 110505930 869151139 645656606 174430647 777916252 351250186 320313925 357598946 932041340 214550801 265733786 381197847 199191480 512169278 290848269 214550801 569697779 88717...
output:
gxr40gvcqh-MEETING-rga0zuq58u -78016303761
result:
wrong answer 2nd lines differ - expected: '115974717700', found: '-78016303761'
Subtask #3:
score: 0
Wrong Answer
Test #88:
score: 32
Accepted
time: 0ms
memory: 3828kb
input:
248 135 806992812 806992812 1 806992812 806992812 1 806992812 806992812 1 806992812 806992812 1 806992812 806992812 1 806992812 806992812 1 806992812 806992812 1 806992812 806992812 1 806992812 806992812 1 806992812 806992812 1 806992812 806992812 1 806992812 806992812 1 806992812 806992812 1 806992...
output:
gxr40gvcqh-MEETING-rga0zuq58u 113
result:
ok 2 lines
Test #89:
score: 0
Accepted
time: 1ms
memory: 3900kb
input:
248 40 377400510 615563728 1 533035619 865270129 1 320586735 587946481 1 432205649 615563728 1 320586735 615563728 1 723259390 723259390 1 467410161 587946481 1 467410161 467410161 1 533035619 587946481 1 533035619 615563728 1 377400510 723259390 1 432205649 865270129 1 320586735 377400510 1 3205867...
output:
gxr40gvcqh-MEETING-rga0zuq58u 168
result:
ok 2 lines
Test #90:
score: -32
Wrong Answer
time: 1ms
memory: 3808kb
input:
248 217 147347540 594161740 1 723258860 877210169 1 425066537 464064708 1 1869932 404268491 1 411187789 594161740 1 610041829 934781812 1 445073195 464263549 1 169499667 523255757 1 154234015 607147611 1 223642273 275350834 1 106759254 754292364 1 607766410 903195689 1 147347540 580630975 1 18977368...
output:
gxr40gvcqh-MEETING-rga0zuq58u -218
result:
wrong answer 2nd lines differ - expected: '29', found: '-218'
Subtask #4:
score: 0
Skipped
Dependency #1:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%