Submission #465691

#TimeUsernameProblemLanguageResultExecution timeMemory
465691AnasBenMoussaHandcrafted Gift (IOI20_gift)C++14
Compilation error
0 ms0 KiB
#include "gift.h"
#include <vector>
#include <cassert>
#include <cstdio>
#include <string>

static int n, r;
static std::vector<int> a, b, x;
static std::string s;
static int possible = 0;
static int called = 0;

void craft(std::string &_s)
{
    assert(!called);
    s = _s;
    assert((int) s.size() == n);
    for (int i = 0; i < n; i++) {
        assert(s[i] == 'R' || s[i] == 'B');
    }
    called = 1;
}
int construct(int n, int r, std::vector<int> a, std::vector<int> b, std::vector<int> x) {
    std::string s(n, 'R');
    craft(s);
    return 1;
}

int main()
{
    assert(scanf("%d %d", &n, &r) == 2);
    a.resize(r);
    b.resize(r);
    x.resize(r);
    for (int i = 0; i < r; i++) {
        assert(scanf("%d %d %d", &a[i], &b[i], &x[i]) == 3);
    }

    fclose(stdin);

    possible = construct(n, r, a, b, x);

    assert(possible == 0 || possible == 1);

    printf("%d\n", possible);

    if (possible == 1) {
        printf("%s\n", s.c_str());
    } else {
        assert(!called);
    }

}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccwuCDON.o: in function `craft(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
grader.cpp:(.text+0xb0): multiple definition of `craft(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'; /tmp/cczN6A7N.o:gift.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/ccwuCDON.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cczN6A7N.o:gift.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status