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 <cstdlib>
#include <bits/stdc++.h>
using namespace std;
std::string solve_puzzle(std::string s, std::vector<int> c) {
string result = "";
int total = 0;
int sz = s.size();
for (auto &i : c) {
total += i;
}
total += c.size() - 1;
int e = sz - total;
int sz2 = c.size();
if (e == 0) {
for (int i = 0; i < sz2; i++) {
for (int j = 0 ; j < c[i]; j++) {
result += 'X';
}
if (i < sz2 - 1) {
result += '_';
}
}
return result;
}
cout << e << endl;
for (int i = 0; i < sz2; i++) {
for (int j = 0 ; j < min(c[i], e); j++) {
result += '?';
}
if (c[i] > e) {
for (int j = 0 ; j < c[i] - e; j++) {
result += 'X';
}
}
if (i < sz2 - 1)
result += '?';
}
for (int i = result.size(); i < sz; i++) {
result += '?';
}
return result;
}
# | 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... |