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 "paint.h"
#include <iostream>
#include <cstdlib>
using namespace std;
string solve_puzzle(string s, vector<int> c) {
int k = c.size();
int sizes = s.size();
int salida = (1<<sizes)-1, salida2 = 0;
for (int bitmask = 0; bitmask < (1<<sizes); ++bitmask){
int counter = 0, counter2 = 1;
int flag = 0;
for (int i = 0; i < sizes; ++i){
if ((bitmask>>i)&1){
if (counter2 > k){
flag = 2;
break;
}
counter++;
if (counter == c[counter2-1]){
flag = 1;
} else if (counter > c[counter2-1]){
flag = 2;
break;
}
} else{
if (counter != 0 && flag != 1){
flag = 2;
break;
}
counter = 0;
if (flag == 1){
counter2++;
flag = 0;
}
}
}
if (((counter2 == k+1)&&(flag == 0))||((counter2 == k)&&(flag == 1))){
for (int i = 0; i < sizes; ++i){
if ((bitmask>>i)&1){
cout << "X";
} else{
cout << "-";
}
}
cout << endl;
salida = (salida&bitmask);
salida2 = (salida2|bitmask);
}
}
for (int i = 0; i < sizes; ++i){
if ((salida>>i)&1){
cout << "X";
} else if (!((salida2>>i)&1)){
cout << "_";
} else{
cout << "?";
}
}
cout << endl;
return "";
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |