Submission #1228997

#TimeUsernameProblemLanguageResultExecution timeMemory
1228997Rokas159Circle Passing (EGOI24_circlepassing)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

// #define int long long
#define endl '\n'

const int MAXN = 5e8+1;

int n, m, Q;

vector<int> adj[2*MAXN];

signed main() {
    cin.tie(nullptr); cout.tie(nullptr);
    ios_base::sync_with_stdio(false);


    cin >> n >> m >> Q;

    for (int i = 0; i < m; i++) {
        int k;
        cin >> k;

        adj[k].push_back((k+n)%(2*n));
        adj[(k+n)%(2*n)].push_back(k);
    }

    for (int i = 0; i < 2*n; i++) {
        adj[i].push_back((i+1)%(2*n));
        adj[(i+1)%(2*n)].push_back(i);
    }

    int dist[2*n];
    vector<bool> vis(2*n, false);

    queue<int> q;
    q.push(0);
    dist[0] = 0;

    while (!q.empty()) {
        int s = q.front();
        q.pop();

        vis[s] = true;

        for (int u : adj[s]) {
            if (!vis[u]) {
                dist[u] = dist[s] + 1;
                vis[u] = true;
                q.push(u);
            }
        }
    }

    for (int i = 0; i < Q; i++) {
        int a, b;
        cin >> a >> b;

        cout << dist[b] << endl;
    }

    cout.flush();
    return 0;
}

Compilation message (stderr)

/tmp/ccl3Dwc7.o: in function `main':
Main.cpp:(.text.startup+0x2c): 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/11/libstdc++.a(globals_io.o)
Main.cpp:(.text.startup+0x37): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cout' defined in .bss._ZSt4cout section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
Main.cpp:(.text.startup+0x47): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccl3Dwc7.o
Main.cpp:(.text.startup+0x4e): 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/11/libstdc++.a(globals_io.o)
Main.cpp:(.text.startup+0x5a): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccl3Dwc7.o
Main.cpp:(.text.startup+0x69): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccl3Dwc7.o
Main.cpp:(.text.startup+0x85): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccl3Dwc7.o
Main.cpp:(.text.startup+0xbc): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccl3Dwc7.o
Main.cpp:(.text.startup+0xf1): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccl3Dwc7.o
Main.cpp:(.text.startup+0x101): 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/11/libstdc++.a(globals_io.o)
Main.cpp:(.text.startup+0x113): additional relocation overflows omitted from the output
/usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(ios_init.o): in function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x1c): failed to convert GOTPCREL relocation against '_ZNSt8ios_base4Init11_S_refcountE'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x1c6): failed to convert GOTPCREL relocation against '_ZSt4cout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x260): failed to convert GOTPCREL relocation against '_ZSt3cin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x2e2): failed to convert GOTPCREL relocation against '_ZSt4cerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x353): failed to convert GOTPCREL relocation against '_ZSt4clog'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x541): failed to convert GOTPCREL relocation against '_ZSt5wcout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x5e5): failed to convert GOTPCREL relocation against '_ZSt4wcin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x670): failed to convert GOTPCREL relocation against '_ZSt5wcerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x6e9): failed to convert GOTPCREL relocation against '_ZSt5wclog'; relink with --no-relax
/usr/bin/ld: final link failed
collect2: error: ld returned 1 exit status