이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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))){
salida = (salida&bitmask);
salida2 = (salida2|bitmask);
}
}
string ANS = "";
for (int i = 0; i < sizes; ++i){
if ((salida>>i)&1){
ANS += "X";
} else if (!((salida2>>i)&1)){
ANS += "_";
} else{
ANS += "?";
}
}
return ANS;
}
# | 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... |