This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// c4ts0up
// Alvaro Bacca - COL3
#include "messy.h"
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
typedef long long ll;
typedef long double ld;
using namespace std;
string sumada; // cadena de los sumados para sacar, a traves de XOR, el bit deseado
vector <int> perm;
void AnadirElementos(int n) {
// crea la cadena y la llena de 0s
string cadena = "";
for (int i=0; i<n; i++) cadena += "0";
// añade los elementos (n elementos)
for (int i=0; i<n; i++) {
cadena[i] = '1';
add_element(cadena);
}
}
vector<int> restore_permutation(int n, int w, int r) {
AnadirElementos(n);
compile_set();
sumada = "";
for (int i=0; i<n; i++) sumada += "0";
perm.resize(n);
// empezamos la busqueda
for (int i=0; i<n; i++) {
// cambiamos la sumada en busca de lo que queremos
for (int j=0; j<n; j++) {
if (sumada[j] == '0') {
sumada[j] = '1';
// Encontramos el correcto
if (check_element(sumada)) {
//cout << "sumada " << sumada << ", j = " << j << endl;
perm[j] = i;
break;
}
// no era
sumada[j] = '0';
}
}
}
return perm;
}
# | 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... |