답안 #349927

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
349927 2021-01-18T17:42:30 Z idk321 악어의 지하 도시 (IOI11_crocodile) C++11
0 / 100
3 ms 4204 KB
#include "crocodile.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

const int N = 100001;
const ll M = 2000000000000000000LL;
vector<array<int, 2>> adj[N];
vector<array<ll, 2>> path(N, {M, M});
bool vis[N];


int travel_plan(int n, int m, int r[][2], int l[], int k, int p[])
{
    for (int i = 0; i < m; i++)
    {
        adj[r[i][0]].push_back({r[i][1], l[i]});
        adj[r[i][1]].push_back({r[i][0], l[i]});
    }

    priority_queue<array<ll, 2>> pq;
    for (int i = 0; i < k; i++)
    {
        int node = p[i];
        path[node] = {0, 0};
        pq.push({0, node});
    }

    while (!pq.empty())
    {
        int node = pq.top()[1];
        ll dist = pq.top()[0];
        pq.pop();
        if (vis[node]) continue;
        vis[node] = true;
        for (auto next : adj[node])
        {
            if (vis[next[0]]) continue;
            array<ll, 3> ar {path[next[0]][0], path[next[0]][1], dist + next[1]};
            sort(ar.begin(), ar.end());
            path[next[0]][0] = ar[0];
            path[next[0]][1] = ar[1];
            if (path[next[0]][1] != M) pq.push({path[next[0]][1], next[0]});
        }
    }

  return path[0][1];
}

///home/domen/Downloads/crocodile/crocodile.cpp|19|error: request for member ‘push_back’ in ‘(*(r + ((sizetype)(((long unsigned int)i) * 8))))[1]’, which is of non-class type ‘int’|

# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4204 KB Output isn't correct
2 Halted 0 ms 0 KB -