QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#370342#4089. 회의실seojinhyeong990 3ms4256kbC++171.9kb2024-03-29 02:14:252024-03-29 02:14:25

Judging History

你现在查看的是最新测评结果

  • [2024-03-29 02:14:25]
  • 评测
  • 测评结果:0
  • 用时:3ms
  • 内存:4256kb
  • [2024-03-29 02:14:25]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
typedef pair<int, int> pi;
typedef long long ll;
long long int min_charge(int K, vector<int> S, vector<int>E, vector<int>W) {
    int n, k;
    n = S.size();
    k = K;
    vector<array<ll, 3>>v(n);
    for (int i = 0; i < n; i++) {
        v[i] = { S[i],E[i],W[i] };
    }
    sort(v.begin(), v.end());
    vector<priority_queue<ll, vector<ll>, greater<ll>>>pq(n);
    vector<ll>d(n);
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (v[i][1] >= v[j][1]) {
                pq[i].push(v[j][2]);
                d[i] += v[j][2];
                if (pq[i].size() > k) {
                    d[i] -= pq[i].top();
                    pq[i].pop();
                }
            }
        }
    }
    vector<int>a(n);
    for (int i = 0; i < n; i++) a[i] = i;
    for (int i = 0; i < n; i++) {
        auto& cur = v[i];
        sum += cur[2];
        int e = i - 1;
        multiset<ll, greater<ll>>s;
        s.insert(0);
        for (int j = 0; j < i; j++) s.insert(d[j]);
        ll mx = d[i];
        for (int j = i; j >= 0; j--) {
            if (v[j][1] < cur[0]) break;
            if (v[j][1] > v[i][1]) continue;
            while (e >= 0 && v[a[e]][1] >= v[j][0]) {
                auto it = s.find(d[a[e--]]);
                s.erase(it);
            }
            ll base = *s.begin();
            pq[i].push(v[j][2]);
            d[i] += v[j][2];
            if (pq[i].size() > k) {
                d[i] -= pq[i].top();
                pq[i].pop();
            }
            mx = max(mx, d[i] + base);
        }
        d[i] = mx;
        sort(a.begin(), a.begin() + i, [&](int x, int y)->bool {
            return v[x][1] < v[y][1];
            });
        //cout<<i<<" : "<<mx<<"\n";
    }
    ll ans = 0;
    for (auto i : d) ans = max(ans, i);
    return sum - ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 10
Accepted
time: 1ms
memory: 3848kb

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: 4076kb

input:

1 1
260947663 693934985 986106006

output:

gxr40gvcqh-MEETING-rga0zuq58u
0

result:

ok 2 lines

Test #3:

score: 0
Accepted
time: 0ms
memory: 3784kb

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
5864098008

result:

ok 2 lines

Test #4:

score: 0
Accepted
time: 0ms
memory: 4028kb

input:

14 1
474097486 930251201 788591065
2688701 471061191 845510022
2688701 203686122 275418775
203686122 601081080 31535815
474097486 474097486 228315825
161901890 474097486 85031827
203686122 601081080 337856340
471061191 601081080 604276423
161332531 471061191 357335089
262608550 474097486 82141704
26...

output:

gxr40gvcqh-MEETING-rga0zuq58u
3746923312

result:

ok 2 lines

Test #5:

score: -10
Wrong Answer
time: 0ms
memory: 4068kb

input:

14 1
494186620 531108277 961242307
620452125 623567580 364091773
23975216 357841107 512604788
59502148 793676488 729004547
293504000 748896401 598615542
398747973 967374174 642479347
31019655 476793418 584205112
376644841 543109385 320093318
874414082 884558783 925710684
327711462 354634260 92343656...

output:

gxr40gvcqh-MEETING-rga0zuq58u
4454737188

result:

wrong answer 2nd lines differ - expected: '4831774383', found: '4454737188'

Subtask #2:

score: 0
Wrong Answer

Test #64:

score: 17
Accepted
time: 2ms
memory: 3832kb

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: 3ms
memory: 4068kb

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: 0
Accepted
time: 3ms
memory: 3816kb

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
115974717700

result:

ok 2 lines

Test #67:

score: -17
Wrong Answer
time: 3ms
memory: 3824kb

input:

248 1
712161748 857098296 483281188
635238057 843933145 219483541
840156851 968434599 289113173
233731925 667800790 975105667
79096556 418458947 932773275
294354627 806377423 40986123
446437143 698187074 966903557
51500257 286424379 266246550
547772784 737573545 102689016
604191629 896399185 6902062...

output:

gxr40gvcqh-MEETING-rga0zuq58u
116487163555

result:

wrong answer 2nd lines differ - expected: '116538147809', found: '116487163555'

Subtask #3:

score: 0
Wrong Answer

Test #88:

score: 32
Accepted
time: 3ms
memory: 4256kb

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: 3ms
memory: 3908kb

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: 3ms
memory: 4228kb

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
-83

result:

wrong answer 2nd lines differ - expected: '29', found: '-83'

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%