Submission #1209262

#TimeUsernameProblemLanguageResultExecution timeMemory
1209262andrejikusConnecting Supertrees (IOI20_supertrees)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "supertrees.h"
using namespace std;
typedef long long ll;
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) { cerr << to_string(h); if(sizeof...(t)) cerr << ", "; DBG(t...); }
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)

const int N = 1e7 + 3;


static int n;
static std::vector<std::vector<int>> p;
static std::vector<std::vector<int>> b;
static bool called = false;

static void check(bool cond, std::string message) {
    if (!cond) {
        printf("%s\n", message.c_str());
        fclose(stdout);
        exit(0);
    }
}

void build(std::vector<std::vector<int>> _b) {
    check(!called, "build is called more than once");
    called = true;
    check((int)_b.size() == n, "Invalid number of rows in b");
    for (int i = 0; i < n; i++) {
        check((int)_b[i].size() == n, "Invalid number of columns in b");
    }
    b = _b;
}

int construct(std::vector<std::vector<int>> p) {
	int n = p.size();
	vector<int> row(n);
	std::vector<std::vector<int>> answer;
	for (int i = 0; i < n; i++) {
        if (i+1 < n)
            row[i+1] = 1;
        row[i] = 0;
        if (i-1 >= 0)
            row[i-1] = 1;
		answer.push_back(row);
		if (i-1 >= 0)
            row[i-1] = 0;
	}
	build(answer);
	return 1;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/cc6ypzBs.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/ccVsLKpN.o:supertrees.cpp:(.text+0x1e0): first defined here
collect2: error: ld returned 1 exit status