| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1244993 | Gabriel | Unscrambling a Messy Bug (IOI16_messy) | C++20 | 1 ms | 328 KiB | 
#include <bits/stdc++.h>
#include "messy.h"
using namespace std;
vector<int> restore_permutation(int n, int w, int r){
    string Primero = "01010101", Segundo = "00110011", Tercero = "00001111";
    vector<int> Retorno(8);
    if(n == 8){
        add_element(Primero);
        add_element(Segundo);
        add_element(Tercero);
        compile_set();
        if(check_element(Primero)){
            if(check_element(Segundo)){
                if(check_element(Tercero)){
                    for(int i = 0; i < 8; i++) Retorno[i] = i;
                    return Retorno;
                } else {
                    for(int i = 0; i < 8; i++){
                        for(int j = i + 1; j < 8; j++){
                            if(Tercero[i] == Tercero[j]) continue;
                            swap(Tercero[i], Tercero[j]);
                            if(check_element(Tercero)){
                                for(int k = 0; k < 8; k++){
                                    Retorno[k] = k;
                                    if(k == i) Retorno[k] = j;
                                    if(k == j) Retorno[k] = i;
                                }
                                return Retorno;
                            }
                            swap(Tercero[i], Tercero[j]);
                        }
                    }
                }
            } else {
                for(int i = 0; i < 8; i++){
                    for(int j = i + 1; j < 8; j++){
                        if(Segundo[i] == Segundo[j]) continue;
                        swap(Segundo[i], Segundo[j]);
                        if(check_element(Segundo)){
                            for(int k = 0; k < 8; k++){
                                Retorno[k] = k;
                                if(k == i) Retorno[k] = j;
                                if(k == j) Retorno[k] = i;
                            }
                            return Retorno;
                        }
                        swap(Segundo[i], Segundo[j]);
                    }
                }
            }
        } else {
            for(int i = 0; i < 8; i++){
                for(int j = i + 1; j < 8; j++){
                    if(Primero[i] == Primero[j]) continue;
                    swap(Primero[i], Primero[j]);
                    if(check_element(Primero)){
                        for(int k = 0; k < 8; k++){
                            Retorno[k] = k;
                            if(k == i) Retorno[k] = j;
                            if(k == j) Retorno[k] = i;
                        }
                        return Retorno;
                    }
                    swap(Primero[i], Primero[j]);
                }
            }
        }
    }
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
