QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#375518 | #4089. 회의실 | tuanlinh123 | 0 | 0ms | 4076kb | C++20 | 1.6kb | 2024-04-03 11:47:35 | 2024-04-03 11:47:36 |
answer
#include "meeting.h"
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
#define sz(a) ((ll)(a).size())
using namespace std;
const ll inf=1e18;
struct BIT
{
ll n;
vector <ll> bit;
BIT (ll n): n(n) {bit.assign(n+5, 0);}
void upd(ll i, ll val)
{
for (++i; i<=n; i+=i&(-i))
bit[i]+=val;
}
void update(ll l, ll r, ll val) {
upd(l, val), upd(r+1, -val);}
ll query(ll i)
{
ll ans=0;
for (++i; i; i-=i&(-i))
ans+=bit[i];
return ans;
}
};
long long min_charge(int K, vector<int> s, vector<int> e, vector<int> w)
{
ll n=sz(w);
vector <ll> num;
for (ll i=0; i<n; i++)
num.pb(s[i]), num.pb(e[i]);
sort(num.begin(), num.end());
num.resize(unique(num.begin(), num.end())-num.begin());
ll k=sz(num);
vector <ll> dp(k+1, inf); dp[0]=0;
vector <vector <pll>> H(k+1);
for (ll i=0; i<n; i++)
{
s[i]=lower_bound(num.begin(), num.end(), s[i])-num.begin()+1;
e[i]=lower_bound(num.begin(), num.end(), e[i])-num.begin()+1;
H[e[i]].pb({s[i], w[i]});
}
BIT A(k+1), B(k+1);
for (ll i=1; i<=k; i++)
{
for (auto [l, w]:H[i])
A.update(0, l-1, 1), B.update(l, i-1, w);
for (ll j=0; j<=i; j++)
{
if (A.query(j)>K) continue;
dp[i]=min(dp[i], dp[j]+B.query(j));
}
}
return dp[k];
}
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: 3716kb
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: 3816kb
input:
1 1 260947663 693934985 986106006
output:
gxr40gvcqh-MEETING-rga0zuq58u 0
result:
ok 2 lines
Test #3:
score: -10
Wrong Answer
time: 0ms
memory: 4076kb
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: 3780kb
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: 3804kb
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%