QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#375504 | #4089. 회의실 | hotboy2703 | 0 | 0ms | 4092kb | C++14 | 2.1kb | 2024-04-03 11:36:12 | 2024-04-03 11:36:12 |
answer
#include "meeting.h"
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
#define pll pair <ll,ll>
#define fi first
#define se second
#define sz(a) (ll((a).size()))
#define BIT(mask,i) (((mask) >> (i))&1)
#define MASK(i) (1LL << (i))
#define MP make_pair
namespace {
ll n,k;
const ll MAXN = 2.5e3;
const ll INF = 1e18;
ll s[MAXN+100];
ll e[MAXN+100];
ll w[MAXN+100];
vector <ll> val;
ll dp[2 * MAXN + 100];
ll solve(){
for (ll i = 1;i <= n;i ++){
val.push_back(s[i]);
val.push_back(e[i]);
}
sort(val.begin(),val.end());
val.resize(unique(val.begin(),val.end())-val.begin());
for (ll i = 1;i <= n;i ++){
s[i] = lower_bound(val.begin(),val.end(),s[i])-val.begin()+1;
e[i] = lower_bound(val.begin(),val.end(),e[i])-val.begin()+1;
}
vector <ll> rg;
for (ll i = 1;i <= sz(val);i ++)dp[i] = INF;
for (ll i = 1;i <= n;i ++)rg.push_back(i);
sort(rg.begin(),rg.end(),[](ll x,ll y){return e[x] < e[y];});
// for (ll i = 1;i <= n;i ++){
// cout<<s[i]<<' '<<e[i]<<endl;
// }
dp[0] = 0;
for (ll i = 0;i <= sz(val);i ++){
ll cnt = 0;
ll cost = 0;
// cout<<i<<' '<<dp[i]<<endl;
for (ll j = i + 1,ptr = 0;j <= 2*n;j ++){
while (ptr<sz(rg) && e[rg[ptr]] <= j){
// cout<<"WOW "<<ptr<<' '<<rg[ptr]<<' '<<e[rg[ptr]]<<endl;
cost += (e[rg[ptr]] >= i + 1 && s[rg[ptr]] <= i) * w[rg[ptr]];
cnt+=s[rg[ptr]]>i;
ptr++;
}
// cout<<i<<' '<<j<<' '<<dp[i]<<' '<<cost<<' '<<cnt<<endl;
if (cnt<=k)dp[j] = min(dp[j],dp[i]+cost);
}
}
return dp[sz(val)];
}
}
long long min_charge(int K, std::vector<int> S, std::vector<int> E, std::vector<int> W) {
n = sz(S);
k = K;
for (ll i = 1;i <= n;i ++)s[i] = S[i-1],e[i] = E[i-1],w[i] = W[i-1];
return solve();
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 10
Accepted
time: 0ms
memory: 3808kb
input:
5 1 2 6 5 4 6 2 8 8 5 1 3 4 6 8 7
output:
gxr40gvcqh-MEETING-rga0zuq58u 12
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
1 1 260947663 693934985 986106006
output:
gxr40gvcqh-MEETING-rga0zuq58u 0
result:
ok 2 lines
Test #3:
score: -10
Wrong Answer
time: 0ms
memory: 3812kb
input:
14 1 623816097 623816097 68434400 623816097 623816097 725559682 623816097 623816097 678758318 623816097 623816097 368499632 623816097 623816097 495567409 623816097 623816097 236794280 623816097 623816097 779885584 623816097 623816097 879061467 623816097 623816097 537101862 623816097 623816097 465992...
output:
gxr40gvcqh-MEETING-rga0zuq58u 1000000000000000000
result:
wrong answer 2nd lines differ - expected: '5864098008', found: '1000000000000000000'
Subtask #2:
score: 0
Wrong Answer
Test #64:
score: 0
Wrong Answer
time: 0ms
memory: 4064kb
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 1000000000000000000
result:
wrong answer 2nd lines differ - expected: '119894782350', found: '1000000000000000000'
Subtask #3:
score: 0
Wrong Answer
Test #88:
score: 0
Wrong Answer
time: 0ms
memory: 4092kb
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 1000000000000000000
result:
wrong answer 2nd lines differ - expected: '113', found: '1000000000000000000'
Subtask #4:
score: 0
Skipped
Dependency #1:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%