Submission #856205

# Submission time Handle Problem Language Result Execution time Memory
856205 2023-10-02T19:31:46 Z codecodru Speedrun (RMI21_speedrun) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 1005;
const int MAXL = 325;

vector<int> adj[MAXN];
vector<int> hints[MAXN];
int l;
bool goTo(int x) {
    return false;
}
void setHint(int node, int bitIndex, bool value) {
    hints[node][bitIndex - 1] = value;
}
void setHintLen(int length) {
    l = length;
}
void dfs(int v, int parent) {
    for (int u : adj[v]) {
        if (u == parent) continue;
        if (hints[v][v] == 1) {
            bool moved = goTo(u);
            if (moved) dfs(u, v);
        }
    }
}

void assignHints(int subtask, int N, int A[], int B[]) {
    if (subtask == 1) {
        l = min(N, 20);
    } else if (subtask == 2 || subtask == 3) {
        l = min(20, N);
    } else {
        l = min(316, N);
    }

    setHintLen(l);
    for (int i = 1; i <= N; i++) {
        hints[i].resize(l);
    }
    for (int i = 1; i < N; i++) {
        setHint(A[i], A[i], 1);
        setHint(B[i], B[i], 1);
    }
}

void speedrun(int subtask, int N, int start) {
    vector<bool> visited(N + 1, false);
    dfs(start, 0);
    visited[start] = true;
    int nodes_visited = 1;

    while (nodes_visited < N) {
        for (int i = 1; i <= N; i++) {
            if (!visited[i] && hints[i][i] == 1) {
                bool moved = goTo(i);
                if (moved) {
                    visited[i] = true;
                    nodes_visited++;
                }
            }
        }
    }
}

Compilation message

/usr/bin/ld: /tmp/ccTXYccb.o:(.bss+0x20): multiple definition of `hints'; /tmp/ccYNF1S7.o:(.bss+0x20): first defined here
/usr/bin/ld: /tmp/ccTXYccb.o: in function `setHintLen(int)':
stub.cpp:(.text+0xc0): multiple definition of `setHintLen(int)'; /tmp/ccYNF1S7.o:speedrun.cpp:(.text+0xe0): first defined here
/usr/bin/ld: /tmp/ccTXYccb.o: in function `setHint(int, int, bool)':
stub.cpp:(.text+0x150): multiple definition of `setHint(int, int, bool)'; /tmp/ccYNF1S7.o:speedrun.cpp:(.text+0xb0): first defined here
/usr/bin/ld: /tmp/ccTXYccb.o: in function `goTo(int)':
stub.cpp:(.text+0x420): multiple definition of `goTo(int)'; /tmp/ccYNF1S7.o:speedrun.cpp:(.text+0xa0): first defined here
collect2: error: ld returned 1 exit status