답안 #1000228

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1000228 2024-06-17T06:45:49 Z ALTAKEXE 은하철도 (APIO24_train) C++17
5 / 100
57 ms 15932 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
vector<array<int, 4>> adj[200005];
ll dist[200005];
long long solve(int n, int m, int w, std::vector<int> T, std::vector<int> X, std::vector<int> Y,
                std::vector<int> A, std::vector<int> B, std::vector<int> C, std::vector<int> L,
                std::vector<int> R)
{
  for (int i = 0; i < n; i++)
    adj[i].clear();
  for (int i = 0; i < m; i++)
    adj[X[i]].push_back({A[i], B[i], Y[i], C[i]});
  for (int i = 0; i < n; i++)
    sort(adj[i].begin(), adj[i].end());
  dist[0] = 0;
  for (int i = 1; i < n; i++)
    dist[i] = LLONG_MAX;
  priority_queue<array<ll, 3>, vector<array<ll, 3>>, greater<array<ll, 3>>> pq;
  pq.push({0, 0, 0});
  while (pq.size())
  {
    auto [cost, tim, node] = pq.top();
    pq.pop();
    if (cost > dist[node])
      continue;
    dist[node] = cost;
    for (auto [l, r, y, c] : adj[node])
      if (l >= tim && cost + c < dist[y])
        pq.push({cost + c, r, y});
  }
  return (dist[n - 1] == LLONG_MAX ? -1 : dist[n - 1]);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 5208 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 11860 KB Correct.
2 Correct 54 ms 13192 KB Correct.
3 Correct 2 ms 4956 KB Correct.
4 Correct 13 ms 6492 KB Correct.
5 Correct 2 ms 4956 KB Correct.
6 Correct 38 ms 12368 KB Correct.
7 Correct 2 ms 4956 KB Correct.
8 Correct 50 ms 15932 KB Correct.
9 Correct 55 ms 13396 KB Correct.
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 11860 KB Correct.
2 Correct 54 ms 13192 KB Correct.
3 Correct 2 ms 4956 KB Correct.
4 Correct 13 ms 6492 KB Correct.
5 Correct 2 ms 4956 KB Correct.
6 Correct 38 ms 12368 KB Correct.
7 Correct 2 ms 4956 KB Correct.
8 Correct 50 ms 15932 KB Correct.
9 Correct 55 ms 13396 KB Correct.
10 Incorrect 57 ms 13756 KB Wrong Answer.
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 5208 KB Wrong Answer.
2 Halted 0 ms 0 KB -