Submission #1167652

#TimeUsernameProblemLanguageResultExecution timeMemory
1167652herissonwowCommuter Pass (JOI18_commuter_pass)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#define ll long long
#define ld long double
#define en exit(0);
#define pb push_back
#define fi first
#define se second

using namespace std;

const int N = 1e5+5;
const ll INF = 1e18+5;
vector<pair<int,int> > g[N];
bool mark[N];
vector<ll> dijkstra(int st, int n)
{
    vector<ll> dist(n+1,INF);
    vector<bool> vis(n+1);
    priority_queue<pair<ll,int> > q;
    dist[st]=0;
    q.push({0,st});
    while(!q.empty())
    {
        int u = q.top().se;
        q.pop();
        if(vis[u])
            continue;
        vis[u]=1;
        for(auto [v,w]:g[u])
        {
            ll nwd = dist[u]+w;
            if(nwd<dist[v])
            {
                dist[v]=nwd;
                q.push({-nwd,v});
            }
        }
    }
    return dist;
}

int main()
{
    ios_base()::sync_with_stdio(false); cin.tie(0);
    int n, m, s, u, t, v; cin >> n >> m >> s >> u >> t >> v;

    for(int i = 0; i < m; i++){
        int a, b, c; cin >> a >> b >> c;
        g[a].push_back({b,c});
        g[b].push_back({a,c});
    }
    vector <long long> dS = dijkstra(s, n);
    vector <long long> dU = dijkstra(u, n);
    vector <long long> dV = dijkstra(v, n);
    int TOT = ds[t];
    for(int i = 1; i <= n; i++){
        if(dS[i]+dV[i]==TOT)
                marked[i]=1;
    }
    ll res = INF;
    for(int i = 1; i <= n; i++){
        if(marked[i]){
            res= min(res, dV[i]);
        }
    }
    cout << res;
    return 0;
}

Compilation message (stderr)

commuter_pass.cpp: In function 'int main()':
commuter_pass.cpp:46:14: error: 'std::ios_base::ios_base()' is protected within this context
   46 |     ios_base()::sync_with_stdio(false); cin.tie(0);
      |              ^
In file included from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from commuter_pass.cpp:1:
/usr/include/c++/11/bits/ios_base.h:879:5: note: declared protected here
  879 |     ios_base() throw ();
      |     ^~~~~~~~
commuter_pass.cpp:46:15: error: expected ';' before '::' token
   46 |     ios_base()::sync_with_stdio(false); cin.tie(0);
      |               ^~
      |               ;
commuter_pass.cpp:57:15: error: 'ds' was not declared in this scope; did you mean 'dS'?
   57 |     int TOT = ds[t];
      |               ^~
      |               dS
commuter_pass.cpp:60:17: error: 'marked' was not declared in this scope; did you mean 'mark'?
   60 |                 marked[i]=1;
      |                 ^~~~~~
      |                 mark
commuter_pass.cpp:64:12: error: 'marked' was not declared in this scope; did you mean 'mark'?
   64 |         if(marked[i]){
      |            ^~~~~~
      |            mark