Submission #61616

#TimeUsernameProblemLanguageResultExecution timeMemory
61616KubalionzzaleUnscrambling a Messy Bug (IOI16_messy)C++14
38 / 100
5 ms384 KiB
#include <vector>
#include <iostream>

#include "messy.h"


std::vector<int> restore_permutation(int n, int w, int r) {

    std::string str = "";
    std::vector<int> ans;
    for (int i = 0; i < n; ++i)
    {
        str += "0";
        ans.push_back(0);
    }

    for (int i = 0; i < n; ++i)
    {
        str[i] = '1';
        add_element(str);
    }

    compile_set();

    for (int i = 0; i < n; ++i)
    {
        str[i] = '0';
    }

    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            if (str[j] == '1')
                continue;

            str[j] = '1';

            bool checked = check_element(str);

            if (checked)
            {
                ans[j] = i;
                break;
            }
            else
            {
                str[j] = '0';
            }
        }
    }
/*
    for (int i = 0; i < n; ++i)
    {
        std::cout << ans[i] << " ";
    }*/

    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...