# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
591333 | Vanilla | Paint By Numbers (IOI16_paint) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "messy.h"
#include <vector>
using namespace std;
vector<int> restore_permutation(int n, int w, int r) {
vector <int> p;
for (int i = 0; i < 8; i++){
p.push_back(i);
}
string s = "";
for (int i = 0; i < 8; i++){
s.push_back('1');
}
for (int i = 0; i < 8; i++){
add_element(s);
s[i] = '0';
}
compile_set();
vector <int> frq(10);
for (int i = 0; i < 256; i++){
string s = "";
for (int j = 0; j < 8; j++){
s = char('0' + !!(i & (1 << j))) + s;
}
if(check_element(s)) {
for (int j = 0; j < 8; j++){
if (s[j] == '1') frq[j]++;
}
}
}
for (int i = 0; i < 8; i++){
if (frq[i] != i + 1) {
swap(p[i], p[frq[i] - 1]);
break;
}
}
// for (auto i: p){
// cout << i << " ";
// }
// cout << "\n";
return p;
}