Submission #679430

#TimeUsernameProblemLanguageResultExecution timeMemory
679430Chal1shkanEvacuation plan (IZhO18_plan)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

# define pb push_back
# define ff first
# define ss second
# define nl "\n"

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ll maxn = 1e5 + 25;
const ll maxl = 22 + 0;
const ll inf = 1e18 + 0;
const ll mod = 998244353;
const ll dx[] = {-1, 1, 0, 0};
const ll dy[] = {0, 0, -1, 1};

using namespace std;

ll n, k, q, d[maxn];
vector <pair <ll, ll> > g[maxn];

void dijkstra (ll s)
{
    set <pair <ll, ll> > q;
    q.push({0, s});
    while (!q.empty())
    {
        ll v = q.begin() -> ss;
        q.erase(q.begin());
        for (auto i : g[v])
        {
            ll to = i.ff, w = i.ss;
            if (d[v] + w < d[to])
            {
                q.erase({d[to], to});
                d[to] = d[v] + w;
                q.insert({d[to], to});
            }
        }
    }
}

void ma1n ()
{
    cin >> n >> m;
    for (ll i = 1; i <= n; ++i) d[i] = inf;
    for (ll i = 1; i <= m; ++i)
    {
        ll u, v, w;
        cin >> u >> v >> w;
        g[u].pb({v, w});
        g[v].pb({u, w});
    }
    cin >> k;
    for (ll i = 1; i <= n; ++i)
    {
        ll v;
        cin >> v;
        dijkstra(v);
    }
    cin >> q;
    for (ll i = 1; i <= q; ++i)
    {
        ll u, v;
        cin >> u >> v;
        cout << min(d[u], d[v]) << nl;
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    // freopen("mooyomooyo.in", "r", stdin);
    // freopen("mooyomooyo.out", "w", stdout);
    int ttt = 1;
//  cin >> ttt;
    for (int test = 1; test <= ttt; ++test)
    {
//      cout << "Case " << test << ":" << nl;
        ma1n();
    }
    return 0;
}

Compilation message (stderr)

plan.cpp: In function 'void dijkstra(ll)':
plan.cpp:27:7: error: 'class std::set<std::pair<long long int, long long int> >' has no member named 'push'
   27 |     q.push({0, s});
      |       ^~~~
plan.cpp: In function 'void ma1n()':
plan.cpp:47:17: error: 'm' was not declared in this scope
   47 |     cin >> n >> m;
      |                 ^