QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#375549 | #4089. 회의실 | Skyan | 0 | 1ms | 4092kb | C++23 | 1.3kb | 2024-04-03 12:24:08 | 2024-04-03 12:24:08 |
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]] - 1;
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];
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3844kb
input:
5 1 2 6 5 4 6 2 8 8 5 1 3 4 6 8 7
output:
gxr40gvcqh-MEETING-rga0zuq58u -2
result:
wrong answer 2nd lines differ - expected: '12', found: '-2'
Subtask #2:
score: 0
Wrong Answer
Test #64:
score: 0
Wrong Answer
time: 1ms
memory: 4092kb
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 -988990595
result:
wrong answer 2nd lines differ - expected: '119894782350', found: '-988990595'
Subtask #3:
score: 0
Wrong Answer
Test #88:
score: 0
Wrong Answer
time: 1ms
memory: 3836kb
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 -135
result:
wrong answer 2nd lines differ - expected: '113', found: '-135'
Subtask #4:
score: 0
Skipped
Dependency #1:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%