답안 #941836

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
941836 2024-03-09T14:38:41 Z Tuanlinh123 치료 계획 (JOI20_treatment) C++17
35 / 100
837 ms 524288 KB
#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 maxn=100005, inf=1e18;
vector <ll> A[maxn];
ll x[maxn], l[maxn], r[maxn], w[maxn], dis[maxn];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll n, m; cin >> n >> m;
    for (ll i=1; i<=m; i++)
        cin >> x[i] >> l[i] >> r[i] >> w[i], dis[i]=inf;
    for (ll i=1; i<=m; i++)
        for (ll j=1; j<=m; j++)
            if (l[j]<=r[i]-abs(x[i]-x[j])+1)
                A[i].pb(j);
    priority_queue <pll, vector <pll>, greater<pll>> q;
    for (ll i=1; i<=m; i++)
        if (l[i]==1) dis[i]=w[i], q.push({dis[i], i});
    while (!q.empty())
    {
        ll u=q.top().se, disu=q.top().fi; q.pop();
        if (dis[u]!=disu) continue;
        for (ll v:A[u])
            if (dis[v]>disu+w[v])
                dis[v]=disu+w[v], q.push({dis[v], v});
    }
    ll ans=inf;
    for (ll i=1; i<=m; i++)
        if (r[i]==n) ans=min(ans, dis[i]);
    if (ans==inf) cout << "-1";
    else cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 837 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 6492 KB Output is correct
2 Correct 2 ms 6492 KB Output is correct
3 Correct 2 ms 6492 KB Output is correct
4 Correct 2 ms 6492 KB Output is correct
5 Correct 2 ms 6488 KB Output is correct
6 Correct 2 ms 6492 KB Output is correct
7 Correct 2 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 2 ms 6492 KB Output is correct
10 Correct 2 ms 6492 KB Output is correct
11 Correct 2 ms 6492 KB Output is correct
12 Correct 2 ms 6488 KB Output is correct
13 Correct 2 ms 6492 KB Output is correct
14 Correct 2 ms 6492 KB Output is correct
15 Correct 2 ms 6488 KB Output is correct
16 Correct 2 ms 6492 KB Output is correct
17 Correct 2 ms 6488 KB Output is correct
18 Correct 2 ms 6492 KB Output is correct
19 Correct 2 ms 6544 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 6492 KB Output is correct
2 Correct 2 ms 6492 KB Output is correct
3 Correct 2 ms 6492 KB Output is correct
4 Correct 2 ms 6492 KB Output is correct
5 Correct 2 ms 6488 KB Output is correct
6 Correct 2 ms 6492 KB Output is correct
7 Correct 2 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 2 ms 6492 KB Output is correct
10 Correct 2 ms 6492 KB Output is correct
11 Correct 2 ms 6492 KB Output is correct
12 Correct 2 ms 6488 KB Output is correct
13 Correct 2 ms 6492 KB Output is correct
14 Correct 2 ms 6492 KB Output is correct
15 Correct 2 ms 6488 KB Output is correct
16 Correct 2 ms 6492 KB Output is correct
17 Correct 2 ms 6488 KB Output is correct
18 Correct 2 ms 6492 KB Output is correct
19 Correct 2 ms 6544 KB Output is correct
20 Correct 192 ms 135472 KB Output is correct
21 Correct 177 ms 135020 KB Output is correct
22 Correct 36 ms 9308 KB Output is correct
23 Correct 33 ms 9304 KB Output is correct
24 Correct 140 ms 99408 KB Output is correct
25 Correct 74 ms 69976 KB Output is correct
26 Correct 67 ms 66956 KB Output is correct
27 Correct 78 ms 80712 KB Output is correct
28 Correct 135 ms 98588 KB Output is correct
29 Correct 74 ms 69204 KB Output is correct
30 Correct 64 ms 77136 KB Output is correct
31 Correct 71 ms 82404 KB Output is correct
32 Correct 190 ms 126548 KB Output is correct
33 Correct 184 ms 195156 KB Output is correct
34 Correct 196 ms 125860 KB Output is correct
35 Correct 206 ms 126548 KB Output is correct
36 Correct 194 ms 194964 KB Output is correct
37 Correct 180 ms 125644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 837 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -