Submission #1211500

#TimeUsernameProblemLanguageResultExecution timeMemory
1211500fafnirConnecting Supertrees (IOI20_supertrees)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

// #define LOCAL


void build(vector<vector<int>> p) {
    cout << 1 << '\n';
    for (auto& row : p) {
        for (auto& el : row) cout << el << ' ';
        cout << '\n';
    }
}


// p: requirements
// Return 
//      0 --> Impossible to construct
//      1 --> Possible and make call to build
int construct(vector<vector<int>> p) {
    
    const int n = p.size();

    vector<vector<int>> answer(n, vector<int>(n, 0));
    for (int i = 0; i < n-1; ++i) {
        answer[i][i+1] = 1;
        answer[i+1][i] = 1;
    }

    build(answer);
    return 1;
}

#ifdef LOCAL
int32_t main(int argc, char** argv) {

    assert (argc == 3);

    freopen(argv[1], "r", stdin);
    freopen(argv[2], "w", stdout);


    vector<vector<int>> p;
    int n;
    cin >> n;

    p.resize(n);
    for (auto& e : p) {
        vector<int> row;
        for (auto& el : row) cin >> el;
        e = row;
    }

    construct(p);

    return 0;
}
#endif

Compilation message (stderr)

/usr/bin/ld: /tmp/ccQKIS35.o: in function `build(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)':
grader.cpp:(.text+0x220): multiple definition of `build(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'; /tmp/cc0JQKq8.o:supertrees.cpp:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status