Submission #1196018

#TimeUsernameProblemLanguageResultExecution timeMemory
1196018lrnnzUnscrambling a Messy Bug (IOI16_messy)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include "messy.h"
using namespace std;
 
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define ll long long
#define ld long double
#define ui uint64_t
#define cont(set, element) ((set).find(element) != (set).end())
 
/********* DEBUG *********/
 
template <typename T>
void outvec(const vector<T>& Z){
    for (const T& x : Z)
    cout << x << ' ';
    cout << "\n";
}
void printVariable(const any& var) {
    if (!var.has_value()) {
        cout << "null";
        return;
    }

    if (var.type() == typeid(int)) {
        cout << any_cast<int>(var);
    } else if (var.type() == typeid(double)) {
        cout << any_cast<double>(var);
    } else if (var.type() == typeid(float)) {
        cout << any_cast<float>(var);
    } else if (var.type() == typeid(char)) {
        cout << any_cast<char>(var);
    } else if (var.type() == typeid(bool)) {
        cout << (any_cast<bool>(var) ? "true" : "false");
    } else if (var.type() == typeid(string)) {
        cout << any_cast<string>(var);
    } else if (var.type() == typeid(const char*)) {
        cout << any_cast<const char*>(var);
    } else if (var.type() == typeid(long long)) {
        cout << any_cast<long long>(var);
    } else {
        cout << "[unknown type]";
    }
}

template<typename... Args>
void outval(Args... args) {
    vector<any> variables = {args...};
    
    for (size_t i = 0; i < variables.size(); ++i) {
        printVariable(variables[i]);
        if (i != variables.size() - 1) {
            cout << " ";
        }
    }
    cout << "\n";
}

#define nl "\n"
#define sp << " " <<

/********* DEBUG *********/

const ll MOD = 1000000007;
const ll inf = 1e18;
const ll mxN = 1000005;

void compile_set(){

}

void add_element(string x){

}

bool check_element(string x){
    return false;
}

vector<int> restore_permutation(int n, int w, int r) {
    // st1, and also 2. w writes, r^2 reads
    add_element("10000000");
    add_element("11000000");
    add_element("11100000");
    add_element("11110000");
    add_element("11111000");
    add_element("11111100");
    add_element("11111110");

    compile_set();

    // creating
    vector<char> curr = {'0','0','0','0','0','0','0','0'};    
    vector<int> ans(8, -1);

    for (int i = 0; i < 8; i++){
        for (int j = 0; j < 8; j++){
            if (curr[i] != '0')
            continue;

            string st = "";

            for (int k = 0; k < 8; k++)
                st+=curr[i];

            if (check_element(st)){
                curr[j]=1;
                ans[i]=j;
                break;
            }
        }
    }
    
    return ans;
}

Compilation message (stderr)

messy.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
messy_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
/usr/bin/ld: /tmp/cce4eKKT.o: in function `check_element(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x950): multiple definition of `check_element(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/ccOU2sui.o:messy.cpp:(.text+0x850): first defined here
/usr/bin/ld: /tmp/cce4eKKT.o: in function `add_element(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0xac0): multiple definition of `add_element(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/ccOU2sui.o:messy.cpp:(.text+0x840): first defined here
/usr/bin/ld: /tmp/cce4eKKT.o: in function `compile_set()':
grader.cpp:(.text+0xb20): multiple definition of `compile_set()'; /tmp/ccOU2sui.o:messy.cpp:(.text+0x830): first defined here
collect2: error: ld returned 1 exit status