QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#689531#6606. The Boomsday Projectbright_mlWA 904ms606672kbC++201.8kb2024-10-30 17:35:272024-10-30 17:35:27

Judging History

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

  • [2024-10-30 17:35:27]
  • 评测
  • 测评结果:WA
  • 用时:904ms
  • 内存:606672kb
  • [2024-10-30 17:35:27]
  • 提交

answer

//
// Created by 35395 on 2024/10/30.
//
#include<bits/stdc++.h>

using namespace std;
using i64 = long long;
const int N = 510;
const int M = 100010;
array<int, 3> a[N];
pair<int, int> d[M];
#define PII pair<int,int>
#define fi first
#define se second
int b[3 * M];
int nxt[3 * M][N];//第i个位置用第j种边可以到达哪里
i64 dp[3 * M];
int du[3 * M];

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m, cost;
    cin >> n >> m >> cost;
    for (int i = 1; i <= n; i++) {
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    }
    for (int i = 1; i <= m; i++) {
        cin >> d[i].fi >> d[i].se;
    }
    sort(a + 1, a + n + 1, [&](auto x, auto y) {
        return x[2] * y[1] < y[2] * x[1];
    });
    sort(d + 1, d + 1 + m);
    int idx = 0;
    for (int i = 1; i <= m; i++) {
        while (d[i].se) {
            d[i].se--;
            b[++idx] = d[i].fi;
        }
    }
    for (int i = 1; i <= min(350,n); i++) {
        for (int j = 1, r = -1; j <= idx; j++) {
            while (r != idx && (r + 1 - j + 1 <= a[i][1] && b[r + 1] - b[j] + 1 <= a[i][0]))r++;
            nxt[j][i] = r + 1;
            du[r + 1]++;
        }
    }
    idx++;
    for (int i = 2; i <= idx; i++) {
        du[i]++;
    }
    for (int i = 1; i < idx; i++) {
        nxt[i][0] = i + 1;
    }
    for (int i = 0; i <= idx; i++) {
        dp[i] = 1e18;
    }
    dp[1] = 0;
    queue<int> q;
    a[0][2] = cost;
    q.push(1);
    while (q.size()) {
        auto t = q.front();
        q.pop();
        for (int i = 0; i <= min(350, n); i++) {
            int j = nxt[t][i];
            int w = a[i][2];
            du[j]--;
            if (du[j] == 0)q.push(j);
            dp[j] = min(dp[j], dp[t] + w);
        }
    }
    cout << dp[idx] << endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 9936kb

input:

2 1 10
1 3 12
1 2 9
1 10

output:

42

result:

ok 1 number(s): "42"

Test #2:

score: 0
Accepted
time: 1ms
memory: 9756kb

input:

2 4 10
1 3 12
1 2 9
1 3
2 3
3 3
4 1

output:

45

result:

ok 1 number(s): "45"

Test #3:

score: 0
Accepted
time: 872ms
memory: 583324kb

input:

500 100 1000
95 20 20892
73 627 55354
52 747 1404314
19 676 597007
65 814 1569851
91 397 691575
81 4 4575
97 382 624404
21 197 201850
67 799 643576
27 895 1510533
3 800 552439
49 954 1149851
70 892 676406
82 882 1348956
1 318 324094
43 238 439111
94 397 471003
16 119 130686
1 637 77731
79 292 35234
...

output:

450790

result:

ok 1 number(s): "450790"

Test #4:

score: 0
Accepted
time: 888ms
memory: 606672kb

input:

500 100 1000
8 910 1405086
65 931 697221
73 534 1051699
74 13 7497
64 631 991592
79 481 511568
92 892 477132
91 588 842013
21 389 750794
19 955 1333270
85 889 1334457
46 295 505372
83 486 449366
67 67 119659
82 446 408487
25 736 319997
31 889 23280
1 41 74813
93 928 1189573
88 468 455471
7 10 18865
...

output:

3276270

result:

ok 1 number(s): "3276270"

Test #5:

score: 0
Accepted
time: 814ms
memory: 554152kb

input:

500 100 1000
35 122 153490
71 121 27207
73 967 409546
88 325 182835
37 602 533155
61 546 114146
70 359 251186
64 429 591088
63 445 428802
81 819 408704
49 364 244867
64 937 1422956
98 505 713891
1 454 61697
91 673 116038
89 463 123737
67 724 1061372
31 1 1838
73 127 173419
72 122 8068
55 928 65539
3...

output:

762564

