Submission #536630

#TimeUsernameProblemLanguageResultExecution timeMemory
536630DJ035Unscrambling a Messy Bug (IOI16_messy)C++17
38 / 100
1 ms340 KiB
#include "messy.h"
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
#include <bits/stdc++.h>
#define MEM 222
#define sanic ios_base::sync_with_stdio(0)
#define x first
#define y second
#define pf push_front
#define pb push_back
#define all(v) v.begin(), v.end()
#define sz size()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;
const ll INF = 1e17+7;
const ll MOD = 998244353;
ll gcd(ll a, ll b){
    if(a%b) return gcd(b, a%b);
    return b;
}
ll t,m;
std::vector<int> restore_permutation(int n, int w, int r) {
    string s,p;
    vector<int> ret(n);
    for(int i=0; i<n; i++) s+='0';
    for(int i=0; i<n; i++){
        s[i] = '1';
        //cout << s << ' ';
        add_element(s);
    }
    //cout << '\n';
    compile_set();
    for(int i=0; i<n; i++) p+='0';
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            if(p[j]=='1') continue;
            p[j] = '1';
            if(check_element(p)) {
                ret[j] = i;
                break;
            }
            p[j] = '0';
        }
        //cout << p << ' ';
    }
    //cout << '\n';
    return ret;
}
#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...