Submission #1320542

#TimeUsernameProblemLanguageResultExecution timeMemory
1320542asafeRobot (JOI21_ho_t4)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vii vector<pair<int,int>>
#define vll vector<long long>
#define pb push_back
#define pll pair<long long ,long long>
#define pf push_front
#define ql cout<<endl;
#define f first
#define s second
#define int ll
const ll inf=1e18;
const int maxn= 1e5+5;
int n,m;
vector<tuple<int,int,int>> g[maxn];
int neighbour[maxn][2*maxn];
int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n>>m;

    for(int i=0;i<m;i++){
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        g[a].pb({b,c,d});
        g[b].pb({a,c,d});
        neighbour[a][c]++;
        neighbour[b][c]++;
    }

    priority_queue<pii,vii,greater<pii>>q;
    vi dist(n+1,inf);
    vi bt(n+1,0);
    q.push({0,1});
    dist[1]=0;
    while(!q.empty()){
        auto[du,u]=q.top();
        q.pop();
        if(bt[u])continue;
        bt[u]=1;
        for(auto[viz,color,price] : g[u]){
            int d=(neighbour[u][color]>1 ? price : 0);

            if(dist[viz]>du+d){
                q.push({du+d,viz});
                dist[viz]=du+d;
            }
        }

        
    }

    cout<<(dist[n]==inf ? -1 : dist[n]);

}

Compilation message (stderr)

/tmp/ccaBQsB3.o: in function `__tcf_0':
Main.cpp:(.text+0x9): relocation truncated to fit: R_X86_64_PC32 against symbol `g' defined in .bss section in /tmp/ccaBQsB3.o
/tmp/ccaBQsB3.o: in function `main':
Main.cpp:(.text.startup+0xf): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/13/libstdc++.a(globals_io.o)
Main.cpp:(.text.startup+0x39): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccaBQsB3.o
Main.cpp:(.text.startup+0x43): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/13/libstdc++.a(globals_io.o)
Main.cpp:(.text.startup+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccaBQsB3.o
Main.cpp:(.text.startup+0x62): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccaBQsB3.o
Main.cpp:(.text.startup+0x93): relocation truncated to fit: R_X86_64_PC32 against symbol `g' defined in .bss section in /tmp/ccaBQsB3.o
Main.cpp:(.text.startup+0x152): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccaBQsB3.o
Main.cpp:(.text.startup+0x463): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccaBQsB3.o
Main.cpp:(.text.startup+0x49c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccaBQsB3.o
Main.cpp:(.text.startup+0x56a): additional relocation overflows omitted from the output
/usr/lib/gcc/x86_64-linux-gnu/13/libstdc++.a(ios_init.o): in function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x1f): failed to convert GOTPCREL relocation against '_ZNSt8ios_base4Init11_S_refcountE'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x1ed): failed to convert GOTPCREL relocation against '_ZSt4cout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x252): failed to convert GOTPCREL relocation against '_ZSt3cin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x2bc): failed to convert GOTPCREL relocation against '_ZSt4cerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x316): failed to convert GOTPCREL relocation against '_ZSt4clog'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x50f): failed to convert GOTPCREL relocation against '_ZSt5wcout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x57d): failed to convert GOTPCREL relocation against '_ZSt4wcin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x5f0): failed to convert GOTPCREL relocation against '_ZSt5wcerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x654): failed to convert GOTPCREL relocation against '_ZSt5wclog'; relink with --no-relax
/usr/bin/ld: final link failed
collect2: error: ld returned 1 exit status