result:

ok 1 number(s): "762564"

Test #6:

score: 0
Accepted
time: 897ms
memory: 601848kb

input:

500 100 1000
77 590 825100
67 901 1633566
29 703 886708
86 223 168970
6 676 1162365
46 669 1308904
73 96 125961
37 529 774376
79 741 516927
95 835 602321
25 208 384673
16 20 12510
41 226 164928
68 836 1412302
52 689 418717
40 481 789905
10 838 220638
35 846 885451
54 736 1470524
13 490 224433
12 354...

output:

300840

result:

ok 1 number(s): "300840"

Test #7:

score: 0
Accepted
time: 837ms
memory: 554232kb

input:

500 100 1000
39 154 45298
34 357 85100
46 557 748764
24 896 665708
97 28 1885
42 668 1223574
53 614 669616
28 648 1145794
28 649 1208449
93 689 1227367
56 772 163614
54 468 462959
28 400 721934
25 391 208246
55 388 473486
67 106 55488
63 10 18506
6 113 191992
43 100 165666
29 952 1200973
79 519 5596...

output:

1147818

result:

ok 1 number(s): "1147818"

Test #8:

score: 0
Accepted
time: 873ms
memory: 584524kb

input:

500 100 1000
25 155 54027
94 392 88410
71 600 1051186
31 391 104487
28 851 1539952
37 30 20168
26 722 164500
79 802 967771
68 481 152325
53 46 19203
91 445 398966
98 418 250634
96 387 128328
3 439 679797
13 201 81420
7 10 2504
75 139 213047
19 289 499368
1 100 44418
67 834 737897
87 235 57104
76 943...

output:

42900

result:

ok 1 number(s): "42900"

Test #9:

score: 0
Accepted
time: 760ms
memory: 510172kb

input:

500 100 1000
51 42 16628
43 190 172609
19 71 111541
5 307 90084
24 370 464785
40 728 4358
70 289 140870
12 834 1379849
1 832 380970
57 788 14539
99 217 116555
22 293 75003
64 508 504262
76 757 745132
82 508 111516
48 447 728589
94 91 128698
34 689 724690
55 206 140536
19 6 11110
54 148 284655
82 577...

output:

441300

result:

ok 1 number(s): "441300"

Test #10:

score: 0
Accepted
time: 857ms
memory: 572092kb

input:

500 100 1000
34 971 1557997
38 468 536953
16 133 88701
46 139 79800
35 5 2908
43 991 771999
55 595 439720
10 1 1409
20 235 373255
72 178 218511
67 164 252433
70 155 22009
46 838 1434022
29 13 16155
43 694 721903
1 142 134637
10 206 232264
79 235 138874
91 964 1840417
46 379 36314
91 541 105296
82 74...

output:

3846908

result:

ok 1 number(s): "3846908"

Test #11:

score: 0
Accepted
time: 904ms
memory: 606360kb

input:

500 100 1000
78 680 93658
91 681 935976
27 885 1219969
74 426 233941
88 143 257524
55 743 1279359
4 841 807430
52 61 58591
37 515 992872
67 440 525617
37 119 4821
96 164 47048
53 98 41919
46 451 804734
71 440 377656
45 988 1339930
79 983 1954579
14 16 8209
45 496 165715
46 391 163844
64 334 585656
3...

output:

147840

result:

ok 1 number(s): "147840"

Test #12:

score: 0
Accepted
time: 897ms
memory: 603476kb

input:

500 100 1000
17 337 520830
13 320 435598
34 344 332171
1 779 442379
32 280 282
55 615 1050064
55 55 101465
49 434 119384
33 728 285107
37 378 345293
4 575 419615
18 929 254491
10 82 30957
57 704 240496
55 39 9470
63 193 273163
27 208 298983
45 721 493246
20 427 255468
76 733 1062484
91 514 670590
1 ...

output:

300330

result:

ok 1 number(s): "300330"

Test #13:

score: -100
Wrong Answer
time: 902ms
memory: 605956kb

input:

500 100 500000
88 337 305883611
41 175 37057752
49 55 39547475
40 419 77409822
53 926 95898196
88 305 282306241
64 472 150142072
67 722 627918523
64 734 45315633
97 396 275395403
67 341 286394272
1 808 40798374
54 763 4529294
30 206 157558711
72 937 593507461
39 967 634291057
73 279 193814503
22 166...

output:

57599345

result:

wrong answer 1st numbers differ - expected: '7958679', found: '57599345'