QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#689561#6606. The Boomsday Projectbright_mlWA 785ms583448kbC++201.8kb2024-10-30 17:44:482024-10-30 17:44:49

Judging History

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

  • [2024-10-30 17:44:49]
  • 评测
  • 测评结果:WA
  • 用时:785ms
  • 内存:583448kb
  • [2024-10-30 17:44:48]
  • 提交

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 (__int128)x[0] * x[1] * y[2] < (__int128)y[0] * y[1] * x[2];
    });
    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(300, 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(300, 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: 9744kb

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: 0ms
memory: 7860kb

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: -100
Wrong Answer
time: 785ms
memory: 583448kb

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:

18505441

result:

wrong answer 1st numbers differ - expected: '450790', found: '18505441'