Submission #709285

#TimeUsernameProblemLanguageResultExecution timeMemory
709285ssenseUnscrambling a Messy Bug (IOI16_messy)C++17
20 / 100
1 ms308 KiB
#include <bits/stdc++.h>
#include "messy.h"
#define startt ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long  ll;
using namespace std;
#define vint vector<int>
 
 
string convert(int x)
{
    string now = "00000000";
    for(int i = 0; i < 8; i++)
    {
        if((x&(1<<i)) > 0)
        {
            now[i]++;
        }
    }
    return now;
}
 
vector<int> restore_permutation(int n, int w, int r)
{
    string now = "00000000";
    for(int i = 0; i <= 7; i++)
    {
        now[i]++;
        add_element(now);
    }
    compile_set();
    vint bits;
    for(int i = 0; i < 8; i++)
    {
        bits.push_back(1<<i);
    }
    vint ans(8);
    int already = 0;
    for(int i = 1; i <= 8; i++)
    {
        for(int j = 0; j < 8; j++)
        {
            if((bits[j]&already) == 0)
            {
                int x = bits[j]+already;
                if(check_element(convert(x)))
                {
                    int acc = x-already;
                    ans[i-1] = 31-__builtin_clz(acc);
                    already = x;
                    break;
                }
            }
        }
    }
    return ans;
}
/*
int32_t main(){
    startt
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}
 
 
*/
#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...