Submission #1250019

#TimeUsernameProblemLanguageResultExecution timeMemory
1250019testacc11World Map (IOI25_worldmap)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

// create_map: constructs a KxK color grid for N countries and given M adjacency pairs.
// Should be linked with external grader providing main().

vector<vector<int>> create_map(int N, int M,
                               const vector<int>& A,
                               const vector<int>& B) {
    // Simple construction: K = min(240, 2*M+1), at least 2
    int K = min(240, 2 * M + 1);
    if (K < 2) K = 2;
    vector<vector<int>> C(K, vector<int>(K, 1));

    // Place each adjacency as a vertical pair in its own column
    for (int i = 0; i < M && i < K; ++i) {
        C[0][i] = A[i];
        C[1][i] = B[i];
    }
    // Ensure every country appears at least once
    for (int j = 1; j <= N; ++j) {
        bool used = false;
        for (int i = 0; i < M && i < K; ++i) {
            if (A[i] == j || B[i] == j) { used = true; break; }
        }
        if (!used) {
            C[K-1][K-1] = j;
        }
    }
    return C;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccXemh4d.o: in function `main':
grader.cpp:(.text.startup+0x635): undefined reference to `create_map(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status