이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <vector>
#include "messy.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> restore_permutation(int n, int w, int r) {
string guess(8,'0');
vector<string> guesses(8);
vector<int> p(8);
iota(p.begin(),p.end(),0);
string special = "00001111";
for (int ones = 1; ones <= 7; ones++) {
guess[ones] = '1';
guesses[ones] = guess;
add_element(guess);
}
add_element(special);
compile_set();
//cout << check_element("0001111") << "\n";
bool meow = false;
for (int i = 0; i < 256; i++) {
string toCheck = bitset<8>(i).to_string();
// cout << toCheck << " ";
if (check_element(toCheck)) {
int ones = __builtin_popcount(i);
if (toCheck != guesses[ones] && toCheck != special) {
// cout << toCheck << "\n";
vector<int> swapped;
for (int bit = 0; bit < 8; bit++) {
if (toCheck[bit] != guesses[ones][bit]) swapped.push_back(bit);
}
if (swapped.size() != 2) {
// cout << toCheck << " " << swapped.size() << " " << ones << "\n";
// assert(ones == 4);
// swap(p[6],p[7]);
meow = true;
}
else {swap(p[swapped[0]],p[swapped[1]]); meow = false; break;}
}
}
}
if (meow) swap(p[6],p[7]);
//for (int e: p) cout << e << " "; cout << "\n";
return p;
}
# | 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... |